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 -> Re: PL/SQL CREATE SEQUENCE

Re: PL/SQL CREATE SEQUENCE

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 11 Feb 2000 20:30:02 +0800
Message-ID: <38A400CA.6CF5@yahoo.com>


newopt_at_my-deja.com wrote:
>
> 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.

Because you have a '&' in your comment.

Either remove it or issue SQL> set define off

HTH
--



Connor McDonald
There are 3,434,679 oracle websites around the world. Now there is one more... http://www.oracledba.co.uk Received on Fri Feb 11 2000 - 06:30:02 CST

Original text of this message

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