المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Executing PL/Sql Anonymous block from ADO



C# Programming
04-01-2009, 01:40 PM
Hi everyone,
My question is simply about how to execute such an anonymous pl/sql block from ado, the below example works fine if pasted in my Oracle Sql*Plus terminal but not from my application, what's more, if I made it simple like just CREATE SEQUENCE MY_SEQUENCE it would work but as you can see, my script is a bit more complicated than that and I dont know how to make ado do it for me like it's being executed directly at the database terminal..

Please advise...

string strSEQ =
@"DECLARE
N NUMBER(10);
BEGIN
SELECT MAX(ID)+1 INTO N FROM MY_TABLE;
-- CREATING SEQUENCE
Execute immediate ('CREATE SEQUENCE SEQ_TEMP
MINVALUE 1
START WITH '||N||'
INCREMENT BY 1
CACHE 20
ORDER');
END;
/
"

OracleCommand cmd = new OracleCommand(String.Empty, _connection);

//CREATING SEQUENCE
cmd.CommandText = strSEQ;
cmd.ExecuteNonQuery();

Internal .Net Framework Data Provider error 30.

All generalizations are wrong, including this one!
(\ /)
(O.o)
(>&lt)