--- "Gaul, Ken" <[EMAIL PROTECTED]> wrote:
> Depending on your Oracle version DDL is supported by using
> being
> EXECUTE IMMEDIATE some_string_containing_a_ddl_statement;
> end;
>
> Whether this works through DBI I've never tried :)
Yes, it works fine (8+). So does the earlier so-called
"dynamic sql" solution, the dbms_sql package.
I admit I didn't mention this to avoid further confusing the
issue. I think to understand when, where, and why "dynamic sql"
is the right solution to a problem, one must first have the
foundational understanding of the differences between plsql
and sql, between DML and DDL (and why they are treated
differently, which I didn't go into), etc, etc, which the
original poster obviously does not yet have.
But as long as we're on the subject, I would say that
EXECUTE IMMEDIATE makes no sense whatsoever for the poster
(I know you weren't suggesting it does, and this isn't criticism
aimed at your observation).
The fundamental reason EXECUTE IMMEDIATE capability was added
was in order to allow the execution of SQL statements within
the PLSQL language for which the sql statement is not known
beforehand (at compile time). In short, it was created to
give _PLSQL_ the dynamic flexibility that is inherent in systems
outside of plsql, like DBI. So it adds almost nothing to
the toolset of the DBI user.
In other words, there's no reason to do this:
dbh->do(q{
begin
execute immediate 'create table fubar';
end;
});
when you can do this:
dbh->do(" create table fubar" );
Mark
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com