Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there any function corresponds to DECODE in Oracle ?
Message
From
28/10/1999 09:13:44
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00282059
Message ID:
00282972
Views:
21
Let me ask you one more. What I really wanted to do is sumation with decode, in Oracle,like this
CREATE TABLE BS1( iDATE DATE, iCode Varchar2 , amount number );
* iCode is the one to distinguish revenue and expenditure,for example,'A%%%' is of revenue and 'B%%%' for expenditure.

IF I want to retrieve a total amount of income and outgo within a period
> SELECT iDATE, sum(decode(substr(iCode,1,1),'A',amount,0)) INCOME,
> sum(decode(substr(iCode,1,1),'B',amount,0)) OUTGO
> FROM BS1
> Where idate BETWEEN d1 AND d2
> GROUP BY iDate

Then how can I make it the same with 'CASE' sentence? Oh! I forgot to thank you and please understand my Oracle-only environment.
-Jae-
OCP8 DBA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform