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: Rookie Question

Re: Rookie Question

From: Daniel Morgan <damorgan_at_exxesolutions.com>
Date: Thu, 10 Jul 2003 09:05:59 -0700
Message-ID: <3F0D8EE6.60D65250@exxesolutions.com>


Dirk Tschentscher wrote:

> Hi Rüdiger
>
> you can do it with "execute immediate"
> execute immediate 'SELECT count(*) FROM '||r.tablename into rows;
> execute immediate 'UPDATE info_tablerows SET rowcount ='|| rows ||
> 'WHERE tablename = '|| r.tablename ;
> It's not possible with normal SQL
>
> Rgds
> Dirk
> "Ruediger Tams" <ruediger.tams_at_komtel.net> schrieb im Newsbeitrag
> news:3F0D6CAF.9B59D538_at_komtel.net...
> > Hello,
> > possibly it is a very simple "rookie" question but:
> > This statement don't work. why?
> >
> > DECLARE
> > CURSOR c1 IS
> > SELECT a.tablename FROM info_tablerows a;
> > rows number;
> > BEGIN
> > FOR r IN c1 LOOP
> > SELECT count(*) INTO rows FROM r.tablename;
> > UPDATE info_tablerows SET rowcount = rows WHERE tablename =
> > r.tablename;
> > END LOOP;
> > END;
> > /
> >
> > At "SELECT count(*) INTO rows FROM r.tablename;" the message
> > "identifier r.tablename must be declared" appears.
> > Isn't it possible to reference my tablename?
> >
> > Thanks for hints.
> >
> > regards ruediger
> >

In addition run the following SQL statement:

select keyword from v_$reserved_words
where keyword like 'RO%';

You made a remakably bad choice for a variable name.

--
Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Thu Jul 10 2003 - 11:05:59 CDT

Original text of this message

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