Home > Archive > Oracle PERL DBD > June 2005 > [svn:dbd-oracle] rev 501 - dbd-oracle/trunk









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [svn:dbd-oracle] rev 501 - dbd-oracle/trunk
timbo@cvs.perl.org

2005-06-03, 8:27 pm

Author: timbo
Date: Tue Oct 19 09:26:14 2004
New Revision: 501

Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/Oracle.pm
Log:
Added INSERT ... RETURNING ... example prompted by Steven Lembark.


Modified: dbd-oracle/trunk/Changes
====================
====================
====================
==================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Tue Oct 19 09:26:14 2004
@@ -49,6 +49,7 @@
Added $dbh-> reauthenticate($user
,$pass) docs thanks to Andy Hassall.
Added $dbh->& #123;ora_parse_error
_offset} docs thanks to Andy Hassall.
Added gcc example to README.aix thanks to Adrian Terranova.
+ Added INSERT ... RETURNING ... example prompted by Steven Lembark.

Build Changes:
Fixed build32/build64 Makefile.PL bug spotted by Sean Kelly.

Modified: dbd-oracle/trunk/Oracle.pm
====================
====================
====================
==================
--- dbd-oracle/trunk/Oracle.pm (original)
+++ dbd-oracle/trunk/Oracle.pm Tue Oct 19 09:26:14 2004
@@ -1284,7 +1284,7 @@

If true (the default), fetching retreives the contents of the CLOB or
BLOB column in most circumstances. If false, fetching retreives the
-Oracle "LOB Locator" of the CLOB or BLOB value. (OCI8 and later only)
+Oracle "LOB Locator" of the CLOB or BLOB value.

See L</Handling LOBs> for more details.
See also the LOB tests in 05dbi.t of Oracle::OCI for examples
@@ -1294,7 +1294,6 @@

If 1 (default), force SELECT statements to be described in prepare().
If 0, allow SELECT statements to defer describe until execute().
-(OCI8 and later only.)

See L</Prepare postponed till execute> for more information.

@@ -2069,7 +2068,7 @@

=head1 Prepare postponed till execute

-With OCI8, the DBD::Oracle module can avoid an explicit 'describe' operation
+The DBD::Oracle module can avoid an explicit 'describe' operation
prior to the execution of the statement unless the application requests
information about the results (such as $sth->{NAME}). This reduces
communication with the server and increases performance (reducing the
@@ -2440,6 +2439,23 @@
See the C<curref.pl> script in the Oracle.ex directory in the DBD::Oracle
source distribution for a complete working example.

+=head1 Returning A Value from an INSERT
+
+Oracle supports an extended SQL insert syntax which will return one
+or more of the values inserted. This can be particularly useful for
+single-pass insertion of values with re-used sequence values
+(avoiding a separate "select seq.nextval from dual" step).
+
+ $sth = $dbh->prepare(qq{
+ INSERT INTO foo (id, bar)
+ VALUES (foo_id_seq.nextval, :bar)
+ RETURNING id INTO :id
+ });
+ $sth->bind_param(":bar", 42);
+ $sth->bind_param_inout(":id", \my $new_id, 99);
+ $sth->execute;
+ print "The id of the new record is $new_id\n";
+
=head1 Returning A Recordset

DBD::Oracle does not currently support binding a PL/SQL table (aka array)
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com