RE: insert in a stored procedure

RE: insert in a stored procedure

 

  

Pamela is right.

Just a little tune-up.

While using sequence you an directly use inside insert statement like,

BEGIN
INSERT INTO table (col_1)
VALUES (col_1_seq.NEXTVAL);
END;

Mohan.

-----Original Message-----
From: Cameron Pam
[mailto:oracledba-ezmlmshield-x11151180.[Email address protected]
Sent: Friday, November 12, 2004 11:46 AM
To: LazyDBA Discussion
Subject: RE: insert in a stored procedure

Try this:

DECLARE
col_1 NUMBER;
BEGIN
SELECT col_1_seq.NEXTVAL
INTO col_1
FROM dual;
INSERT INTO table (col_1)
VALUES (col_1);
END;


Pamela


-----Original Message-----
From: Martin Jones
[mailto:oracledba-ezmlmshield-x6554247.[Email address protected]
Sent: Thursday, November 11, 2004 11:13 PM
To: LazyDBA Discussion
Subject: insert in a stored procedure

How can I use an insert statment in a stored procedure where I need to
get the next sequential number of one of the columns and add that to the
insert statement? Thank-you, Marty


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com To unsubscribe:
see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com By using this list you agree
to these terms:http://www.lazydba.com/legal.html


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com To unsubscribe:
see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com By using this list you agree
to these terms:http://www.lazydba.com/legal.html


Oracle LazyDBA home page