Home

TO_NUMBER should be used with a format model

Rule description

  • TO_NUMBER should be used with a format model

 

Non-compliant Code Example

UPDATE CUSTOMERS
		SET City=city, 
			CREDIT_LIMIT1 = TO_NUMBER('1800.00'),           --Non compliant code (TO_NUMBER used without format)
			ModificationDate = TO_TIMESTAMP(date_string)
		WHERE Id = customerId;

Compliant Code Example

UPDATE CUSTOMERS
		SET City=city, 
			CREDIT_LIMIT = TO_NUMBER('1800.00', '9G999D99'),        --Compliant code (TO_NUMBER used with format)
			ModificationDate = TO_TIMESTAMP(date_string,'YYYY-MM-DD HH24:MI:SS')
		WHERE Id = customerId;
Visual Expert 2020
 VEPLSQLRULE67