Oracle -- "compile all for debug" ?

The below script compiles all packages.

How can I do a "compile all for debug" ?
----------------------------------------------------------
begin FOR cur IN (SELECT OBJECT_NAME, OBJECT_TYPE, owner FROM all_objects WHERE object_type in

('PACKAGE','PACKAGE BODY') and owner = :OBJECT_OWNER ) LOOP
BEGIN
  if cur.OBJECT_TYPE = 'PACKAGE BODY' then
    EXECUTE IMMEDIATE 'alter package "' || cur.owner || '"."' || cur.OBJECT_NAME || '" compile body';
  else
    EXECUTE IMMEDIATE 'alter ' || cur.OBJECT_TYPE || ' "' || cur.owner || '"."' || cur.OBJECT_NAME || '"

compile';
  end if;
EXCEPTION
  WHEN OTHERS THEN NULL;
END;
end loop; end;
finance_teacherAsked:
Who is Participating?
 
sventhanConnect With a Mentor Commented:
Are you using Toad to debug? How do you plan to debug?

If you using toad, its easy to compile all for debug. Just press the Green Bug button and compile the procedures that you need.
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
>>How can I do a "compile all for debug" ?

using that script?  add the word  DEBUG after compile?

http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_2006.htm
0
 
sdstuberConnect With a Mentor Commented:
alter session set plslq_debug=TRUE  (still works, but deprecated)

recommended...

ALTER SESSION SET PLSQL_CCFLAGS = 'DEBUG:TRUE';



then run your script "as is" to compile all
0
 
Amitkumar PConnect With a Mentor Sr. ConsultantCommented:
Add suggested by slightvw, add word DEBUG after word COMPILE.

Refer following block of code. The following block will compile all trigger, procedure, function, package and package body.

begin

FOR cur IN (SELECT OBJECT_NAME, OBJECT_TYPE, owner FROM all_objects WHERE object_type in ('TRIGGER', 'PROCEDURE', 'FUNCTION', 'PACKAGE','PACKAGE BODY') LOOP

BEGIN

  if cur.OBJECT_TYPE = 'PACKAGE BODY' then

    EXECUTE IMMEDIATE 'alter package "' || cur.owner || '"."' || cur.OBJECT_NAME || '" compile debug body';

  else

    EXECUTE IMMEDIATE 'alter ' || cur.OBJECT_TYPE || ' "' || cur.owner || '"."' || cur.OBJECT_NAME || '" compile debug ';

  end if;

EXCEPTION

  WHEN OTHERS THEN NULL;

END;

end loop; end;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.