I am using the OracleScript component and trying to run the following sql:
"set role all"
But this does not work and does not appear in the OracleMonitor (it does not even fires an exception or an error). I have managed to make it work by setting the sql to:
"begin
set role all;
end;"
I think this is not ok, because from sqlplus (also TOAD), the fisrt script runs smoothly.
Oracle Script Bug?
Re: Oracle Script Bug?
Hi, a im trying to execute the following SQL command by setting the ScriptText property in my OracleScript, I know my SQL command is wrong, but when i execute the script nothing happens, it seems like everything was fine, however the real error is "Error: PLS-00103: Encountered the symbol "6550" when i use other IDE, also the
oraclescript does not even fires an exception or oracleScript1_Error(object sender, CoreLab.Common.ScriptErrorEventArgs e)
the following is the code :
try
{
this.oracleScript1.ScriptText = "CREATE OR REPLACE PROCEDURE Dept_Insert (\n" +
"PDeptNo NUMBER,\n" +
"PDName VARCHAR, \n" +
"PLoc VARCHAR )\n" +
"IS \n" +
"BEGIN\n" +
"\n" +
" INSERT INTO Dept(DeptNo, DName, Loc) VALUES (PDeptNo, PDName, PLoc);\n" +
"END;\n" +
" \n" +
"\n" +
"6550\n" +
" \n" +
" \n" +
"CREATE TABLE DEPT (\n" +
" DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,\n" +
" DNAME VARCHAR2(14) ,\n" +
" LOC VARCHAR2(13)\n" +
");\n" +
" \n" +
"INSERT INTO EMP VALUES\n" +
"(7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10);\n";
this.oracleScript1.Execute();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
oraclescript does not even fires an exception or oracleScript1_Error(object sender, CoreLab.Common.ScriptErrorEventArgs e)
the following is the code :
try
{
this.oracleScript1.ScriptText = "CREATE OR REPLACE PROCEDURE Dept_Insert (\n" +
"PDeptNo NUMBER,\n" +
"PDName VARCHAR, \n" +
"PLoc VARCHAR )\n" +
"IS \n" +
"BEGIN\n" +
"\n" +
" INSERT INTO Dept(DeptNo, DName, Loc) VALUES (PDeptNo, PDName, PLoc);\n" +
"END;\n" +
" \n" +
"\n" +
"6550\n" +
" \n" +
" \n" +
"CREATE TABLE DEPT (\n" +
" DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,\n" +
" DNAME VARCHAR2(14) ,\n" +
" LOC VARCHAR2(13)\n" +
");\n" +
" \n" +
"INSERT INTO EMP VALUES\n" +
"(7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10);\n";
this.oracleScript1.Execute();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
-
Pinturiccio
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Oracle Script Bug?
We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.
As a temporary workaround, try using the InfoMessage event of the OracleConnection object. For this, you should change your code as follows:
As a temporary workaround, try using the InfoMessage event of the OracleConnection object. For this, you should change your code as follows:
Code: Select all
try
{
this.oracleScript1.Connection.InfoMessage +=new OracleInfoMessageEventHandler(conn_InfoMessage);
this.oracleScript1.ScriptText = "CREATE OR REPLACE PROCEDURE Dept_Insert (\n" +
"PDeptNo NUMBER,\n" +
"PDName VARCHAR, \n" +
"PLoc VARCHAR )\n" +
"IS \n" +
"BEGIN\n" +
"\n" +
" INSERT INTO Dept(DeptNo, DName, Loc) VALUES (PDeptNo, PDName, PLoc);\n" +
"END;\n" +
" \n" +
"\n" +
"6550\n" +
" \n" +
" \n" +
"CREATE TABLE DEPT (\n" +
" DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,\n" +
" DNAME VARCHAR2(14) ,\n" +
" LOC VARCHAR2(13)\n" +
");\n" +
" \n" +
"INSERT INTO EMP VALUES\n" +
"(7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10);\n";
this.oracleScript1.Execute();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
...
static void conn_InfoMessage(object sender, OracleInfoMessageEventArgs e)
{
foreach (OracleError error in e.Errors)
MessageBox.Show(error.Message);
}
-
Pinturiccio
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Oracle Script Bug?
We think that this is a designed behavior. To get an error message inside the script text, use the InfoMessage event of the OracleConnection object.