On Mon, Sep 15, 2003 at 02:45:38PM -0700, 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?
I believe this fails because you are using do() to execute select
statements. You never fetch the actual sequence number from the first
call.
perldoc DBI:
do
[...]
This method is typically most useful for non-SELECT
statements that either cannot be prepared in advance
(due to a limitation of the driver) or do not need to
be executed repeatedly. It should not be used for
SELECT statements because it does not return a
statement handle (so you can't fetch any data).
Ronald