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: masking column values

Re: masking column values

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Fri, 11 Feb 2005 09:40:37 -0800
Message-ID: <1108143470.879422@yasure>


chopras_at_gmail.com wrote:

> Hi,
>
> Im trying to mask column values (padding attribute values with null
> values). One way to do this seems to be using either the DECODE
> command or CASE WHEN THEN ELSE command.
>
> For example, to ensure employees only see their salaries,
>
> I create a view as
>
> create ore place view emp_clm
> as
> select name, id, dept,
> DECODE(name, USER, sal, NULL) sal
> from emp
>
> The view accomplishes the following: If a user accessing the record
> (USER) is the same as the person whose record is being checked (name),
> then the user can see his salary. If not, the salary column (sal) is
> padded with the null value.
>
> Note that the decode/case when commands modify the SELECT clause of the
> query. I want to push the column masking down to the WHERE clause of
> the query. Anyone know how to do this:
>
> One (although not elegant) solution might be something like:
>
> select name, id, dept, sal
> from emp
> where p1
> union
> select name, id, dept, null
> from emp
> where p2;
>
> (In this case, p1 intersect p2 = null)
>
> Any help w/ this is greatly appreciated!

Your question doesn't make sense to me and your example ... WHERE p1 ... isn't valid syntactically in any RDBMS.

Please ask your question again as a question of business logic rather than trying to write demo code. What do you mean by "mask values" and what is the possible relevance to a WHERE clause?

All I can think of is function based indexes but that is likely caused by the fact that I don't understand what you are trying to do.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Fri Feb 11 2005 - 11:40:37 CST

Original text of this message

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