Jika ACCOUNT_NO = 'D' maka hasilnya AMOUNT,
jika ACCOUNT_NO <> 'D' maka hasilnya AMOUNT * -1

Misal:
MYTABLE
ACCCOUNT_NO AMOUNT
------------------ -------------
A                           2000
B                            4000
C                            1000
D                            1500

select SUM( DECODE(ACCOUNT_NO,'D', AMOUNT, AMOUNT * (-1)))
from  MYTABLE;

Maka hasilnya
-2000 + -4000 + -1000 + 1500 = -5500


Salam,

Indra Armansyah
[EMAIL PROTECTED]

----- Original Message ----- 
From: "aan" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 20, 2006 2:48 PM
Subject: [indo-oracle] Fungsi sum dalam decode


> Dear All,
>
> Mohon Bantuannya ......!
>
>
>
> saya mendapatkan script di sebuah buku oracle yaitu fungsi sum di dalam 
> decode ..!
> saya kesulitan mengartikan arti * (-1) dalam fungsi decode
>
> SUM( DECODE(ACCOUNT_NO,'D', AMOUNT, AMOUNT * (-1)))
>
> Tolong penjelasan dari script di atas
>
> Best Regards
> Aan Angsori,SE
> EDP Department
> PT.Nikomas Gemilang
> [EMAIL PROTECTED]
> 0254 - 401586 Ext: 7192
>
>
> [Non-text portions of this message have been removed]
>
>
>
> --
> -----------I.N.D.O - O.R.A.C.L.E---------------
> Keluar: [EMAIL PROTECTED]
> Website: http://indo-oracle.blogspot.com
> Mirror: http://indooracle.wordpress.com
> -----------------------------------------------
>
> Bergabung dengan Indonesia Thin Client User Groups,
> Terminal Server, Citrix, New Moon Caneveral, di:
> http://indo-thin.blogspot.com
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.2/393 - Release Date: 7/19/2006
>
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/PhFolB/TM
--------------------------------------------------------------------~-> 

--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.blogspot.com
Mirror: http://indooracle.wordpress.com
-----------------------------------------------

Bergabung dengan Indonesia Thin Client User Groups, 
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.blogspot.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/indo-oracle/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke