Home » SQL & PL/SQL » SQL & PL/SQL » Check for Existance of Objects
Check for Existance of Objects [message #194338] Thu, 21 September 2006 10:10 Go to next message
yerics
Messages: 89
Registered: August 2006
Member
In a procedure, how to check for existance of set of tables before proceeding ahead. For eg

for j in <select....>
loop
<< check for table based on above select clause>>
if present then
<< do further processing
else
<< generate some messages>>
rollback
end loop
-----------------
What I want to do is

for j in < select ...>
loop
<<check for all all objects>>
end loop;
for k in < select ..>>
loop
<< do further processing>>
end loop.

I dont know whether such approach is ok because the selcet statement is repeated twice for 2 loops.

Re: Check for Existance of Objects [message #194340 is a reply to message #194338] Thu, 21 September 2006 10:20 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
IMO, not an approach I would take, but if you insist query user|all|dba_objects
Re: Check for Existance of Objects [message #194344 is a reply to message #194340] Thu, 21 September 2006 10:29 Go to previous message
yerics
Messages: 89
Registered: August 2006
Member
Yes, I query user_Tables to find out if objects exists or not. The select query gives the value on which I check the object name.
But procedurally what logic should I use so that it checks everything first and then only moves ahead.

Previous Topic: executing a stored procedure from batch file
Next Topic: Trigger and event code.
Goto Forum:
  


Current Time: Sat Dec 10 18:39:59 CST 2016

Total time taken to generate the page: 0.09914 seconds