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 HELP NEEDED!!!!

Re: PL/SQL HELP NEEDED!!!!

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 15 Jun 1999 15:34:59 GMT
Message-ID: <3766727c.2467838@newshost.us.oracle.com>


A copy of this was sent to Barney Gumble <duff.drinker_at_cornerpub.FUDD-SUX> (if that email address didn't require changing) On Tue, 15 Jun 1999 10:08:16 +0200, you wrote:

>Thanks for help! It almost work now. Now how do I put sequence value in procedure?
>I need to create to records with the same key value (CustNO) whitch I get from
>CustSeq.
>It works when I put it into SQL (VALUES (CustSeq.NextVal, fname, lname)) but it
>won't work
>like this:
>
>Thomas Kyte wrote:
>
>> >CREATE OR REPLACE
>> >Procedure pMakeCust(fname IN VarChar2, lname IN VarChar2) AS
>> >
>> > -- CustSeq is my sequence for key-generation.

        nCustNO Number;
>> >
>> >BEGIN
>> >

        sleect custSeq.nextval into nCustno from dual;

>> > INSERT INTO
>> > Customers
>> > (CustNO, Firstname, LastName)
>> > VALUES
>> > (nCustNO, fname, lname);
>> >
>> >--Here I'll have to have several another INSERT INTO
>> >-- that will use same nCustNO
>> >

      or simply use custSeq.currval in the inserts here..

>> >END; -- procedure
>
>What's wrong with this?
>
> Thanks again for your time - BG :O)

See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'... Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/

Current article is "Fine Grained Access Control", added June 8'th  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA
--
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Jun 15 1999 - 10:34:59 CDT

Original text of this message

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