Page 1 of 1

OracleScript inserting extra line endings

Posted: Fri 08 Jan 2010 14:18
by Simon C
When I run the following script in SQL developer:

Code: Select all

create or replace procedure proc1 as
begin
  null;
end;
/
I get the following stored in user_source (with line endings shown):

Code: Select all

create or replace procedure proc1 as\n
begin\n
  null;\n
end;
But if I run the same script using OracleScript (devart dll version 5.35.57.0), I get this stored in the database:

Code: Select all

create or replace procedure proc1 as\n
begin\n
  null;\n
end;\n
How do I get the same behaviour with regards to line endings between sql developer and oraclescript?

Posted: Fri 08 Jan 2010 16:09
by StanislavK
Could you please specify the code you use to set OracleScript up?

The OracleScript class doesn't parse the command text, thus, if you use something like

Code: Select all

oracleScript.ScriptText = @"create or replace procedure proc1 as 
begin 
	  null; 
end;
";
the latter line break will get into the database.

Posted: Fri 08 Jan 2010 16:13
by Simon C
The code I'm using is (in a standalone console app):

Code: Select all

const string scripttext = @"
create or replace procedure proc1 as
begin
  null;
end;
/";

using (var conn = new OracleConnection("Data Source=SC_11GDB1;user=xxxx;Password=xxxx")) {
    OracleScript script = new OracleScript(scripttext, conn);

    conn.Open();
    script.Execute();
}
It may not parse it, but I would expect it to have the same behaviour as sql developer...

Posted: Mon 11 Jan 2010 09:53
by StanislavK
The OracleScript behaviour is quite straight-forward: what you enter in the command text is what you will have in the database. Besides, without parsing, the performance is substantially increased.