When you assign values to the output parameters in a procedure or to the local variables or the function value of a UDF in a routine (SET, RETURN, SELECT...INTO, FETCH...INTO, INSERT...RETURN INTO), data-type-specific rules apply. These are described below.
Strings
You can enter an alphanumeric value in an output parameter or a local variable with an alphanumeric data type. You can enter a national value in an output parameter or local variable with a national data type. The following rules apply:
If the target data type is CHAR or NCHAR and the length of the value is smaller than the length of the target data type, the value is padded on the right with blanks.
If the target data type is CHAR or NCHAR and the length of the value is greater than the length of the target data type, the value is truncated from the right to the length of the target data type and a warning is issued.
If the target data type is VARCHAR or NVARCHAR and the length of the value is greater than the maximum length of the target data type, the value is truncated from the right to the maximum length of the target data type and a warning is issued.
Numeric values
You can enter a numeric value in an output parameter or local variable with a numeric data type. If the numeric data types are not the same, the value is converted to the target data type. The following rules apply:
If the number of digits to the right of the decimal point of the value is too large for the target data type, the value is rounded.
If the value is too large for the target data type, the value is not entered and an error message is issued.
Time values
You can only enter a value with time data type in an output parameter or local variable with the same data type:
A date in an output parameter or local variable with the data type DATE
A time in an output parameter or local variable with the data type TIME
A time stamp in an output parameter or local variable with the data type TIMESTAMP