Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> masking column values
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! Received on Fri Feb 11 2005 - 02:56:10 CST