Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL CREATE SEQUENCE

PL/SQL CREATE SEQUENCE

From: <newopt_at_my-deja.com>
Date: Fri, 11 Feb 2000 19:14:17 GMT
Message-ID: <881n24$m4l$1@nnrp1.deja.com>


Why does this pl/sql script prompt for the cursor name when I have supplied in the script itself?

SQL> get test3.sql
  1 Declare
  2 cid INTEGER;

  3  -- This procedure is used to create a new sequence used to
  4  -- populate the seq_number column in each NCR table
  5  -- with a unique ascending sequence number starting
  6  -- with 1.

  7 BEGIN
  8 -- Open new cursor and return cursor ID.   9 cid := DBMS_SQL.OPEN_CURSOR;
 10 -- Parse and immediately execute dynamic SQL statement built by  11 -- concatenating the sequence name to DROP & CREATE SEQUENCE commands.
 12 DBMS_SQL.PARSE(cid, 'DROP SEQUENCE ' || 'seq_number_next', dbms_sql.v7);
 13 DBMS_SQL.PARSE(cid, 'CREATE SEQUENCE ' || 'seq_number_next START WITH 1 MINVALUE 1', dbms_sql.v7);
 14 -- Close cursor.
 15 DBMS_SQL.CLOSE_CURSOR(cid);
 16 EXCEPTION
 17 -- If an exception is raised, close cursor before exiting.
 18       WHEN OTHERS THEN
 19          DBMS_SQL.CLOSE_CURSOR(cid);
 20          RAISE;  -- reraise the exception
 21* END;
 22 /
Enter value for create:
old 11: -- concatenating the sequence name to DROP & CREATE SEQUENCE commands.
new 11: -- concatenating the sequence name to DROP SEQUENCE commands.

PL/SQL procedure successfully completed.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Feb 11 2000 - 13:14:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US