Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Re: SQL help needed

Re: Re: SQL help needed

From: Tanel Poder <tanel.poder.003_at_mail.ee>
Date: Wed, 17 Sep 2003 03:34:36 -0800
Message-ID: <F001.005D0383.20030917033436@fatcity.com>


Hi!

> This one is a very interesting consideration. The use of 'pivot' tables,
as in this case, without being something you meet daily is fairly frequent (completing series like here is one usage, otherwise I commonly use them to generate test data). It should be some standard feature, a kind of 'extended dual' (XDUAL ?).
> Perhaps this (to be run as SYS) should be added as a standard part of the
catalogue :
>
> create view xdual
> as select rownum from sys.col$;
> grant select on xdual to public;
> create public synonym xdual for xdual;
>
> sys.col$ always contains a 'respectable' number of rows (10,000+, even
without SAP :-)).
> Although indeed a standard sys.source$ is twice bigger just after install
..

If you definitely want to use a table for that, create a separate table with only one column - and insert it full of NULLs. That way you'll be fitting the most rows in one block, thus saving in performance (also put pctfree to 0).

Another way could be to use a pipelined table function with indefinite loop inside it (but I've heard pipelined functions are currently fairly slow).

SQL> create or replace type num_typ as table of number;   2 /

Type created.

SQL>
SQL> create or replace function f return num_typ pipelined is   2 i number := 1;
  3 begin
  4 loop

  5      pipe row(i);
  6      i:=i+1;

  7 end loop;
  8 return;
  9 end;
 10 /

Function created.

SQL>
SQL> select * from table(f) where rownum <=10;

COLUMN_VALUE


           1
           2
           3
           4
           5
           6
           7
           8
           9
          10

10 rows selected.

Tanel.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Tanel Poder
  INET: tanel.poder.003_at_mail.ee

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Sep 17 2003 - 06:34:36 CDT

Original text of this message

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