Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Simple Oracle Script (I think)

Re: Simple Oracle Script (I think)

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 28 Oct 2003 14:15:03 -0800
Message-ID: <1067379323.836882@yasure>


G. Blair wrote:

>Can anyone give help me with the syntax for a script that would loop
>through all_tab_columns looking for tables that have a certain row.
>While doing this, as each table name is provided (through a cursor I
>imagine), I would like to query that table to see if records with a
>certain primary key exist. The result would be a report to the screen
>of the table names and record counts that contain the search criteria
>(the PK I am searching for).
>
>Thanks for the help.
>
>

What you ask, as asked is not possible. Do you perhaps want to find all of the tables that contain
 a specific column? Presuming so a cursor is the worst possible way to do this.

Write a single SQL statement joining all_tab_columns with all_constraints and/or all_cons_columns.

And since this certianly looks like homework ... be sure to post your best attempt before
expecting someone to do it for you.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Oct 28 2003 - 16:15:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US