.NET / Oracle: How to execute a script with DDL statements programmatically

后端 未结 3 761
别那么骄傲
别那么骄傲 2020-12-18 01:07

I want to do some programmatical schema manipulation against an oracle database in C#. Therefore, I struggle with some basic issues.

The ddl sql statements are locat

3条回答
  •  不知归路
    2020-12-18 02:01

    As @Steve said, the semicolons are causing your error. And you can't wrap the entire file into a single execute immediate command, since that can only execute one statement at a time. You will need to parse your file and execute each command on its own, removing the semicolon that delinates commands. Your parsing will have to deal with string literals, as you noted, which in addition to containing semicolons may also contain doubled single quotes ('') within the single quotes (') that begin and end the string literal.

提交回复
热议问题