Consultor Eletrônico



Kbase P146907: SQL: Is there a performance difference in extracting array elements using subscripts and the PRO_ELE
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/26/2009
Status: Unverified

GOAL:

SQL: Is there a performance difference in extracting array elements using subscripts and the PRO_ELEMENT function?

GOAL:

Is there a way to preserve the field data type without using the CONVERT or CAST function?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.1x
OpenEdge 10.2x

FIX:

1. Yes, the subscripted array references is more efficient that the PRO_ELEMENT function because the subscripted array reference extracts the array element in its native data type while the PRO_ELEMENT function extracts it as CHARACTER data type which may then be converted using the CONVERT or CAST function.
On the other hand, the PRO_ELEMENT function converts the entire array into CHARACTER and then extracts the element as a CHARACTER string. For example, PRO_ELEMENT("Sales-Quantity",1 ,1) returns a CHARACTER data type which needs to be converted using the CAST or the CONVERT function to render it in its native data type as in the following example:
CONVERT ('NUMERIC(15,2)', PRO_ELEMENT ("Sales-Quantity",1 ,1))
2. Yes, the way to preserve the field data type without using the CONVERT or CAST function is to use subscripted array references. For example, if the Sales_Quantity is defined as an array of Numeric(15,2) with extent 12, then the subscripted array reference Sales_Quantity[1] returns a Numeric(15,2) value. In other words, with the subscript notation, there is no need for conversion.