Page 1 of 1

TOraSQL & NonBlocking

Posted: Thu 19 Jun 2008 13:21
by fire.tiger
Hello Core Lab.

I would have one question. I'm using TOraSQL with NonBlocking property set to true. When I call BreakExec method it works nice, except this pl/sql code:

..when I run this code...then call BreakExec, the Thread is still alive
even if I wait a lot of minutes....

don't you know why? Thank you for any idea.

Best Regards,
FT

Code: Select all

CREATE OR REPLACE FUNCTION source_audit(a_owner in Varchar) RETURN VARCHAR
/*
 Autor: Ivan Sivak
 Popis: Test
*/
IS
  fCnt INTEGER;
  pCnt INTEGER;
  gCnt INTEGER;
  Pom1 INTEGER;
  Pom3 INTEGER;
  pF   INTEGER;
  pP   INTEGER;
  KOM  INTEGER;
  S    Varchar(64);
  A    Varchar(128);
  CRLF Varchar(2) := CHR(13)||CHR(10);
  TAB  Varchar(4) := CHR(9);
  MEZ  Varchar(1) := CHR(32);
  CURSOR src_pf_names(saTyp in Varchar) IS 
  	  		select distinct(NAME) from all_source 
			where ((owner = a_owner)
				    and
				   (Upper(TYPE)=Upper(saTyp)) );
  CURSOR src_p_name IS
  		 	select distinct(NAME) from all_source
			where ((owner = a_owner)
				    and
				   (TYPE = 'PACKAGE') ); 	
  CURSOR src_pb(p_name in Varchar) IS
  		 	select TEXT from all_source where ( (owner = a_owner) and
						    	 	            (TYPE = 'PACKAGE') and
											    (NAME = p_name)
										       ) ; 					   				   				   
BEGIN
   dbms_output.enable(20000);
   dbms_output.put_line('--Audit databazovych objektu--');
   /* -- */
   pCnt := 0;
   fCnt := 0;
   gCnt := 0;
   For I in src_pf_names('procedure') loop
     S := Lower(Trim(I.NAME));
	 pCnt := pCnt + 1;
   end loop;
   For I in src_pf_names('function') loop
     S := Lower(Trim(I.NAME));
	 fCnt := fCnt + 1;
   end loop;
   For I in src_p_name loop
   	 gCnt := gCnt + 1;  
   end loop;
   dbms_output.put_line('Vysledek:');
   dbms_output.put_line('----------');
   dbms_output.put_line('Pocet procedur: '||pCnt);
   dbms_output.put_line('Pocet funkci: '||fCnt); 
   dbms_output.put_line('Pocet packages: '||gCnt);
   dbms_output.put_line(TAB||'Jmena packages');
   For I in src_p_name loop
   	 S := Upper(Trim(I.NAME));
	 
	 pF := 0;
	 pP := 0;
	 For J in src_pb(S) loop
	 	A := Upper(J.TEXT);
		KOM := INSTR(A, '--');
		if KOM  0 then
			  pF := pF + 1;
    	   end if;  
		   if Pom3 > 0 then
		      pP := pP + 1;   		
		   end if; 	
		end if; 
	 end loop;
	 dbms_output.put_line(TAB || S || ' - ' || 'Obsahuje '||pF||' funkce a '||pP||' procedury' );
   end loop;
EXCEPTION
     WHEN OTHERS THEN
       RAISE;
END source_audit;
/

......

Posted: Fri 20 Jun 2008 06:52
by fire.tiger
....I would like to mention - that I have tried to debug this proc in TOAD 8.6, and TOAD has the same problem...whole application freeze and I have to kill it from process manager. I mention this because when TOAD debugs this
it runs in a Thread. and when I try to stop Debuging (so Toad exits its thread)
it gets freeze...
probably have the same problem....

Posted: Fri 20 Jun 2008 08:00
by Challenger
Then it seems that this is a problem of Oracle.

Posted: Tue 24 Jun 2008 16:01
by jfudickar
The problem is, there is no way to break a pl/sql code via sql*net or direct mode.

Oracle doesn't support this.

This could also happen if you have a select statement which takes long to find the first record. This works mostly, but not allways.

The only way to handle something like this is to kill the session.

Greetings
Jens