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: Parameterized Views

Re: Parameterized Views

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Thu, 14 Aug 2003 19:16:36 +0800
Message-ID: <3F3B6F94.59B0@yahoo.com>


Ryan wrote:
>
> "Connor McDonald" <connor_mcdonald_at_yahoo.com> wrote in message
> news:3F3A5434.518_at_yahoo.com...
> > Brian Kramer wrote:
> > >
> > > Does oracle support parameterized views? Basically we'd like to be
> > > able to pass a userid to a view and based on the userid filter the
> > > data.
> > > We can get the userid into a table but the problem is that we don't
> > > know which user id goes with which request (we are using a common
> > > application login, rather than separate user logins). Is there such a
> > > thing as a temporary table for a given session? Or some other way to
> > > guarantee we are pulling the correct userid?
> > >
> > > In a nutshell we have the userid in a web application and we need a
> > > way to get it to the database so a view can be created that filters
> > > based on the userid.
> >
> > check out the use of contexts and the SYS_CONTEXT function to do this.
> >
> > create view view_on_emp
> > as select * from emp
> > where empno = sys_context('MYCTX','EMPNO);
> >
> > dbms_session.set_context('MYCTX','EMPNO',12);
> > select * from view_on_emp;
> >
> > hth
> > connor
> >
> what is the difference between set_context and dbms_rls? They look to serve
> the same purpose?
>
> > --
> > =========================
> > Connor McDonald
> > http://www.oracledba.co.uk
> >
> > "Some days you're the pigeon, some days you're the statue"

Contexts are used to implement row level security but that is not to say you can't use them anywhere else (eg parameterised views)

hth
connor

-- 
=========================
Connor McDonald
http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue"
Received on Thu Aug 14 2003 - 06:16:36 CDT

Original text of this message

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