Tim Harsch wrote: > The following code snip demonstrates a problem I'm having > > $self->{hDB}->do( <<SQL ); > SELECT slides_data_sq.nextval FROM Dual > SQL > $self->{hDB}->do( <<SQL ); > SELECT slides_data_sq.currval FROM Dual > SQL > > DBD::Oracle::db do failed: ORA-08002: sequence SLIDES_DATA_SQ.CURRVAL > is not yet defined in this session (DBD ERROR: OCIStmtExecute) [for > statement `` SELECT slides_data_sq.currval FROM Dual > '']) at SlideOverall.pm line 1500. > > You can see I do the steps back to back, why would the second command > fail? > > PS Autocommit is off...
$dbh->do doesn't fetch. Without a fetch the sequence isn't accessed. http://theoryx5.uwinnipeg.ca/CPAN/data/DBI/DBI.html#do #!perl -w use strict; use warnings; use DBI; my $dbh = DBI->connect('dbi:Oracle:dev92lnx', 'test', 'test', { AutoCommit => 0, RaiseError => 1, PrintError => 0, }) or die DBI::errstr; my $seqval = $dbh->selectrow_array('SELECT slides_data_sq.nextval FROM dual'); my $currval = $dbh->selectrow_array('SELECT slides_data_sq.currval FROM dual'); print "seqval: $seqval\n"; print "currval: $currval\n"; $dbh->disconnect; __END__ [EMAIL PROTECTED] /cygdrive/d/temp $ perl test.pl seqval: 2 currval: 2 -- Andy Hassall ([EMAIL PROTECTED]) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)