Oracle Logbook

February 28, 2014

How to use OLAP inside an Oracle update

Filed under: Uncategorized — heliodias @ 2:48 pm

Yesterday a client told me she couldn´t find any example of this on google,

It really surprised me, so I decided produce an example of this:

UPDATE
APOIO4 B
SET B.COL_VAL = 10
WHERE ROWID IN
(SELECT ROWID FROM (SELECT ROWID,RANK() OVER (PARTITION BY COLPK1, COLPK2
ORDER BY COL4 DESC, COL5) SEQUENCIA
FROM APOIO4
WHERE COLFILTER1=’VD902′
AND COLFILTER2 = ‘100161’) WHERE SEQUENCIA=1);

 

Advertisements

Blog at WordPress.com.