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: CHALLENGING:: Dynamic OR Session specific Views. Possible?

Re: CHALLENGING:: Dynamic OR Session specific Views. Possible?

From: Noons <wizofoz2k_at_yahoo.com.au>
Date: 21 May 2005 04:37:28 -0700
Message-ID: <1116675448.246298.187050@z14g2000cwz.googlegroups.com>


vistav20_at_yahoo.com wrote:
> Thanks very much for help.
>
> Unfortunately they all missed the boat. What I am after is modifying
> the underlying SQL of a view dynamically, for each session.
>
> So, if user 1 logs in, the program might change the view A for him as
> "create or replace view A as select a from table1 where a = 123".
While
> if user 2 logs in, the program will issue the following: "create or
> replace view A as select b as a from table2 where a = 567". etc etc

what you need is to setup a package with a function that returns a cursor. Then inside the function, you construct the statement you want as a string and execute immediate the string, returning the cursor. Much better than dynamically creating a view (DDL contention, non-scalability and all that). There are examples on how to do this in the PL/SQL manual, have a gander. Received on Sat May 21 2005 - 06:37:28 CDT

Original text of this message

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