Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL function returning SQL query

625324May 19 2008 — edited May 19 2008
hi, friends i m in big confusion with following PL/SQL function.

i have created 2 tables named emp_master and authentiaction.
in emp_master table all the employees data is there.

i have given the authorization level =1 in authentication table for DBA while the employees having authorization level=2.

in the emp_master report i want the report to be restricted to the individual data for each employee and only DBA can view all the employee information. i have writen the folowing PL/SQL function

DECLARE

temp varchar2(1000);

BEGIN

IF authentication.authorization_level =1 and authentication.login_id = :APP_USER
THEN
temp:= 'select * from emp_master';

ELSE

temp:= 'select * from emp_master e,authentication a where a.login_id = :APP_USER and a.emp_code = e.emp_code';
END IF;

RETURN temp;

END;


But i m getting the following error.

error

ORA-06550: line 7, column 22:
PLS-00357: Table,View Or Sequence reference 'AUTHENTICATION.AUTHORIZATION_LEVEL' not allowed in this context
ORA-06550: line 7, column 4:
PL/SQL: Statement ignored
ORA-06550: line 16, column 4:
PLS-00372: In a procedure, RETURN statement cannot contain an expression
ORA-06550: line 16, column 4:
PL/SQL: Statement ignored5. BEGIN
6.
7. IF authentication.authorization_level =1 and authentication.login_id = :APP_USER
8. THEN
9. temp:= 'select * from emp_master';



please help me out.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2008
Added on May 19 2008
1 comment
475 views