Laurie Vien wrote:

I just wrote a few lines of Perl to try to access an Oracle database via
Win32::ODBC. Running this code results in the error "Can't call method
"Sql" on an undefined value at line 6". Line 6 is the line containing the
SELECT statement.


Usually the error message means connection fails. Can you add a 'or die "...." to your connection string to check it?

Best

Bao

Here's the code--what's the problem?:

#testchunk.pl
use Win32::ODBC;

$db = new Win32::ODBC("MP2", "LAURIEV", "MYPSWD");

$db->Sql("SELECT itemnum,description FROM INVY where itemnum like '1%'");
while($db->FetchRow())
{
        ($the_item_num, $its_descrip) = $db->Data();
        print "$the_item_num: $its_descrip\n";
}
$sql->Close();

Laurie A. Vien
Sr. Programmer/Analyst
Ben & Jerry's Homemade, Inc.






Reply via email to