Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ayyoob1234
Starting Member
3 Posts |
Posted - 2013-06-11 : 13:22:32
|
hii am trying to add a math function inside a decode. is it possible.for eg.select account_id, decode(transaction_amount, < 0, 'Debit', > 0, 'Credit'from tableplzz help |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-06-11 : 13:27:00
|
hmm so you're using Oracle .. by the way this forum is specifically for SQL server... Now to yours question .. you may need to use Case Statment. select account_idCASE WHEN transaction_amount < 0 THEN 'Debit' ELSE 'Credit' ENDfrom tableCheersMIK |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-06-12 : 00:22:34
|
You can use SIGN() Function to find whether -ve or +ve and then apply DECODE functionality...........Check the below modified codequote: Originally posted by ayyoob1234 hii am trying to add a math function inside a decode. is it possible.for eg.select account_id, decode(SIGN(transaction_amount), -1, 'Debit', 1, 'Credit')from tableplzz help
--Chandu |
|
|
|
|
|