Home

Track breaches of an XPath rule

Rule description

  • Track breaches of an XPath rule

 

Non-compliant Code Example

CREATE OR REPLACE PROCEDURE GetCustomerPhoneNumber1 (customerId IN INTEGER)
IS
	oracleQuery  VARCHAR2(100);     --Non compliant code (Identifier length is more then 10 character)
	customerPhoneNumber NUMBER;     --Non compliant code (Identifier length is more then 10 character)
	
BEGIN
 oracleQuery := q'{BEGIN SELECT PhoneNumber FROM Customers WHERE id = :customerId  END; }';
        
 EXECUTE IMMEDIATE oracleQuery INTO customerPhoneNumber;
END

Compliant Code Example

CREATE OR REPLACE PROCEDURE GetCustomerPhoneNumber1 (customerId IN INTEGER)
IS
	query  VARCHAR2(100);       --Compliant code (Identifier length is less then 10 character)
	phNo NUMBER;                --Compliant code (Identifier length is less then 10 character)
	
BEGIN
 query := q'{BEGIN SELECT PhoneNumber FROM Customers WHERE id = :customerId  END; }';
        
 EXECUTE IMMEDIATE query INTO phNo;
END
Visual Expert 2020
 VEPLSQLRULE167