views:

73

answers:

2

Hi,

Are there any way to decompile or reverse engineer Oracle trigger? Any tools available, any free ones?

Thanks!

+7  A: 

This may be done querying user_triggers or dba_triggers as such:

SELECT trigger_body FROM user_triggers where trigger_name = 'THENAME';

or

SELECT DBMS_METADATA.GET_DDL('TRIGGER','....') FROM DUAL

If the trigger code calls other code that is Wrapped (obsufacted) you will need to unwrap it, see this article or do a google search for "oracle unwrap pl/sql"

You can also use a Oracle managment or development tool to get the trigger source code.

oluies
SELECT DBMS_METADATA.GET_DDL('TRIGGER','....') FROM DUAL is an alternative.
Gary
Triggers cannot be wrapped.
Jeffrey Kemp
Thanks!And to get it from a different user if permissions allow:select trigger_name, status, trigger_body from all_triggers WHERE owner = 'SOMEUSERNAME' ORDER BY trigger_name;
o1e9
And it seems SQLTools may extract trigger body with not problem, just with a double click.Anyway thanks for the tip!
o1e9
Jeffery - triggers can call code that ar wrapped
oluies
+1  A: 

Sql*plus should be able to solve that. You can query the system tables to get the body text.

Chris Kimpton