Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UK7kw-0004be-Ej for pgsql-sql@arkaria.postgresql.org; Mon, 25 Mar 2013 13:48:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UK7kv-0001Vq-Oz for pgsql-sql@arkaria.postgresql.org; Mon, 25 Mar 2013 13:48:09 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UK7kv-0001Vl-1F for pgsql-sql@postgresql.org; Mon, 25 Mar 2013 13:48:09 +0000 Received: from smtp137.kinghost.net ([189.38.82.137]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UK7kq-0004vi-Iz for pgsql-sql@postgresql.org; Mon, 25 Mar 2013 13:48:08 +0000 Received: from smtp-gw-03.kinghost.net (smtp-gw03 [127.0.0.1]) by smtp137.kinghost.net (Postfix) with ESMTP id D1D002C1FE; Mon, 25 Mar 2013 10:48:00 -0300 (BRT) Received: from sygecom.com.br (unknown [10.5.5.60]) by smtp-gw-03.kinghost.net (Postfix) with ESMTPA id C7A7610A83849 for ; Mon, 25 Mar 2013 10:48:00 -0300 (BRT) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_86f44d71c11c7df6fc3d3203f78e7260" Date: Mon, 25 Mar 2013 10:48:00 -0300 From: Mauricio Cruz To: Subject: From with case Organization: Sygecom Message-ID: <5ba0a01548c7c6540b1c693cdf7e979d@sygecom.com.br> X-Sender: cruz@sygecom.com.br User-Agent: RoundCube Webmail/0.4 X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org --=_86f44d71c11c7df6fc3d3203f78e7260 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi everyone, =20 I'm working in a PL/SQL and I'd like to use the same PL for 2 kinds of tables...=20 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=20 with the unique diference for the name of the table...=20 So I thought to use something like this: ...=20 For rSql in select a.adiant, a.desc_per from case when cTip=3D'P' then valapag else valerec end where cod=3D2 Loop=20 ...=20 But it just dont work... does some one have other solution for this case ? Thanks guys.=20 --=20 Grato, Mauricio Cruz Sygecom Inform=C3=A1tica [1] 51 3442-3975 / 3442-2345=20 =20 Links: ------ [1] http://www.sygecom.com.br --=_86f44d71c11c7df6fc3d3203f78e7260 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Hi everyone, 

 

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

I have "valepag" and "valerec" both tables have the same columns, but on= e is for debit and the other one is for credit, the PL will work for both c= ases

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
        &nb= sp;             when cTip=3D'P'
<= span style=3D"font-family: 'courier new', courier;">      &n= bsp;               then valapag    &nbs= p;                 else valerec
   =                end
      &nbs= p;      where cod=3D2 Loop

 

...


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

 

Thanks guys.

 

--=20
Grato,
Mauricio Cruz
Sygecom Informática
51 3442-3975 / 3442-2345 
--=_86f44d71c11c7df6fc3d3203f78e7260--