my ( $query, @args ); if ( $x > 10 ) { $query = 'select Name from Customers where CustID = ?'; @args = ( $custid ); } else { $query = 'select Name from Sales where SalesId = ? and CustID = ?' +; @args = ( $salesid, $custid ); } my $sth = $dbh->prepare( $query ); $sth->execute( @args );
In reply to Re^3: Dynamic SQL
by Anonymous Monk
in thread Dynamic SQL
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |