Can't locate object method "fetchrow_array" Error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can't locate object method "fetchrow_array" Error
# 1  
Old 05-23-2007
Can't locate object method "fetchrow_array" Error

Hi,
I have a perl script which is interacting with Database.

I have following line of code :
=================================================

sub BEGIN
{
#use Getopt::Std;
#getopt ('S');
#($STEAP)=($opt_S);

use lib ("/home/perl_lib");
use NewSybDBLib;
use Sybase::DBlib;
use IniFileUtil;
use ErrMsgUtil;
use strict;
}

sub main();
main();


print "\nMESSAGE:\n";
$dbh->SetSQLCmd("select * from test ");
@result=$dbh->ExecSQL();
if($dbh->{message_text}) {
print "DB MESSAGE\n";
print $dbh->{message_text} . "\n";
$dbh->{message_text}="";
}
if($dbh->{error_text}) {
$db_error_text=$dbh->{error_text};
$dbh->Delete;
die "ERROR: \n" . $db_error_text . "\n";
}

while (@result = $dbh->fetchrow_array()) {
my $tablename = $result[1];
my $firstrun = $result[2];
my $firstsuccess = $result[3];
print " $tablename $firstrun $firstsuccess \n";
}

The SQL command is getting records from table test .
If i omit my while loop at the end which is using fetchrow_array then script is running perfectly but when i tried to get the records one by one using fetch_row_array() i got the Error :

Can't locate object method "fetchrow_array" via package "NewSybDBLib"

I use the package use Sybase::DBlib but it is not working.

Any idea what might be the solution.

rawat

Last edited by vino; 05-23-2007 at 09:01 AM.. Reason: Disabled smilies
# 2  
Old 06-03-2009
Re: Can't locate object method "fetchrow_array" Error

Hey Rawat,

As far as I know, the fetchrow_array is used with the statement handle ($sth) rather than database handle ($dbh). Try to differentiate $dbh and $sth, and put $sth in the appropriate places.

Let me know if that works out!!

Regards,
Kuks
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

"Locate" Shows Files but Not "LS" in Terminal

OS-X 10.8.4 Using locate I get these results: 10:~ mize$ locate /Users/mize/*.sh /Users/mize/Zend/workspaces/DefaultWorkspace/SLM/vendor/ZF2/bin/check-cs.sh /Users/mize/copy_ascii_upload.sh /Users/mize/copy_ascii_upload_to_server.sh /Users/mize/copy_form_functions_php_to_jpl.sh... (7 Replies)
Discussion started by: Gary Mize
7 Replies

2. Emergency UNIX and Linux Support

Perl error: Can't call method "value" on an undefined value

Hi, I am running a perl script to automate a process and I keep running into a error can't find the "value" Can't call method "value" on an undefined value at process_file.pl line 44. file is CVS cell is ifdfdxrfmp.ksh Here is the script I have also attached it as well: ... (2 Replies)
Discussion started by: vpundit
2 Replies

3. Solaris

svc:/network/physical:default: Method "/lib/svc/method/net-physical" failed with exit status 96. [ n

After a memory upgrade all network interfaces are misconfigued. How do i resolve this issue. Below are some out puts.thanks. ifconfig: plumb: SIOCLIFADDIF: eg000g0:2: no such interface # ifconfig eg1000g0:2 plumb ifconfig: plumb: SIOCLIFADDIF: eg1000g0:2: no such interface # ifconfig... (2 Replies)
Discussion started by: andersonedouard
2 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Solaris

Locate NFS "not responding still trying" application on client

At times I have unknown applications that hang for long periods of time over and over again after a network glitch. These are sometimes nfs4 but usually nfs3 clients and are always solaris10 systems. nfs: NFS server hostname not responding still trying nfs: NFS server hostname ok nfs: NFS... (1 Reply)
Discussion started by: HPAVC
1 Replies

6. Programming

getting "mi_cmd_var_create: unable to create variable object" error msg

Hi, i am working in C in Fedora Eclipse 3.3.0 with gdb debugger. I am geting segmentation fault with an error message "mi_cmd_var_create: unable to create variable object" on debugging the program. What should I do to solve this problem? rgds, Dona_m (14 Replies)
Discussion started by: dona_m
14 Replies

7. Programming

shared object "undefined symbol: fstat" error

Didn't have this problem in AIX, but ported to Linux with GCC compiler and am now getting a runtime error: tssutil: symbol lookup error: /work/agility/devel/bin/libagam.so: undefined symbol: fstat I'm sure most of you know that fstat is an intrinsic function just like printf, memcpy, etc. When I... (5 Replies)
Discussion started by: marcus121
5 Replies

8. Programming

dbx error ("Executable contains object file compiled on ...")

Hi, We are trying to run dbx on a core file for which we have the original executable and libs, but not the source / object tree. We have recompiled the objects from the original source, but dbx complains that they were compiled at a different time, and refuses to read them: Object file:... (0 Replies)
Discussion started by: Sabari Nath S
0 Replies

9. UNIX for Dummies Questions & Answers

Error : "No data written to object that was write locked"

Hi All, I was able to solve my previous problem (link directory)... but now i have this following problem. I have mounted a disk from other machine using "mount -F nfs" command. When i run a batch which generates some files in that drive.... after a certain number of files i get... (1 Reply)
Discussion started by: nileshkarania
1 Replies
Login or Register to Ask a Question