Posts

Showing posts with the label #CAST#DATACONVERSION#ORACLE

Cast Conversion

  Overview Doesn’t matter who much testing you do (well, it actually does but that’s a whole different issue!) you can guarantee that at some point your beautiful code that parses data input from a web form or loads data from some external file will pop up with the error: SQL Error: ORA-01722: invalid number 01722. 00000 - "invalid number" *Cause: The specified number was invalid. *Action: Specify a valid number. Of course, what’s is really annoying at this point is that you don’t know which column value of the record failed (assuming that you have more than one numeric column) Module 2 Setting up a staging table For this tutorial let’s build some simple staging and target tables in our schema: CREATE TABLE STAGING_EMP ( "EMPNO" VARCHAR2( 6 ), "ENAME" VARCHAR2( 10 ), "JOB" VARCHAR2( 9 ), "MGR" VARCHAR2( 4 ), "HIREDATE" VARCHAR2( 10 ), "SAL" VARCHAR2( 7 ), "COMM" VARCHAR2( 9 ), ...