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: help with a global query -- use dynamic SQL

Re: help with a global query -- use dynamic SQL

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Sun, 23 Aug 1998 15:19:52 +0200
Message-ID: <6rp4s2$p55$1@pascal.a2000.nl>

>e.g. I want to see all the occurences of '#' in all the columns in all
>the tables in the database.  Is ther a way to write this w/o having to
>hardcode each table and column in the DB?

Sure, using dynamic SQL. As this implies using PL/SQL, the only way to send the table names to the output is using dbms_output. This can give you problems if too much output is generated. The following script originally checked for Y2k problems, and I have deleted some parts. It has not been tested. Table name, column name and result are stored in a table column_checks for later reference:

Success,
Arjan.

select table_name, column_name, check_result from column_checks
where check_result = 'None';

select table_name, column_name, check_result from column_checks
where check_result != 'None';

select check_result, count(*)
from column_checks
group by check_result;

Received on Sun Aug 23 1998 - 08:19:52 CDT

Original text of this message

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