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 :)
YMMV
Ken.
> -----Original Message-----
> From: M Addlework [mailto:[EMAIL PROTECTED]]
> Sent: 11 February 2003 17:24
> To: Dave K; [EMAIL PROTECTED]
> Subject: Re: DBD::Oracle multiple SQL statements - PL/SQL example
>
>
>
> --- Dave K <[EMAIL PROTECTED]> wrote:
> > Mark,
> > > You can _only_ put DML inside a pl/sql block, not DDL.
> > >
> > > So your problem was:
> > >
> > > 1) you tried to put DDL into a pl/sql block (Oracle disallows)
> > > 2) you didn't have a valid block (no begin/end;)
> >
> > Did you try this at all?
> > The 'CREATE OR REPLACE...'
> > ddl works fine. It's not disallowed by Oracle, DBI etc..
>
> I didn't say DDL was disallowed. I said DDL is _not_ allowed
> inside a _plsql block_.
>
> > The issue was multiple statments.
> > Please reread the OP.
>
> The "issue" was why weren't multiple statements working, when
> the documentation said they would?
>
> The answer is that sometimes multiple statements can work,
> and sometimes they can't. I explained the rules before,
> but I'll repeat them here, since if you misunderstood my
> post and the rules, perhaps the original poster still does
> as well:
>
> - multiple DML statements can be executed in a single call
> to Oracle, but they must be wrapped in a plsql block, not
> simply concatenated together.
>
> - plsql blocks have the structure:
>
> begin
> statement ;
> statement ;
> end;
>
> - DDL can never be executed in a plqsl block.
>
>
> The original poster's problem was the he had code like this:
>
> "ddl statement;
> ddl statement;"
>
> which, as you and he know, doesn't work. Now the simple-minded
> response to the problem is just to say that you can't execute
> two statements at once. But recall that the poster wasn't
> only asking about his code -- he specificially asked why his
> problems appeared to contradict the documentation, and he
> was very clear that he tentatively concluded the documentation
> to be incorrect, and he pleaded:
>
> "I would be grateful for any feedback about preparing and
> executing multiple SQL statements using DBD::Oracle"
>
> Hence I provided the complete answer: you can do multiple
> sql statemtents (but only DML and in a plsql block).
>
> Hope that clears up your confusion.
>
> Mark
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>