This does it if I substitute the 'XXX' values with our access params.

#!/usr/local/bin/perl

use strict;

use DBI;

my $dbh = DBI->connect('DBI:Oracle:XXX', 'XXX', 'XXX', {RaiseError => 1});

$dbh->do("CREATE TABLE foo (col_1 VARCHAR2(10), col_2 NUMBER)");
$dbh->do("INSERT INTO foo VALUES ('foo', 1)");

my $sth =
  $dbh->prepare("CREATE TABLE foo2 AS SELECT * FROM foo WHERE col_2 = ?");

$sth->execute(1);

----
Steve Sapovits
GSI Commerce
Work Email: [EMAIL PROTECTED]
Home Email: [EMAIL PROTECTED]
Work Phone: 610-491-7087
Cell:       610-574-7706
Pager:      877-239-4003

> -----Original Message-----
> From: Joe Raube [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, October 22, 2002 4:19 PM
> To:   Steve Sapovits; [EMAIL PROTECTED]
> Subject:      Re: Oracle placeholders in DDL statements
> 
> Maybe you could post some of your code?
> 
> Are you binding a value to that placeholder?
> 
> -Joe
> 
> --- Steve Sapovits <[EMAIL PROTECTED]> wrote:
> > 
> > I'm using DBI with Oracle 8.1.6.  Does anyone know if you can use
> > placeholders with DDL statments, such as:
> > 
> >   CREATE TABLE FOO AS SELECT * FROM BAR WHERE name = ?
> > 
> > I get an Oracle ORA-01036 error (illegal variable name/number) 
> > which suggests it can't be done.  A DBA here thinks it should only
> > fail on older Oracle versions.  I have not found any definitive
> > answers in the Oracle docs we have or on the web so far.
> > 
> > ----
> > Steve Sapovits
> > GSI Commerce
> > [EMAIL PROTECTED]
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos & More
> http://faith.yahoo.com

Reply via email to