Consultor Eletrônico



Kbase P149461: SQL: Concatenation of string character literals expressions using "+" or "||" string operators cau
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   14/07/2009
Status: Unverified

SYMPTOM(s):

SQL: Concatenation of string character literals expressions using "+" or "||" string operators causes the result to be too long.

Concatenation of a character literal to a field or a string causes the width of the result column to be too wide.

Concatenation of a character literal to a field or a string causes the length of the resulting column to be too large.

Executing the query:

SELECT
name + '|' AS Col1,
LENGTH(name + '|') AS Len1
FROM
pub.Customer
WHERE
Custnum = 1

Returns:

COL1 LEN1
Lift Tours| 61

FACT(s) (Environment):

Executing the query:

SELECT
name AS Col1,
LENGTH(name) AS Len1
FROM
pub.Customer
WHERE
Custnum = 1

Returns:

COL1 LEN1
Lift Tours| 10
All Supported Operating Systems
Progress 9.x
OpenEdge 10.1A
OpenEdge 10.1B

CAUSE:

Bug# OE00136140

FIX:

Upgrade to OpenEdge 10.1B01 or later. If upgrading to OpenEdge 10.1B01 or later is not feasible, then use LTRIM, RTRIM or BOTH on the concatenated literal character to fix this issue. For example, executing any of the following three variations of the original query returns a correct result set:

SELECT
name + LTRIM('|') AS Col1,
LENGTH(name + LTRIM('|')) AS Len1
FROM
pub.Customer
WHERE
Custnum = 1
or
SELECT
name + RTRIM('|') AS Col1,
LENGTH(name + RTRIM('|')) AS Len1
FROM
pub.Customer
WHERE
Custnum = 1
or
SELECT
name + LTRIM(RTRIM('|')) AS Col1,
LENGTH(name + LTRIM(RTRIM('|'))) AS Len1
FROM
pub.Customer
WHERE
Custnum = 1

Returns:

COL1 LEN1
Lift Tours| 11