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 -> using table pointers in select?

using table pointers in select?

From: aksel.schmidt <axl.schmidt_at_gmail.com>
Date: Thu, 09 Aug 2007 03:09:14 -0700
Message-ID: <1186654154.252944.282220@57g2000hsv.googlegroups.com>


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 Received on Thu Aug 09 2007 - 05:09:14 CDT

Original text of this message

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