Skip to Main Content

APEX

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

PL/SQL Function Body returning SQL Query Error

vTz OporApr 3 2024

i have create function like this

 create or replace FUNCTION F_SUMMARY_LEAVE (
   p_empid IN NUMBER
)
RETURN varchar2
AS  
   l_sql varchar2(8000);
BEGIN
   l_sql := 'select * from employee where empid = ' || p_empid;
RETURN l_sql;
END F_SUMMARY_LEAVE;
/

and use on PL/SQL Function Body returning SQL Query like this

DECLARE
   l_empid NUMBER := :APP_USER;
   l_sql   varchar2(8000);
   
BEGIN
 
   l_sql := F_SUMMARY_LEAVE(l_empid);
  
   return l_sql;
  
END;

bur error ORA-20999: Parsing returned query results in "ORA-20999: Failed to parse SQL query! ORA-06550: line 4, column 4: ORA-00936: missing expression".

how to fix this

thank you.

Comments
Post Details
Added on Apr 3 2024
6 comments
72 views