Solved

check if column is created by trigger

Posted on 2012-04-11
5
402 Views
Last Modified: 2012-04-12
hi

i want to know if the prod_id column in my Product table is being generated by a trigger.

I am using this sql but no luck. Any clue what i am doing wrong?



SELECT * FROM all_dependencies WHERE  referenced_name = 'PRODUCT.PROD_ID' AND type IN ('PACKAGE BODY', 'PROCEDURE', 'FUNCTION', 'TYPE','TRIGGERS');
0
Comment
Question by:royjayd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 255 total points
ID: 37837115
I don't think you can get the 'column' but you can at least find the trigger then look at the trigger code:

SELECT * FROM all_dependencies WHERE  referenced_name = 'PRODUCT' AND type IN ('TRIGGER');
0
 
LVL 35

Assisted Solution

by:Mark Geerlings
Mark Geerlings earned 20 total points
ID: 37837254
The all_dependencies view in Oracle does not track dependencies down to the column level, just to the table level.  So, you need to use a query more like what slightwv suggested, then review the PL\SQL code for the objects that query returns to see if they include references to the column you are interested in.
0
 

Author Comment

by:royjayd
ID: 37837478
>>SELECT * FROM all_dependencies WHERE  referenced_name = 'PRODUCT' AND type IN ('TRIGGER');


ok.

I assume i can use the same query
SELECT * FROM all_dependencies WHERE  referenced_name = 'PRODUCT' AND type IN ('PACKAGE BODY', 'PROCEDURE', 'FUNCTION', 'TYPE','TRIGGERS');

which will give me references in triggers and other places.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37837489
There is no 'TRIGGERS', change it to 'TRIGGER'.
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 37838341
Perhaps instead of looking at the actual trigger code, just query: DBA_TRIGGER_COLS...
:p
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Via a live example, show how to take different types of Oracle backups using RMAN.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question