pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mauricio Cruz <cruz@sygecom.com.br>
To: pgsql-sql@postgresql.org
Subject: From with case
Date: Mon, 25 Mar 2013 10:48:00 -0300
Message-ID: <5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>



Hi everyone,  

I'm working in a PL/SQL and I'd like to use the same
PL for 2 kinds of tables... 

I have "valepag" and "valerec" both tables
have the same columns, but one is for debit and the other one is for
credit, the PL will work for both cases 

with the unique diference for
the name of the table... 

So I thought to use something like this:


... 

For rSql in select a.adiant,
 a.desc_per
 from case
 when
cTip='P'
 then valapag
 else valerec
 end
 where cod=2 Loop 

... 

But
it just dont work... does some one have other solution for this case ?


Thanks guys. 

-- 
Grato,
Mauricio Cruz
Sygecom Informática [1]
51
3442-3975 / 3442-2345 
 

Links:
------
[1] http://www.sygecom.com.br

view thread (8+ messages)  latest in thread

Message-ID: <5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br>
Permalink:  ../5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br/
Also on:    postgresql.org/message-id/5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cruz@sygecom.com.br
  Subject: Re: From with case
  In-Reply-To: <5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox