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 -> INSERT w/ RETURNING clause using DBD::Oracle

INSERT w/ RETURNING clause using DBD::Oracle

From: <paul_at_infone.com>
Date: Fri, 20 Aug 1999 19:42:46 GMT
Message-ID: <7pkb3j$9lh$1@nnrp1.deja.com>

Hello all,

Working environment: DBD::Oracle module for Perl DBI on an Oracle8 server running on a Linux machine.

I am trying to figure out a way to return the row id after an INSERT command.

Ideally, I would like the returned value to be from a self-incrementing ID field we've created (using a sequence/trigger combination). If this cannot be done, then perhaps we could have the internal oracle ROWID returned? from which I'm assuming I could figure out which row and which table?

I was able to get the following to work through SQLPlus:

   variable insID number;
   insert into TEST (NAME) values ('John') RETURNING ID into :insID;    print :insID;

but have had no luck trying to do it through Perl/DBD::Oracle. I have no particular affinity for using bind variables -- any method that you could suggest would be appreciated. I'm hoping there is a simpler and more elegant method that I'm ignorant of. Also, I would require a solution which won't fall apart in a multi-user environment.

Thanks in advance.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri Aug 20 1999 - 14:42:46 CDT

Original text of this message

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