Loading...
 

SQL

SQL

  • Execute procecural sql (oracle). e.g. delete rows with same key data as previous row
DECLARE
      prev_rate NUMBER := 0;
      prev_sid NUMBER := 0 ;
      CURSOR cur IS
            SELECT c.SEC_SID, c.COUPON_RATE, c.REFIX_DATE FROM COUPON_RATE c
            ORDER BY c.SEC_SID, c.REFIX_DATE;
BEGIN
      FOR rec IN cur 
      LOOP
            IF prev_sid = rec.sec_sid AND prev_rate = rec.COUPON_RATE THEN
               DELETE FROM COUPON_RATE WHERE sec_sid = rec.sec_sid AND refix_date = rec.refix_date AND COUPON_RATE = rec.COUPON_RATE;
               COMMIT;
            END IF;
            prev_rate := rec.COUPON_RATE;
            prev_sid := rec.sec_sid;
      END LOOP;
END ;
/

Created by admin. Last Modification: Tuesday 29 of May, 2007 09:35:15 UTC by admin.

Search For a Wiki Page

Google Search

 
www.iandjones.com
WWW