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

Home -> Community -> Usenet -> c.d.o.server -> Re: using table pointers in select?

Re: using table pointers in select?

From: William Robertson <williamr2019_at_googlemail.com>
Date: Fri, 10 Aug 2007 12:15:30 -0000
Message-ID: <1186748130.030322.290420@m37g2000prh.googlegroups.com>


On Aug 9, 11:09 am, "aksel.schmidt" <axl.schm..._at_gmail.com> wrote:
> hi all
>
> is it possible to use a 'pointer' like reference to a table?
> i want to write a function that should select from a table that is not
> known at compile time (but referenced in argument list)
>
> like:
> CREATE OR REPLACE FUNCTION "TEST"."DUMTEST" (tablename in varchar)
> return number
> is
> returnValue number;
> CURSOR c1
> IS (SELECT count(*) from all_objects); -- here i want to
> use the 'tablename' argument instead of 'all_objects' which is only
> here for compilation right now
> begin
> open c1;
> fetch c1 into returnValue;
> if c1%notfound then
> returnValue:=0;
> end if;
> close c1;
> RETURN returnValue;
> end;
>
> i can resolve the object id for the table using the 'all_objects' view
> - but how can i make this reference into a table to select from?
>
> thanks!
>
> /aksel

Out of interest, why would the table name not be known at compile time, when apparently the column list is? Received on Fri Aug 10 2007 - 07:15:30 CDT

Original text of this message

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