From with case

From: Mauricio Cruz <cruz(at)sygecom(dot)com(dot)br>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: From with case
Date: 2013-03-25 13:48:00
Message-ID: 5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2013-03-25 14:01:09 Re: From with case
Previous Message Adrian Klaver 2013-03-21 13:40:41 Re: Reading from file without superuser privilege