Topic: using pl/sql cursor block in migration file

i would like to use pl/sql cursor block in migriation file (self.up) method .

Below is my curosor ,which i am using to populate the columns with the data

DECLARE
CURSOR DATE_CUR IS
  SELECT id,firstdate_1,lastdate_1 FROM servers;     
BEGIN
FOR i IN DATE_CUR
LOOP
   UPDATE table    SET    firstdate = TO_DATE((TO_CHAR(TO_DATE('19700101','YYYYMMDD') + (i.FIRSTDATE_1/(60*60*24)),'DD:MM:YYYY HH24:MI:SS')),'DD:MM:YYYY HH24:MI:SS')
  , lastdate= TO_DATE((TO_CHAR(TO_DATE('19700101','YYYYMMDD') + (i.LASTDATE_1/(60*60*24)),'DD:MM:YYYY HH24:MI:SS')),'DD:MM:YYYY HH24:MI:SS')
  WHERE  id=i.id;
  commit;
END LOOP;
END;

can this be used with "EXECUTE SQL " .Kindly suggest me on this .
Thanks in advance

Last edited by surender (2012-04-12 01:32:53)