Never mind on the variable substitution question.  I found my problem. 
I wasn't using the q and qq functions properly to make sure the variable
was set up correctly.   I am still curious about the DESCRIBE call,
though.

Thanks!

Dave Tamillow

-------- Original Message --------
Subject: Passing variables in DBD::Oracle
Date: Fri, 06 Apr 2001 08:12:55 -0400
From: Dave Tamillow <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]

Hi,

I'm new to the list and to the DBI in general.   I have "Programming the
PERL DBI" -- I'm about 1/2 way through it.  I've read the documentation
that comes with the DBD::Oracle source, but in both I've yet to find an
answer to something.   In experimenting with the DBI, I can pass a
literal string through $dbh->prepare  (ex:  $sth = $dbh->prepare( q{
SELECT * FROM ALL_TABLES});  )   That works fine.   But, if I assign the
literal string to a variable, ($buf = "SELECT * FROM ALL_TABLES"; and
pass it through the prepare statement ($sth = $dbh->prepare( $buf ); )
it doesn't work.  I turned on debugging to level 5, and what I found was
this line:

            -> prepare for DBD::Oracle::db
(DBI::db=HASH(0x1c666c)~0x1c66d8 ' $buf ')

Why doesn't the variable substitution occur first?  I've tried
variations with and without quotes, and with \$buf.   Nothing seems to
work.

If there's some documentation I haven't found, or if this is addressed
somewhere in the book, please let me know.   I don't mean to spam the
list with newbie questions, but I'm on a deadline to get up to speed on
this.

Thanks for the help and insight.

Dave  Tamillow

P.S.  While I'm at it, one other thing.    How do you issue  a DESCRIBE
statement through the DBI?   I tried $dbh->do(q{ DESCRIBE ALL_TABLES});
and I get the following:

        DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD
ERROR: OCIStmtExecute) at db.pl line 18.

I tried $dbh->prepare, but I get basically the same message.

Reply via email to