1834385 Members
1960 Online
110066 Solutions
New Discussion

Perl + mysql

 
network_4
Advisor

Perl + mysql

#!/usr/bin/perl
use DBI;
#use DBD::mysql;
$dsn = "DBI:mysql:hcl:localhost";
$dbh = DBI->connect($dsn,'root','',{RaiseError=>1});
$sth = $dbh->prepare("select CHCL_FILE_NAME from CAMS_HCL_COLLECTION_LOG where CHCL_FILE_STATUS='C' and CHCL_COLLECTION_STATUS='S' and (CHCL_FILE_NAME like '%.doc%' or CHCL_FILE_NAME like '%.xls%')");
$sth->execute();
while (@data = $sth->fetchrow_array()) {
foreach $data (@data) {
print "update CAMS_HCL_COLLECTION_LOG set CHCL_FILE_STATUS='D' where CHCL_FILE_NAME='$data' \n";
$sth1 = $dbh-prepare("update CAMS_HCL_COLLECTION_LOG set CHCL_FILE_STATUS='D' where CHCL_FILE_NAME='$data'");
$sth1->execute();
}
}
$sth->finish();


while executing above script i am getting this error:

update CAMS_HCL_COLLECTION_LOG set CHCL_FILE_STATUS='D' where CHCL_FILE_NAME='GUJ_RAT_ggg_asdshh.xls'
Undefined subroutine &main::prepare called at db.pl line 11.


please let me know where is the issue. I am using perl 5.8.7, OS-- Ubuntu
1 REPLY 1
network_4
Advisor

Re: Perl + mysql

Issue closed.. reason for error was that by mistake i forget to put-> in prepare. Anyway thanks