Foxpro Like IIf() function in Oracle [message #373964] |
Fri, 18 May 2001 04:35 |
Yuvraj Thapa
Messages: 28 Registered: May 2001
|
Junior Member |
|
|
Dear All,
I'm Developing financial application in oracle. Now in my transaction table I've amount field which contains positive and negative numeric value. I want foxpro like iif() function in oracle so that I can use like below..
select iif(amount>0,amount) pos,iif(acount<0,amount) neg from
;
I've tried with decode function but it is not working..
Please help me.
Thanks and Regards,
Yuvraj
Kathmandu
|
|
|
Re: Foxpro Like IIf() function in Oracle [message #373976 is a reply to message #373964] |
Fri, 18 May 2001 05:23 |
GIRIDHAR KODAKALLA
Messages: 92 Registered: May 2001
|
Member |
|
|
Hai Yuvraj Thapa,
Pls check this sql statement.
In this screen, the output is misleading.
The negative value is aligning to the left.
Check the query.
SQL> select * from test;
NAME
---------
-123
0
123
3 rows selected.
SQL> select decode(sign(name),1,name) POSITIVE, decode(sign(name),-1,name) NEGATIVE
from test;
POSITIVE NEGATIVE
--------- ---------
-123
123
3 rows selected.
Cheers,
Giridhar Kodakalla
|
|
|