Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi monks the following is the error that i am getting when running the following script

############################################ # Function: ############################################ #Print deleting line details to file and Continue sub outputdeletedlines { print $JBM " inside outputdeletedlines\n"; my $ai_div = $_[0]; my $ai_store = $_[1]; my $ai_reg = $_[2]; my $al_trans = $_[3]; #my $adt_h_date = $_[4]; my $org_adt_h_date = $_[4]; # print $JBM "-- $adt_h_date --"; my $adt_h_date = "'".$org_adt_h_date."'"; #2010-04-26 14:07:09 my $datetime = localtime(); my $file = $inputfile; my $delete_log = ''; my $ac_seq_nbr; my $ac_sale_amount; #If already has input files, outputs name of current working f +ile #Else puts a default one in the current directory if( $inputfile ) { $delete_log = $file . "_delete_" . $master_job_no . "- +" . $job_number . "\.log"; } else{ $file = 'Default'; $delete_log = $file . "_delete_0-0\.log"; } if( !$Config{delete_dir} ) { $Config{delete_dir} = getcwd(). "/"; } open( my $delete_fh, ">>", $Config{delete_dir} . $delete_log ) or die "Failed to open delete file\n"; my $SQL = "Select tran_seq_nbr, sale_amount From KCPOS_Tran_Header Where org_number = :org_no And store_number = :str_no And tran_number = :tran_no And terminal_number = :term_no And tran_Date = to_date(:tran_dt,'YYYY-MM-DD HH24:MI:SS')"; # And tran_Date = :tran_dt"; print $JBM "preparing delete SQL\n"; my $sth = $dbh->prepare($SQL) or die "Couldn't prepare statement: " . $dbh->errstr; # my $adt_h_date = $dbh->quote('$org_adt_h_date'); print $JBM "-- $adt_h_date --"; print $JBM "prepared SQL\n"; # $sth->execute(q{to_date('$adt_h_date','YYYY-MM-DD HH24:MI:SS +')}) # or die "Couldn't execute statement: " . $sth->errstr; $sth->bind_param(":org_no",$ai_div); $sth->bind_param(":str_no",$ai_store,); $sth->bind_param(":tran_no",$al_trans); $sth->bind_param(":term_no",$ai_reg); $sth->bind_param(":tran_dt",$adt_h_date); $sth->execute() or die "Couldn't execute statement: " . $sth->errstr; ( $ac_seq_nbr, $ac_sale_amount ) = $sth->fetchrow(); $sth->finish(); print $delete_fh "\n Tran_Seq_Nbr: $ac_seq_nbr\t Division: $ai +_div\t Store : $ai_store\t Register: $ai_reg\t Tran: $al_trans\t Date: $adt_h_date\t Sal +e Amt: $ac_sale_amount"; close $delete_fh; return; }

I know its because of $adt_h_date field which has the value like '2007-08-10 00:00:00'

so how should i overcome this error

error is: Placeholder :0 invalid, placeholders must be >= 1 at C:/Perl/lib/DBD/Oracle.pm l ine 273, <$data_fh> line 7.

thanks


In reply to place holder error by Bheema_Tyco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-19 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found