Feb 4, 2010 5:56 AM
Netezza Update
-
Like (0)
Hi All,
I want a equivalent neteeza update statement for the below mentioned Oracle update
UPDATE SHIPMENT s1
SET ORIGIN_SIC_ID =
(SELECT sic.sic_id sic_id
FROM sic_location sic
WHERE s1.orig_trmnl_sic_cd = sic.sic_code
and s1.ORIGIN_SIC_ID IS NULL
)
WHERE EXISTS
(SELECT sic.sic_id sic_id
FROM sic_location sic
WHERE s1.orig_trmnl_sic_cd = sic.sic_code
and s1.ORIGIN_SIC_ID IS NULL
)
or basically some update staement which uses inline / subquery.
Thanks,Amudha
This is actually much easier to do in Netezza since Netezza allows a FROM clause in your UPDATE statement:
update shipment s1
set origin_sic_id = sic.sic_id
from sic_location sic
where s1.ORIGIN_SIC_ID is null
and s1.orig_trmnl_sic_cd = sic.sic_code
.
Wow! Thanks a lot
Amudha

