DECODE
|
IIF
|
Decode can be used in Select
statement
|
IIF cannot be used in a Select
statement.
|
EXAMPLE:
DECODE(deptname,”SALES”,1,0)
—-If deptname is SALES then return 1 else return zero |
EXAMPLE:IIF( GRADE > 1, IIF( GRADE
< 2, SAL1, IIF( GRADE < 3, SAL2, IIF( GRADE < 4, SAL3, BONUS))), 0 )
—-If the GRADE less than ONE then return zero else return SAL1 OR SAL2 OR SAL3 OR BONUS |
Decode gives better readablity to
users
|
IIF dosenot give good readablity
|
Thanks
Ur's Hari
No comments:
Post a Comment