0

I'm querying a DB2 table (STG_TOOL) with 2 columns - T_L_ID - Integer, Name - VARCHAR(20).

SELECT T_L_ID, Name FROM STG_TOOL;

The query returns answer. However, the below query gives error.

SELECT T_L_ID, RTRIM(Name) FROM STG_TOOL;

This query gives error at 78th row.

DB2 Database Error: ERROR [42815] [IBM][DB2] SQL0171N The data type, length or value of the argument for the parameter in position "1" of routine "SYSIBM.RTRIM" is incorrect. Parameter name: "". 1 0

The reason identified is that Name in 78th row has a replacement character - '�'. Even, the same query with a where clause gives us the error.

SELECT T_L_ID, RTRIM(Name) FROM STG_TOOL WHERE T_L_ID = 78;

The sample date on 78th rows is T_L_ID = 1040 & Name = 'test�'

The above mentioned error re-occurs for the above query.

What does the error implies? How can this be handled/solved?

Adding details to the post: Version: DSN11010 (version 11) OS: z/OS Encoding: Unicode

Toad for DB2 is being used for querying. Toad version - 5.5

Gdek
  • 81
  • 4
  • 11
  • Edit your question to add missing details (1) the Db2-server version and fixpack/release/modification (2) the operating-system running the Db2-server, and (3) your database and table encoding, and (4) the app-name and locale of the client tool that is displaying the SQL result. There might be invalid characters in the column (relative to the encoding) that either need cleaning or skipping. – mao Nov 02 '17 at 09:12
  • ...what happens if you use `RTRIM(name, '� ')` (replacement character and space)? And what's the declared type of `name` anyways? – Clockwork-Muse Nov 03 '17 at 16:31

0 Answers0