Link to home
Start Free TrialLog in
Avatar of Swaminathan K
Swaminathan KFlag for India

asked on

oracle numeric condition check

Hi Team,

 I have an requirement , where in I need to check whether the numeric fields in the table are having numeric  values or  not. If not  then I need to update the status to E which means error.

Here again what is the best solution , the reason being if I use the

Select to_number(internal_key,'9999999999') from dual , if the internal_key column has character value then it will throw an error and
will not be able to update the table.


 table name
 test_data


 employeeID                    NUMBER      
 internal_KEY                 VARCHAR2(10)  
 band_ID                   VARCHAR2(38)  
 appraisal_score       DECIMAL(2,5)  
 salary     VARCHAR2(10)  
 STATUS                       CHAR(1)      
 ERROR_CODE                   VARCHAR2(15)
 ERROR_DESC                   VARCHAR2(1000)
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Swaminathan K

ASKER

awesome
Expanding a bit on slightwv's solution -
update test_table
set status = 'E'
where regexp_instr(internal_key,'^[0-9]+$') = 0