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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECT * in PRO-C...

Re: SELECT * in PRO-C...

From: Tim Witort <trwAT_at_ATmedicalert.DOTorg>
Date: 1997/07/09
Message-ID: <33C41C0E.504E@ATmedicalert.DOTorg>#1/1

David Mallarme wrote:
>
> Hello,
>
> Is there a way to make a generice request like
> Select * INTO array? from table_name where table_key=number;
> without using dynamics queries in PRO-C/PL-SQL ?
>

OCI (Oracle Call Interface) supports dynamic SQL statements to be formed and executed, but it's even more involved than Pro*C or PL/SQL. One way to make dynamic SQL is to have one SQL script (main.sql) which spools to another file (dynam.sql). The main.sql script writes the dynam.sql script by making selections from the data dictionary, dual, etc.

Example:

set heading off
spool dynam.sql

SELECT
  'SELECT count(*) FROM '||owner||'.'||table_name||';' FROM
  sys.dba_tables;

SELECT
  'exit'
FROM
  DUAL; spool off

This would write a script to count all the rows of all the tables in the database.

Received on Wed Jul 09 1997 - 00:00:00 CDT

Original text of this message

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