Reputation: 4637
Consider the following situation:
SELECT TestPkg.getData(123) FROM dual;
returns correct result, but
SELECT TestPkg.getData(SELECT TO_NUMBER('123') FROM dual) FROM dual;
gives error as missing expression, why is that so? How to tackle with such situation where we are passing value to function which is dependent on value from query.
Upvotes: 1
Views: 770
Reputation: 94859
To evaluate a select result you need brackets:
SELECT TestPkg.getData( (SELECT TO_NUMBER('123') FROM dual) ) FROM dual;
One pair for the function call, one for the evaluation of the select result.
Upvotes: 5
Reputation: 18411
I think you need:
SELECT TestPkg.getData(TO_NUMBER('123')) FROM dual;
Upvotes: 1