Re: select count(0) from variable_name...

From: Suresh Bhat <suresh.bhat_at_mitchell-energy.com>
Date: 29 Apr 1998 22:26:08 GMT
Message-ID: <01bd73cd$c8f60c20$a504fa80_at_mndnet>


You need to open the cursor outside the loop and then fetch it (INTO SOME_VARIABLE) inside the loop. It is not obvious as to what you want to do. Also finally you need

         exit when name_cur%notfound; before the end loop.  

brunson_at_brunson.com wrote in article <6i5al0$5vm$1_at_nnrp1.dejanews.com>...
>
>
> This is probabaly an FAQ, but I didn't find an FAQ that addressed it.
>
> I want to do this:
>
> declare
> cursor name_cur is
> select table_name
> from tabs;
>
> rowcount INTEGER;
> begin
> for name_row in name_cur
> loop
> select count(0)
> from name_row.table_name;
> end loop;
> end;
>
> I guess I can see why it might be hard to implement, but it seems silly
> not to be able to do it.
>
> Am I just missing something obvious, or is there a trick to it.
>
> Could it be done by dynamically building the SQL and executing it?
>
> Thanks for the input,
> e.
>
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
Received on Thu Apr 30 1998 - 00:26:08 CEST

Original text of this message