Re: Dynamic SQL & DBD::Oracle

  • From: Mladen Gogala <mladen@xxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 17 Feb 2004 12:14:43 -0500

sub tblcnt {
  my $table=shift;
  return qq{ SELECT  count(*) from $table where julian_run_date=:RD};
}


my $sth=$dbh->prepare(tblcnt("EMP"));
$sth->bind_param(":RD",$RUN_DATE);
$sth->execute;
$sth->bind_column(1,$COUNT);
$sth->fetch();
$sth->finish($WITH_PREJUDICE);


On 02/17/2004 11:01:09 AM, "Koivu, Lisa" wrote:
> Hello everyone,=20
> 
> I can understand why this stmt below doesn't work (invalid table
> name).
> Failure happens in the prepare statement.  It also doesn't like
> EXECUTE
> IMMEDIATE.=20
> 
> Can anyone suggest a way around this without hardcoding the table
> name?=20
> 
>     $sql_stmt =3D qq{
>                     FROM    ?
>                     WHERE   julian_Run_date =3D ?
>                   };
> 
> 
> Thank you for any suggestions, comments or website links. =20
> 
> Lisa Koivu
> Data Janitor with No Mop
> Orlando, FL, USA
> 
> 
> 
> "The sender believes that this E-Mail and any attachments were free  
> of
> =
> any virus, worm, Trojan horse, and/or malicious code when sent. This  
> =
> message and its attachments could have been infected during =
> transmission.  By reading the message and opening any attachments,  
> the
> =
> recipient accepts full responsibility for taking proactive and
> remedial =
> action about viruses and other defects. The sender's business entity
> is =
> not liable for any loss or damage arising in any way from this  
> message
> =
> or its attachments."
> 
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at //www.freelists.org/archives/oracle-l/
> FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
> 
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: