Solved

check if column is created by trigger

Posted on 2012-04-11
5
397 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
5 Comments
 
LVL 76

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 34

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 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now