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

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

FW: SQL help needed

From: Tim Gorman <tim_at_sagelogix.com>
Date: Sat, 20 Sep 2003 11:19:43 -0800
Message-ID: <F001.005D094E.20030920111943@fatcity.com>


How incredibly frustrating! My original response keeps getting truncated just before the good stuff! Here is one more try with HTML turned off...

Sorry for the last response in this thread which was truncated. Very annoying! The full response looks as follows (hope this goes through in it¹s entirety)...

Great idea, Mark!

By the way, does anyone remember the "yes" command in UNIX? Same concept. I think it was invented to answer ³yes² to any program which mindlessly prompt for ³yes/no² responses in situations where only ³yes² makes sense. Case in point: ³fsck². As in: ³Do you want to repair this block (y/n)? ³. Later on, the ³fsck ­y² option made the separate ³yes² command unnecessary. Nice thing about the ³yes² command is that it could also answer ³no² endlessly (i.e. ³yes n²) or other themed responses (i.e. ³yes eat me²)...

Anyway, here's your INFINITE_DUAL table, obviously requiring Oracle9i or above...

> SQL> create type InfiniteDualType as object (dummy number);
> 2 /
>
> Type created.
>
> SQL>
> SQL> create type InfiniteDualTable as table of InfiniteDualType;
> 2 /
>
> Type created.
>
> SQL>
> SQL> create function f_infinite_dual(upper_limit in number default null)
> 2 return InfiniteDualTable
> 3 pipelined
> 4 is
> 5 v_rtn InfiniteDualType;
> 6 i integer := 1;
> 7 begin
> 8 --
> 9 v_rtn := InfiniteDualType(null);
> 10 while true loop
> 11 v_rtn.dummy := i;
> 12 if upper_limit is not null and i > upper_limit then
> 13 exit;
> 14 end if;
> 15 i := i + 1;
> 16 pipe row (v_rtn);
> 17 end loop;
> 18 --
> 19 return;
> 20 --
> 21 end f_infinite_dual;
> 22 /
>
> Function created.
>
> SQL>
> SQL> select * from table(f_infinite_dual(10));
>
> DUMMY
> ----------
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
>
> 10 rows selected.
>
> SQL>
> SQL> create view infinite_dual
> 2 as
> 3 select * from table(f_infinite_dual);
>
> View created.
>
> SQL>
> SQL> select * from infinite_dual;
>
> DUMMY
> ----------
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 11
>
> DUMMY
> ----------
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> 20
> 21
> 22
>
> DUMMY
> ----------
> 23
> 24
> 25
> 26
> 27
> 28
> 29
> 30
> 31
> 32
> 33

..and so on, and so on, and so on, until you hit CTRL-C (or 42, which ever represents infinity in your own belief system)...

Just for grins, I had installed an UPPER_LIMIT parameter to the F_INFINITE_DUAL function, but it defaults to infinity.

Great idea, Mark!

-Tim

on 9/17/03 6:24 PM, Mark Richard at mrichard_at_transurban.com.au wrote:

>
> You raise an interesting idea in my mind...
>
> How useful would it be for us if Oracle created an INFINITE_DUAL table -
> One where you could select as many rows as you wished. I guess it might be
> dangerous but it would at least be very efficient if Oracle coded it as a
> special table. Then you could just do things like "select rownum from
> infinite_dual where rownum <= 1000000" without concern or consideration.
>
> As you said - you wouldn't use it every day, but I'm sure it would be handy
> to have. It would also provide new ways to crash Oracle I guess, with
> queries like "select rownum the_row from infinite_dual order by the_row".
> Hmm, perhaps this idea needs some additional thought? I'm sure it would be
> practical to create something which works efficiently and safely though.
>
> Regards,
> Mark.
>
>
>
>
> "Stephane
> Faroult" To: Multiple recipients of
> list ORACLE-L <ORACLE-L_at_fatcity.com>
> <sfaroult_at_oriolec cc:
> orp.com> Subject: RE: Re: SQL help needed
> Sent by:
> ml-errors_at_fatcity
> .com
>
>
> 17/09/2003 18:39
> Please respond to
> ORACLE-L
>
>
>
>
>
>
>

>> ----- ------- Original Message ------- -----
>> From: "Mark Richard" <mrichard_at_transurban.com.au>
>> To: Multiple recipients of list ORACLE-L
>> <ORACLE-L_at_fatcity.com>
>> Sent: Tue, 16 Sep 2003 19:59:41
>> 
>> 
>> I guess I should have added some criteria like:
>> 
>> 1)  user_objects must have enough rows in it to
>> cover the range (if not
>> consider some other table)
>> 

>
> 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 ..
>
> Regards,
>
> Stephane Faroult
> Oriole
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Stephane Faroult
> INET: sfaroult_at_oriolecorp.com
>
> 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).
>
>
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>
> Privileged/Confidential information may be contained in this message.
> If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such person),
> you may not copy or deliver this message to anyone.
> In such case, you should destroy this message and kindly notify the sender
> by reply e-mail or by telephone on (61 3) 9612-6999.
> Please advise immediately if you or your employer does not consent to
> Internet e-mail for messages of this kind.
> Opinions, conclusions and other information in this message
> that do not relate to the official business of
> Transurban City Link Ltd
> shall be understood as neither given nor endorsed by it.
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>
>
>
>
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>>>>>
> Privileged/Confidential information may be contained in this message.
> If you are not the addressee indicated in this message (or responsible for
> delivery of the message to such person), you may not copy or deliver this
> message to anyone.
> In such a case, you should destroy this message and kindly notify the sender
> by reply e-mail or by telephone on (03) 9612-6999 or (61) 3 9612-6999.
> Please advise immediately if you or your employer does not consent to Internet
> e-mail for messages of this kind.
> Opinions, conclusions and other information in this message that do not relate
> to the official business of Transurban Infrastructure Developments Limited and
> CityLink Melbourne Limited shall be understood as neither given nor endorsed
> by them.
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>>>>>
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Tim Gorman
  INET: tim_at_sagelogix.com

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 Sat Sep 20 2003 - 14:19:43 CDT

Original text of this message

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