Click to See Complete Forum and Search --> : Exception handling question


nvidia
01-18-2007, 06:36 PM
I have a script where a user enters a value and i am expecting it to be a number which must be in my database.

v_odnum NUMBER := &sv_ordernum;


If the numbe does not exist in my database i have this code:

EXCEPTION

WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Sorry!' || ' '||v_odNum|| ' ' || 'was not found. Please try again!');

Question, how would you deal with a data type that is NOT of type number, VARCHAR2, for example, they enter:sfsfsfse. Or put it slightly better, how would you deal with a data type u are not expecting?

chazzy
01-18-2007, 07:52 PM
i think if they try entering a non number, oracle will convert it to 0.