@@ -597,6 +597,78 @@ def test_3231(self):
597597 "begin null; end;" , 31 , arraydmlrowcounts = True
598598 )
599599
600+ def test_3232 (self ):
601+ "3232 - fetch implicit cursors after closing connection"
602+ conn = test_env .get_connection ()
603+ cursor = conn .cursor ()
604+ cursor .execute (
605+ """
606+ declare
607+ c1 sys_refcursor;
608+ c2 sys_refcursor;
609+ begin
610+ open c1 for
611+ select NullableCol
612+ from TestNumbers;
613+
614+ dbms_sql.return_result(c1);
615+
616+ open c2 for
617+ select NullableCol
618+ from TestNumbers;
619+
620+ dbms_sql.return_result(c2);
621+ end;
622+ """
623+ )
624+ cursor1 , cursor2 = cursor .getimplicitresults ()
625+ conn .close ()
626+ with self .assertRaisesFullCode ("DPY-1001" ):
627+ cursor1 .fetchall ()
628+ with self .assertRaisesFullCode ("DPY-1001" ):
629+ cursor2 .fetchall ()
630+
631+ def test_3233 (self ):
632+ "3233 - fetch implicit cursors after closing parent cursor"
633+ cursor = self .conn .cursor ()
634+ cursor .execute (
635+ """
636+ declare
637+ c1 sys_refcursor;
638+ c2 sys_refcursor;
639+ begin
640+ open c1 for
641+ select NullableCol
642+ from TestNumbers
643+ where IntCol between 3 and 5;
644+
645+ dbms_sql.return_result(c1);
646+
647+ open c2 for
648+ select NullableCol
649+ from TestNumbers
650+ where IntCol between 7 and 10;
651+
652+ dbms_sql.return_result(c2);
653+ end;
654+ """
655+ )
656+ cursor1 , cursor2 = cursor .getimplicitresults ()
657+ cursor .close ()
658+ if self .conn .thin :
659+ self .assertEqual (
660+ [n for n , in cursor1 ], [2924207 , None , 59797108943 ]
661+ )
662+ self .assertEqual (
663+ [n for n , in cursor2 ],
664+ [1222791080775407 , None , 25004854810776297743 , None ],
665+ )
666+ else :
667+ with self .assertRaisesFullCode ("DPI-1039" ):
668+ cursor1 .fetchall ()
669+ with self .assertRaisesFullCode ("DPI-1039" ):
670+ cursor1 .fetchall ()
671+
600672
601673if __name__ == "__main__" :
602674 test_env .run_test_cases ()
0 commit comments