Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get the 'top ten' from a SELECT count(*)
In article <3906E272.A8F5D230_at_tool42.com>,
Carsten Jacobs <carsten.jacobs_at_tool42.com> wrote:
> Sorry to ask you again but
>
> I can't create a view on it because I execute the select .. where
> rownum<11
> in a loop where another cursor delivers values I use in the mentioned
> select. I tried to
> create the view for each cycle in the outer cursor loop but it looked
> like that DDL Statements are
> not allowed in procedures.
DDL is allowed in procedures, but only by using the DBMS_SQL (dynamic SQL) package. You probably don't want to do that.
If you're doing this inside a stored procedure (or function, or
package), why not just close the cursor after you fetch ten records?
In other words, something like:
DECLARE
CURSOR c1 IS
select foo, bar from baz order by foo;
HTH -bn
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Wed Apr 26 2000 - 00:00:00 CDT