A SQL Problem

From: Agi Chen <agi_at_mail.taicom.com.tw>
Date: Fri, 5 Mar 1999 09:22:56 +0800
Message-ID: <MPG.1149b2c9bde0d1e9989681_at_news.hinet.net>



Dear all,
[Quoted] I have a problem in SQL statement.

[Quoted] [Quoted] hmmm....

My table (let's say tableA) desc like this

 STK_NO      VARCHAR2,
 YEAR        DATE    ,  
 IN          NUMBER  ,
 OUT         NUMBER    

some sample data as follows ....

STK_NO YEAR IN OUT
0001 1999 300 200
0002 1999 100 150
0003 1999 500 250

How do I get the report in SQL*PLUS like this ?

if IN >= OUT then

     result(+) = IN - OUT
else

     result(-) = ABS(IN - OUT)

STK_NO YEAR RESULT(+) RESULT(-)
------ ----- --------- ---------
0001 1999 100
[Quoted] 0002 1999 50
0003 1999 250

Any idea ???  

Best Regards
Agi Chen
agi_at_mail.taicom.com.tw       Received on Fri Mar 05 1999 - 02:22:56 CET

Original text of this message