Saturday, November 5, 2011

Oracle UROWID

Oracle UROWID Datatype
    From Oracle Manual: A single datatype called the universal rowid, or UROWID, supports both logical and physical rowids, as well as rowids of foreign tables such as non-Oracle tables accessed through a gateway. A column of the UROWID datatype can store all kinds of rowids. The value of the COMPATIBLE initialization parameter (for file format compatibility) must be set to 8.1 or higher to use UROWID columns.
    Below example uses UROWID in a procedure.  create or replace procedure tamil_test_proc as
     -- declare pl/sql table  type RowidTab is table of urowid index by binary_integer ; Prowid RowidTab; J Natural := 200;     -- this is batch size  cursor c1 is select rowid from tamil_test ;  begin  open c1 ;   Loop      FETCH c1 bulk collect into prowid limit J;      FORALL M in 1..prowid.count         DELETE from Tamil_test where rowid = prowid(M);         EXIT WHEN C1%NOTFOUND;    END LOOP;    COMMIT;  end;  /

Thanks,  Tamil

No comments:

Post a Comment