There is a plsql Cursor like below.
CURSOR get_customer_balance(cust_id_ IN VARCHAR2) IS
SELECT t.cust_balance
FROM customer_tab t
WHERE t.customer_id =cust_id_;
Procedure Body
OPEN get_customer_balance(123456789);
FETCH get_customer_balance INTO balance_;
CLOSE get_customer_balance;
In customer_tab, customer_id is a number type colomn. even through cursor parameter is varchar2 this works fine. for some values this give an error. also any error will be occurred in runtime only.
Is there a range of varchar2 that can automatically converted to number?
vs.
means that you intentionally do things wrong.
Not only that you should have passed a
number- as a matter of fact, you should have passedcustomer_tab.customer_id%typeso cursor declaration would have beenAs of your question: Oracle will try to implicitly convert any datatype you pass to a valid number. Sometimes it'll succeed (if you pass
'10', for example), sometimes not ('ABC'or'15XF4'). There's no "range"; it just depends on actual value.If you want, have a look at Tom Kyte's <a=href="https://blogs.oracle.com/connect/post/on-implicit-conversions-and-more">On implicit conversions and more, saying - among other things: