Check this example....
here lies the problem...Code:SQL> insert into emp values(1,'123abhay','',''); 1 row created. SQL> commit; Commit complete. SQL> desc emp; Name Null? Type ----------------------------------------------------- -------- ----------------------------- ID NUMBER EMP_NAME VARCHAR2(32) ADDRESS VARCHAR2(100) NICK_NAME VARCHAR2(15) SQL> select to_number(substr(EMP_NAME,1,3)) from emp where ID=1; TO_NUMBER(SUBSTR(EMP_NAME,1,3)) ------------------------------- 123 SQL> select to_number(substr(EMP_NAME,1,6)) from emp where ID=1; select to_number(substr(EMP_NAME,1,6)) from emp where ID=1 * ERROR at line 1: ORA-01722: invalid number SQL>
SELECT LOCATIONDBOID INTO V_LOCATIONDBOID FROM LOCATIONS WHERE LOCATIONID = TO_NUMBER(SUBSTR(V_EVENTDATADESC,1,3))
Abhay




Reply With Quote