Hello Tomasz,
It seems DDL(Data Definition Language) is not allowed in PL/SQL block, in
Oracle world.
I tried the following PL/SQL command on Oracle database.
begin
drop table t1;
drop table t2;
end;
ORA-06550: line 2, column 1;
PLS-00103: Encountered the symbol "DROP" when expecting one of the
following:
Begin case delare exit for goto if loop mod null pragma raise return select
update while with <an identifier> <a double-quoted delimited-identifier> <a
bind variable> << close current delete fetch lock insert open rollback
savepoint set sql execute commit for all merge pipe.
Then, I downloaded ODP.Net (Oracle Data Provider for .Net) and tried. I
received the same error message.
At last, I searched this issue on internet, found the following document.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_dynamic
_sql.htm#BJEHDACE
============================================================================
==============
Executing DDL and SCL Statements in PL/SQL
Only dynamic SQL can execute the following types of statements within
PL/SQL program units:
" Data definition language (DDL) statements such as CREATE, DROP, GRANT,
and REVOKE
" Session control language (SCL) statements such as ALTER SESSION and SET
ROLE
" The TABLE clause in the SELECT statement
============================================================================
==============
Please try the following code and it works on my side. Hope this help.
ocd.CommandText = @"begin EXECUTE IMMEDIATE 'drop table t1';EXECUTE
IMMEDIATE 'drop table t2';end;";
Please let me know if you have any more concern. I'm glad to assist you.
Have a great day.
Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.