Thursday, October 16, 2008

Oracle 10g: IN Operator

I always forgot on how to use the IN Operator....very useful yet so easy to be forgotten...


I had a task where I had to update the child's table(
gbl_mouprogress_dtl) STATUS-field automatically ONCE the master table (
gbl_mou_mst) STATUS-field being updated using the OWNERTYPE-field, OWNERID-field.




UPDATE GBL_MOUPROGRESS_DTL
SET STATUS = STATUS_,
LASTMODIFIEDBY = LASTMODIFIEDBY_,
LASTMODIFIEDDATE = SYSDATE
WHERE MOUPROGRESSID IN (
SELECT gbl_mou_mst.mouid
FROM gbl_mou_mst gbl_mou_mst
WHERE ( (gbl_mou_mst.status = WHERESTATUS_)
AND (gbl_mou_mst.branchid = BRANCHID_)
AND (gbl_mou_mst.ownertype = OWNERTYPE_)
AND (gbl_mou_mst.ownerid = OWNERID_)
)
);

2 comments:

nagakeciks said...

huihhh...dah matrix a mu skarang...

peah @ peps said...

haha..keanu peps...