754
社区成员




Error reporting Not all DBMSs return a conversion error when the data type of a column does not match the data type of the associated variable.
The following statement uses the indicator variable IndVar2 to see if Address contains a NULL value:
if IndVar2 = -1 then...
You could also use the PowerScript IsNull function to accomplish the same result without using indicator variables:
if IsNull( Address ) then ...
This statement uses the indicator variable IndVar3 to set City to NULL:
IndVar3 = -1
You could also use the PowerScript SetNull function to accomplish the same result without using indicator variables:
SetNull( City )
Using indicator variables
PowerBuilder supports indicator variables, which are used to identify NULL values or conversion errors after a database retrieval. Indicator variables are integers that are specified in the HostVariableList of a FETCH or SELECT statement.
Each indicator variable is separated from the variable it is indicating by a space (but no comma). For example, this statement is a HostVariableList without indicator variables:
:Name, :Address, :City
The same HostVariableList with indicator variables might look like this:
:Name :IndVar1, :Address :IndVar2, :City :IndVar3
Indicator variables have one of these values:
Numerical value Meaning
0 Valid, non-NULL value
-1 NULL value
-2 Conversion error