Hi!
I made an Stored Proc. in oracle 9i, in which i inserted data in a temporary table. The SP got compiled successfully. But when i tried to add that SP in the CR 11.0, through DSN, i got an error msg.
Database Connector Error: 'HY000:[Oracle][ODBC][Ora]ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction
ORA-06512: at "SCOTT.TEST_INSERTDATA1", line 6
ORA-06512: at line 1
If data is not inserted in stored proc, then no error comes while connecting Crystal report to stored proc of oracle.
This problem is specifically for those stored procs, where data is inserted in some table inside stored proc and that is used in CR.
Code of Oracle Stored Proc is as follows.
----------------
create or replace procedure Test_InsertData1(curmain in out CommonCursor_Pkg.abc,arg1 varchar2,arg2 varchar2)
as
lcsqry varchar2(500);
begin
lcsqry:='delete from reptable1';
execute immediate(lcsqry);
for i in 1..10 loop
lcsqry:='insert into reptable1(sfld1,nfld1) values(''aa'','||i||')';
execute immediate(lcsqry);
end loop;
commit;
lcsqry:='select sfld1,nfld1 from reptable1';
open curmain for (lcsqry);
end;
/
--------------------
-- Here CommonCursor_Pkg.abc denotes a ref cursor type named 'abc' declared inside CommonCursor_Pkg package. Code for this is :
create package CommonCursor_Pkg
as
type abc is ref cursor;
end;
/
-------------------
-- 'reptable1' is a global temporary table.
--CR 11.0 is connected to oracle in following manner.
Goto
Database Expert-> create new connection ->ODBC(RDO)
Then selecting the Oracle DSN from the list.
Or
Goto
Database Expert-> Create new Connection-> OLE DB(ADO)
please see how to fix this problem.
Thanks and regards
Vineet kumarThe procedure should have select statement at the end. As you are using using dynamic sql, scope is over if you run that proceudre. Try using global temporary tablesql
No comments:
Post a Comment