next up previous
Next: Executing queries Up: No Title Previous: Executing a dynamic update

Dynamic create, drop etc.

DECLARE
  handle INTEGER;
  stmt1 varchar2(256);
  stmt2 varchar2(256);
BEGIN
  stmt1 := 'drop table zzz';
  stmt2 := 'create table zzz (col1 integer,' ||
           ' col2 number(4), col3 varchar2(30))';
  handle := DBMS_SQL.OPEN_CURSOR;
  DBMS_SQL.PARSE(handle,stmt1,DBMS_SQL.V7);
  dbms_output.put_line('Table ZZZ dropped');
  DBMS_SQL.PARSE(handle,stmt2,DBMS_SQL.V7);
  dbms_output.put_line('Table ZZZ created');
  DBMS_SQL.CLOSE_CURSOR(handle);
  EXCEPTION
    WHEN OTHERS THEN
      DBMS_SQL.CLOSE_CURSOR(handle);
END;
/
show errors



Dr. Raj Sunderraman
7/8/1998