EXTFNAPIV4_DESCRIBE_PARM_SCALE Attribute (Get)

The EXTFNAPIV4_DESCRIBE_PARM_SCALE attribute indicates the scale of a parameter. Used in a describe_parameter_get scenario.

Data Type

a_sql_uint32

Description

The scale of a parameter to a UDF. For arithmetic data types, parameter scale is the number of digits to the right of the decimal point in a number.

This attribute is not valid for:

Usage

Gets the scale of the parameter as defined in the CREATE PROCEDURE statement.

Returns

On success, returns the size of (a_sql_uint32).

On failure, returns one of the generic describe_parameter errors or:
  • EXTFNAPIV4_DESCRIBE_BUFFER_SIZE_MISMATCH – get error returned if the describe_buffer is not the size of a_sql_uint32.
  • EXTFNAPIV4_DESCRIBE_INVALID_STATE – get error returned if the query processing phase is not greater than Initial.
  • EXTFNAPIV4_DESCRIBE_INVALID_PARAMETER – get error returned if the specified parameter is a TABLE parameter. This includes parameter 0, or parameter n where n is an input table.

Query Processing Phases

Valid in:
  • Annotation phase
  • Query Optimization phase
  • Plan Building phase
  • Execution phase

Example

Sample _describe_extfn API function code fragment that gets the scale of parameter 1:

if( cntxt->current_state > EXTFNAPIV4_STATE_ANNOTATION ) {
	a_sql_uint32 scale = 0;
	a_sql_int32 ret = 0;

	ret = ctx->describe_parameter_get( ctx, 1, EXTFNAPIV4_DESCRIBE_PARM_SCALE,
	&scale, sizeof(a_sql_uint32) );

	if( ret <= 0 ) {
	// Handle the error.
	}
}