Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there any function corresponds to DECODE in Oracle ?
Message
De
28/10/1999 09:13:44
 
 
À
28/10/1999 08:39:08
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00282059
Message ID:
00282972
Vues:
22
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform