Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Date Problem

by Anonymous Monk
on Apr 26, 2010 at 09:35 UTC ( [id://836867]=note: print w/replies, xml ) Need Help??


in reply to Re: Date Problem
in thread Date Problem

my $SQL = "Select tran_seq_nbr, sale_amount From KCPOS_Tran_Header Where org_number = $ai_div And store_number = $ai_store And tran_number = $al_trans And terminal_number = $ai_reg And tran_Date = $adt_h_date"; my $sth = $dbh->prepare( $SQL ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute() or die "Couldn't execute statement: " . $sth->errstr; ( $ac_seq_nbr, $ac_sale_amount ) = $sth->fetchrow();

This is what i am doing

Replies are listed 'Best First'.
Re^3: Date Problem
by moritz (Cardinal) on Apr 26, 2010 at 10:37 UTC
    The correct way of passing arguments to DB queries is to use placeholders:
    my $SQL = Select tran_seq_nbr, sale_amount From KCPOS_Tran_Header Where org_number = ? And store_number = ? And tran_number = ? And terminal_number =? And tran_Date = ?"; my $sth = $dbh->prepare( $SQL ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute($ai_div, $ai_store, $al_trans, $ai_reg, $adt_h_date ) or die "Couldn't execute statement: " . $sth->errstr;

    That way you can avoid quoting errors which might cause your problem.

Re^3: Date Problem
by nagalenoj (Friar) on Apr 26, 2010 at 12:02 UTC
    I think the problem is because of not quoting the date value($adt_h_date) in the query preparation.

    (Posting this, because the last post was reaped)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://836867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found