Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECT * in PRO-C...
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.
![]() |
![]() |