Oracle plsql block executed in plsql


For rerunnable migration this was necessary to conditionally compile/execute plsql that had a static cursor that was referencing a table that might not exist. The static cursor was required for updating where current of. If the table didn't exist the static cursor definition wouldn't compile.

DECLARE
BEGIN
 EXECUTE IMMEDIATE 'DECLARE
    BEGIN
      execute immediate ''select &7 from dual'';
    END;';
END;
/

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout