Question: how do i implement the to other if statements in this function? ok so i have an admin user called ' USERX ' that contains

how do i implement the to other if statements in this function? 


ok so i have an admin user called ' USERX ' that contains data now im trying to give privileges to three other users. 

so i am creating a function policy with roles 

USERY can only read 'A'

USERZ can only read 'M'

USERZZ can only read 'Z'

So I've managed to do the policies and  all the privileges im having a hard time making the function IF ELSE statements 

/*READ 'A' FUNCTION, Zachary Jilesen 041017349*/ CREATE OR REPLACE FUNCTION MY_FUNC (p_schema varchar2, P_obj 

/*READ 'A' FUNCTION, Zachary Jilesen 041017349*/ CREATE OR REPLACE FUNCTION MY_FUNC (p_schema varchar2, P_obj varchar2) return varchar2 as d_predicate VARCHAR2 (2000); myUser VARCHAR2 (2000); roleFound int; BEGIN d_predicate := '1 1'; myUser := SYS_CONTEXT ('USERENV', 'SESSION_USER'); SELECT COUNT(*) AS Found into role Found FROM SYS.DBA_ROLE_PRIVS WHERE GRANTEE=UPPER (myUser) AND GRANTED_ROLE-UPPER ('RL_ROWA_READ'); if roleFound > 0 THEN d_predicate := 'ColumnA = || || 'A' || ; end if; return d predicate; END MY_FUNC;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It looks like you are trying to create a function in a database that sets different predicates based on the users role giving them different read priv... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!