Link to home
Start Free TrialLog in
Avatar of samir25
samir25

asked on

how to know if a table is being used?

hi
i want to know if a table is being referred in my schema ir not. whether in views or any other join table structure.
is it possible?
thanks
Avatar of Sujith
Sujith
Flag of United Kingdom of Great Britain and Northern Ireland image

Use this query.


select * from user_dependencies where referenced_name = upper('<your table name>');
SOLUTION
Avatar of schwertner
schwertner
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samir25
samir25

ASKER

actually i created a table a as below
create table a from (select * from table b)

now in my package and views i am only referring a not b. but when i delete b then m y package doesnt run. i checked in the code and no where i have a...
but when i recreate 'a' then my package runs. when i check in depencies..for 'a' i get no rows selected.
>> m y package doesnt run
Means it throws an error? what is the error?

>>but when i delete b then m y package doesnt run
you mean delete the data in b, or drop table b?

Alternatively you can see all the dependents of your package by this query.

select * from user_dependencies where name = upper('<your package name>');
Avatar of samir25

ASKER

i run the package thru apache server. where it gives standard error which is not helpful.
this package doesnt exist...
as i mentioned doing this
select * from user_dependencies where name = upper('<your package name>');
gives me 0
i meant when i drop table b then package doesnt run. when i re-create this b from a then i can run the package.
>> as i mentioned doing this
>> select * from user_dependencies where name = upper('<your package name>');
>> gives me 0

can you pls take a look at the queries????
The first query I asked to run was
select * from user_dependencies where referenced_name = upper('<your table name>');
and the second one is
select * from user_dependencies where name = upper('<your package name>');

If both of them are returning no rows, then there is something missing in your description.

Why dont you run the package from sqlplus and see if it runs.
Have you read my post above? Answer to the questions.......
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samir25

ASKER

ok.. i missed on package... i will do that.