Professional Documents
Culture Documents
Exhibit 3 Outer Join and Decode Example
Exhibit 3 Outer Join and Decode Example
8/13/15, 8:49 PM
select acc.id, decode( type, 'C', amount, 0 ) acc_credit, decode( type, 'D', amount, 0 ) acc_debit,
nvl(cust.lastName, '--') cust_lastName,
nvl(pri.cust_priority, 'unknown') pri_priority
from (select id, type, amount, transaction_date from accounts order by id) acc, customers cust, prio
where acc.id = cust.id(+)
and cust.id = pri.id(+)
and acc.transaction_date > SYSDATE - 1000
and rownum < 2
order by acc.id
;
http://postgresmigrations.com/database-migration/stored-procedurbit-3-outer-join-and-decode-example?tmpl=component&print=1&page=
Page 1 of 1