Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Referencing TRIGGER_BODY text from DBA_TRIGGERS

771626Jun 16 2010 — edited Jun 16 2010
Running 11.2.0.1.0

In PL/SQL I want to select data from DBA_TRIGGERS dependent on the contents of the TRIGGER_BODY.
i.e.

select * from dba_triggers where trigger_body like '%XXX%'

Executing the above gets:

SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG

trigger_body is defined as a long.

If I just execute "SELECT * from DBA_TRIGGERS" I can see the trigger_body data as text.

I have tried the below but they all fail with data type errors:
select utl_raw.cast_to_varchar2(trigger_body, 1, 10) from DBA_TRIGGERS
select utl_raw.cast_to_varchar2(dbms_lob.substr( trigger_body, 32000, 1 )) from DBA_TRIGGERS

Is what I want to do possible?

thanks for any help on this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2010
Added on Jun 16 2010
6 comments
3,412 views