Selasa, 09 Februari 2010

encode sintak di PL/SQL Oracle

SELECT DECODE (value,if this value,return this value,
if this value,return this value,
....
otherwise this value)
FROM dual;

contoh:
SELECT program_id,
DECODE(customer_id,
'AAL', 'American Airlines',
'ILC', 'Intl. Leasing Corp.',
'NWO', 'Northwest Orient',
'SAL', 'Southwest Airlines',
'SWA', 'Sweptwing Airlines',
'USAF', 'United States Air Force',
'Not Known') AIRLINE,
delivered_date
FROM airplanes
WHERE ROWNUM <>

Tidak ada komentar: