in reply to Re^2: Dynamic SQL
in thread Dynamic SQL
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 );
|
|---|