I'm trying to build a test environment to test an app against oracle and sql server. The aim is to have the same code base for both test scenarios, the only difference should are some SQL/DDL/... statements that are stored in script files. The problem is that oracle's ODP does not support the execution of scripts but only single commands.
I found a workaround, but there is still one issue that I can't get solved:
My Drop script for oracle looks like this:
BEGIN EXECUTE IMMEDIATE 'SELECT ''DROP TABLE '' || table_name || '' CASCADE CONSTRAINTS;'' FROM user_tables'; EXECUTE IMMEDIATE 'SELECT ''DROP SEQUENCE '' || sequence_name || '';'' FROM user_sequences;'; END[;]
The problem is the last semicolon after the END:
While the oracle database complains if I don't provide the semicolon at the end:
ORA-06550: line 1, column 208:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
; <an identifier> <a double-quoted delimited-identifier>
The symbol ";" was substituted for "end-of-file" to continue.)
I get an exception thrown by the oracle ODP .Net command object if I provide the semicolon:
ORA-00911: invalid character
ORA-06512: at line 1
Is there a way to satisfy both, the oracle data base and ODP .Net?