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 -> INSERT w/inline SELECT

INSERT w/inline SELECT

From: <fpuhan_at_my-deja.com>
Date: Thu, 16 Nov 2000 20:24:28 GMT
Message-ID: <8v1fpi$v1m$1@nnrp1.deja.com>

Hi Gurus,

I'm having a brain cramp; this is something I've done a number of times before. I used to have my source code, but left it behind at my last job. :-(

Simplified, here's what I'm attempting. I want to build a table and populate it with table names and row counts for a particular schema (the schema owner may change, so the general flow is as follows):

drop table tab_info
/

create table tab_info
  ( table_name varchar2(40),
    num_rows number(10))
/

spool tabins.sql
-- Here's where it goes sour
select
 'insert into tabinfo values ('''||table_name||''',  (select count(*) from &&SCHEMA_OWNER..'||table_name||'));' from dba_tables
where owner = upper('&&SCHEMA_OWNER')
/

spool off

@tabins

=Fred=

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Nov 16 2000 - 14:24:28 CST

Original text of this message

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