I am m using the following code to read from a .txt file.  I am running into
a problem that I am not sure why it is happening.
The problem is when I run this script the SQL is not reading the variable.
I am testing to make sure the .txt file contains data and it does.

I get the following error:
DBD::Oracle::st execute failed: called with 1 bind variables when 0 are
needed at /data/verity/custom-kb/scripts/test.pl line 36, <BULK> line 1.
DBD::Oracle::st execute failed: called with 1 bind variables when 0 are
needed at /data/verity/custom-kb/scripts/test.pl line 36, <BULK> line 1.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect(), <BULK> line 1.

LINE 36 where the error is occuring:  sr_num = $ln");

In the past when reading form an array fbuilt by a SQL statement I do it
different. This is my first tiem trying to read form Files

Any Ideas what I am doing wrong?

Thank you in advance
Lance

#!/usr/local/bin/perl
#
# Purpose:      To extract Daily Siebel (SecureTrak) cases
#
# Written by Lance

#ENVIRONMENT VARIABLES
$CUSTOM                 = "/data/verity/custom-kb";
$SERVICE                = "XXXXX.world";
$oracle_user            = "XXXXXX";
$oracle_password        = "XXXXX";
$html_file_path         = "$CUSTOM/content/daily_securetrak_new";
$bif_file_path          = "$CUSTOM/content/daily_securetrak";
$bulk_load_filename     = "$CUSTOM/bif/daily_securetrak.bif";
$template_filename      =
"$CUSTOM/templates/daily_securetrak_main_build_template.html";
$template_comm_filename =
"$CUSTOM/templates/daily_securetrak_comm_build_template.html";
$daily_sr_file          = "$CUSTOM/scripts/unique_sr_list.txt";

print "Extract started at: " . `date`;


#open connection to the DB
use DBI;
$connect_string="DBI:Oracle:$SERVICE";
my $dbh = DBI->connect($connect_string,$oracle_user,$oracle_password,
        { AutoCommit=> 0,  LongTruncOk=> TRUE, PrintError => 1, ChopBlanks=>
TRUE,LongTruncOk=> TRUE,LongReadLen=> 50000, RaiseError => 1 }) or die
"connecting: $DBI::errstr";

#open file to read from
open(BULK, $daily_sr_file) || die("Could not open file!");
 my $line = 1;
 while( my $ln = <BULK> )
 {
        chomp($ln);
#use the items of the
my $get_case_text = $dbh->prepare("SELECT a.sr_num ,b.name ,b.loc
,a.sr_title,f.mid_name ,a.sr_stat_id ,e.name ,f.fst_name ,f.last_name
,f.email_addr ,g.country,g.Province
,g.zipcode,to_char(a.x_cp_created,'DD-MON-YYYY')
,to_char(a.x_cp_closed,'DD-MON-YYYY') ,c.login ,a.desc_text FROM s_srv_req
a,s_org_ext b,s_employee c,s_postn d,s_org_int e,s_contact f,s_addr_org g
WHERE a.cst_ou_id = b.row_id and a.cst_con_id = f.row_id and a.owner_emp_id
= c.row_id and c.pr_postn_id = d.row_id and d.ou_id = e.row_id and
b.pr_addr_id = g.row_id and sr_num = $ln");
        $get_case_text->execute($sr_num) || $dbh->errstr;
 ($sr_num ,$account_name ,$loc ,$sr_title , $uc_id ,$sr_stat_id ,$group_name
,$fst_name ,$last_name ,$email_addr ,$country,$Province
,$zipcode,$x_cp_created ,$x_cp_closed ,$login ,$desc_text) =
$get_case_text->fetchrow_array();
        $get_case_text->finish;
print "--------------> SR(bulk): $sr_num\n";
print "--------------> User Id(name): $uc_id\n";
        $line++;
 }
close(DAT);
$dbh->disconnect;




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to