René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Returning into with Perl DBI

create table some_dates (
  when date 
);
use strict;
use warnings;
use DBI;
use DBD::Oracle;

my $when;

my $dbh = DBI->connect("dbi:Oracle:XE", "rene", "rene");
my $sth = $dbh->prepare(
     "insert into some_dates values (sysdate) ".
     "returning to_char(when, 'dd.mm.yyyy hh24:mi:ss') into ?"
);

# 3rd parameter: length
$sth->bind_parfam_inout(1, \$when, 21);

$sth->execute;

print "Assigned when: $when\n";

$sth->finish;