You are fetching off the end of a cursor so you would expect an error on any sql

Would be the same sort of thing as 

 

my @test= (1,2);

print $test[100];

 

If you know your recordset will be small I would use fetchall_arrrayref  or 
fetchall_hashref rather than just fetch.

 

 The normal way is to fetch is in a loop with  'while'.  As there is no way to 
tell how many records will be in 

your set before you do you SQL unless you tell the SQL to return only x rows.

 

Cheers

John

 

> Date: Tue, 4 Feb 2014 13:36:50 -0600
> Subject: Surprising DBD::Oracle error raised
> From: davidni...@gmail.com
> To: dbi-users@perl.org
> 
> $price_sth->execute;
> my ($o_file_price) = $price_sth->fetchrow_array();
> if ($price_sth->fetch) {
> $this->log_error('ERROR: scalar select returned second row at
> %s line %d', __FILE__, __LINE__);
> }
> 
> 
> I expected the fetch to return undef, but it throws an Oracle error.
> My best ignorant guess here is that fetchrow_array does some cleanup
> on one-row datasets, but that isn't documented.
> 
> Advise?
> 
> 
> -- 
> The one L lama, he's a priest
> The two L llama, he's a beast
> And I will bet my silk pyjama
> There isn't any three L lllama. -- Ogden Nash
                                          

Reply via email to