A Journal Through My Activities, Thoughts, and Notes
#sql
This
update:
That syntax is actually not Oracle specific. It's part of the SQL standard and also supported by Postgres and DB2. Many thanks to @truls46@mastodon.social, who contributed this update.
UPDATE dfx.fee_band_ccy TARGET
SET (fee_amount, fee_threshold) = (
SELECT fee_amount, fee_threshold
FROM dfx.fee_band_ccy SRC
WHERE SRC.CCY_CODE = 'UYU'
AND SRC.BANDID = TARGET.BANDID
AND ROWNUM = 1
)
WHERE TARGET.ccy_code = 'VES';
This
SET (column1, column2) = (subquery)
syntax is quite handy in Oracle SQL. It's especially useful when you need to update multiple columns from the same source. And, most importantly, I did't know it before!update:
That syntax is actually not Oracle specific. It's part of the SQL standard and also supported by Postgres and DB2. Many thanks to @truls46@mastodon.social, who contributed this update.