You said ...

I'm trying to add a new record (new values) into one table and I have a
second table that refers to the record number of the first table.

I can get the SQL statement to grab the current value of the incrementing
record number to work, but I need to translate this to operate in perl (I'm
not used to dealing with multiple SQL statements in perl - usually just a
select or an insert)

INSERT INTO notes (fields)
VALUES (new stuff);
$variable = SELECT CURRVAL('name-of-sequence-for-notes_id')
INSERT INTO palm_memos (notes_id, other fields)
VALUES ($variable, other fields);


Could someone post how to do this please?

Is there a better way to accomplish the objective?  I'm a little nervous
that in a multi-user system the database may slip in another INSERT
statement from another user prior to this routine getting the current value
of the incrementing record number and thereby throwing off the returned
value

------
Oracle's CURRVAL is session specific, so you won't have to worry about "getting
the current value of the incrementing record number and thereby throwing off
the returned value."  Oracle protects you from yourself.  If you would like
proof, open two sessions of sqlplus, in session 1 select nextval then select
currval from your sequence, in session 2 select nextval from your sequence and
notice that it increments the value, then go back to session 1 and select
currval again.  You will find that the currval in session 1 does not increment.
 

If you are using the DBI and DBD::Oracle modules I can probably help you out
some more there, but I don't want to make too many more assumptions than I
already have.

Hope I have helped,


=====


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to