بتاريخ: 21 سبتمبر 201411 سنة comment_255089 السلام عليكم how can i overcome Invalid cursor exception-------------------------------------------------------- I created a package as below : CREATE OR REPLACE package SCOTT.refcur_pck is type ref_cur is ref cursor ; procedure pop_data(p_cur in out ref_cur,p_stmt varchar2) ; end ; / CREATE OR REPLACE package body SCOTT.refcur_pck is procedure pop_data(p_cur in out ref_cur,p_stmt varchar2) is begin open p_cur for p_stmt ; end ; end; / --------------------------------------------------------------------------------------- And when I use it in database it works (I have tried the following code on Toad) declare v_empno emp.empno%type; type v_ref is ref cursor ; v_cur v_ref ; begin refcur_pck.pop_data(v_cur,'select empno from emp'); loop fetch v_cur into v_empno; exit when v_cur%notfound ; dbms_output.put_line(v_empno); end loop; close v_cur; end; ------------------------------------------------------------------------------------- But the problem is when I use the same code in forms (6i) like this declare v_empno emp.empno%type; type v_ref is ref cursor ; v_cur v_ref ; begin refcur_pck.pop_data(v_cur,'select empno from emp'); loop fetch v_cur into v_empno; exit when v_cur%notfound ; message(v_empno); end loop; close v_cur; end; The exception ORA-01001 (Invalid cursor) raised ... I spent 2 days to solve this but with no goodany helps will be appreciated .. ThanksMohamed Ali تم تعديل 21 سبتمبر 201411 سنة بواسطة Ahmad.Hasan تقديم بلاغ
بتاريخ: 21 سبتمبر 201411 سنة comment_255093 السلام عليكم جرب هذا الكود: DECLARE v_empno emp.empno%TYPE; TYPE v_ref IS REF CURSOR; v_cur v_ref; BEGIN refcur_pck.pop_data (v_cur, 'select empno from emp'); LOOP FETCH v_cur INTO v_empno; MESSAGE (v_empno); MESSAGE (' '); EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE'; NEXT_RECORD; END LOOP; CLOSE v_cur; END; تقديم بلاغ
بتاريخ: 21 سبتمبر 201411 سنة comment_255113 السلام عليكم how can i overcome Invalid cursor exception -------------------------------------------------------- I created a package as below : CREATE OR REPLACE package SCOTT.refcur_pck is type ref_cur is ref cursor ; procedure pop_data(p_cur in out ref_cur,p_stmt varchar2) ; end ; / CREATE OR REPLACE package body SCOTT.refcur_pck is procedure pop_data(p_cur in out ref_cur,p_stmt varchar2) is begin open p_cur for p_stmt ; end ; end; / --------------------------------------------------------------------------------------- And when I use it in database it works (I have tried the following code on Toad) declare v_empno emp.empno%type; type v_ref is ref cursor ; v_cur v_ref ; begin refcur_pck.pop_data(v_cur,'select empno from emp'); loop fetch v_cur into v_empno; exit when v_cur%notfound ; dbms_output.put_line(v_empno); end loop; close v_cur; end; ------------------------------------------------------------------------------------- But the problem is when I use the same code in forms (6i) like this declare v_empno emp.empno%type; type v_ref is ref cursor ; v_cur v_ref ; begin refcur_pck.pop_data(v_cur,'select empno from emp'); loop fetch v_cur into v_empno; exit when v_cur%notfound ; message(v_empno); end loop; close v_cur; end; The exception ORA-01001 (Invalid cursor) raised ... I spent 2 days to solve this but with no good any helps will be appreciated .. Thanks Mohamed Ali http://www.techonthenet.com/oracle/errors/ora01001.php تقديم بلاغ
بتاريخ: 21 سبتمبر 201411 سنة كاتب الموضوع comment_255116 http://www.techonthe...rs/ora01001.php Option #3 If everything else is fine, you may need to increase the AREASIZE and MAXOPENCURSORS options. ---- what AREASIZE and MAXOPENCURSORS options stands for? And how can I achieve this? تقديم بلاغ
بتاريخ: 25 سبتمبر 201411 سنة comment_255224 up يا هندسة اتعود تبحث قبل ما تسأل , كان زمانك وصلت علعموم الـ max open cursors دي باينة من اسمها , في عدد معين للكرسورز المفتوحة وهو حوالي 50 , عشان كده المفروض لما تفتح كرسور , تقفله في اخر الكود تاني . التانية بقى , ممكن تبحث في جوجل oracle increase area size وربنا هيفرجها ان شاء الله تقديم بلاغ
بتاريخ: 25 سبتمبر 201411 سنة comment_255231 هو اللى انا شايفه ان حضرتك بتخرج قبل ما تقفل ال cursor ويمكن دا بيعمل مشكله فممكن نقول if v_cur%notfound then end loop; close cursor; end if;فهنا كل مره هيعمل check الى ان يصل الى انه مش بيرجع بيانات هيقفل ال cursor ويخرج تقديم بلاغ
بتاريخ: 5 أكتوبر 201411 سنة كاتب الموضوع comment_255480 السلام عليكم أنا آسف علي التأخير في الرد .. بس في مشكلة في النت عندي مهندس eslam elbyaly شكرا علي ردك بس علي فكرة أنا متعود أن أبحث قبل ما أسأل (مين قال لحضرتك إني لم أبحث) سؤالي دا بعد البحث وعدم الحصول علي نتائج .. يا ريت حضرتك لو تتكرم وتبحث علشان أنا بحثت ولم أجد نتائج وجربت كذا حاجه ومنفعتش ..... شكرا مهندس ahmed_elmoslmany علي اقتراح حضرتك وهجرب وأرد عليك تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.