VALIDATE

 

VALIDATE statement tests the values against the range of the values allowed for the corresponding column. To be able to use the VALIDATE statement, you must specify the default database by including the DATABASE statement before any program block within the same module.

 

 

Element

Description

Variable List

The list of variables to be validated

Column List

The list of columns against which the values must be validated

 

This statement is used to validate the user entered data before they will be inserted into a table. The validation criteria can be specified as the attribute of a form field. If the values are inserted into a table not from a screen form field, the VALIDATE statement can apply the criteria for validation.

 

The values cannot be validated against the columns of large data types or of structured data types. However, you can validate a value against a member of a record or an element of an array that is of simple data type.

 

 

Variable List

 

Variable list consists of one or more variables separated by comas. The variables can be:

 

 

LIKE Clause

 

LIKE clause specifies the table columns against which the data should be validated. One VALIDATE statement can contain several variables which are tested, thus the LIKE clause can contain several database columns, against which the values are tested. The columns must match the variables in number, order and they must be of compatible data types. The names of the columns must be prefixed by the names of the corresponding tables.

 

VALIDATE var1, var2, var3 LIKE table1.column4, table3.column2, table12.column7

 

In an ANSI-compliant database, each table name must be preceded by the owner qualifier. The owner qualifier can be omitted only for the tables the owner of which executes this VALIDATE statement.

 

To use the columns from tables which do not belong to the default database in the LIKE statement, use the qualifier of the server to prefix the table qualifier.

 

 

 

Related articles:

DATABASE