0

Below is my Package code.

CREATE OR REPLACE PACKAGE BODY MyPackageBody AS

FUNCTION MyFunction(Param1 IN VARCHAR2,Param2 IN DATE) RETURN BOOLEAN IS
SELECT TRUE FROM MYTABLE WHERE MYCOLUMN1=Param1 AND MYCOLUMN2=Param2;
END MyFunction;

End MyPackageBody;

I am testing my Function be executing below statement,

select MyPackageBody.MyFunction('abc',sysdate) from dual;
select MyPackageBody.MyFunction('abc',to_date('06/30/2015 6:20:19 PM','MM/DD/YYYY HH12:MI:SS PM')) from dual;

In both the cases I am getting error pop up as "ORA-00902: invalid datatype"

jarlh
  • 42,561
  • 8
  • 45
  • 63
user2488578
  • 896
  • 4
  • 21
  • 40
  • 2
    It is not allowed to have a `BOOLEAN` return type in a function while calling it from sql. use `VARCHAR2` strings: 'TRUE' , 'FALSE' or numbers: 1,0 – Kaushik Nayak Dec 19 '17 at 07:21
  • 1
    Oracle SQL has no Boolean. The issue is the return type not 'passing parameter to function' as in your question title. Also the code within the function is invalid (Boolean in SQL, missing `into` clause, missing `return` statement). – William Robertson Dec 19 '17 at 08:06

0 Answers0