Check that the connect on sth actually worked.  Then verify that the sql statement is 
correct.  Try running it in sqlplus.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 8:35 AM
To: [EMAIL PROTECTED]
Subject: DBI "Prepare" Statement Not Working


I am brand new to coding with DBI and am trying to set up a simple
prepare/execute/fetch routine.  I'm receiving the following error on my
prepare statement line:       "Can't call method "prepare" on an undefined
value at ./test.cgi line 51."

Here's is my sub:

sub db_statement
{
my $sth = $dbh->prepare("select rollup_code, rollup_value, french_flag
                         from  FMC_REPORT_CREATE_PARAMS
                         where  aggr_rpt_id = 2
                         order by report_seq_num");
$sth->execute;

while ( @row = $sth->fetchrow_array ) {
         print "@row\n";
       }
}

Can anyone tell me what I'm doing wrong with the prepare statment?  Thanks!
Deb Vredeveld

Reply via email to