Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Functionality already exists
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Nov 10, 2023

Add a warning when parameter markers are truncated

IBM i silently truncates parameters to prepared statements to match the length of the target. 
-----
From https://www.ibm.com/docs/en/i/7.4?topic=statements-open, section "Parameter marker replacement" :
However, unlike the rules for assigning a value to a column:
- If V is a string, the value will be truncated (without an error), if its length is greater than the length attribute of the target.
-----
Example: If field "X" is a CHAR(5), in a prepared statement with clause "WHERE X = ?", the string parameter passed in is silently truncated to length 5 if it is longer than 5 characters. This means that a parameter value of "ABCDEF" will match to a field value of "ABCDE" as the parameter value is truncated. This is not how other database platforms handle this, and has caused issues because our developers do not expect this behavior on Db2 for i, resulting in rows that match a WHERE clause unexpectedly.

We would like an SQL query option (ideally settable through either ODBC/JDBC connection string or QAQQINI) that would cause an SQL warning or error when the passed parameter value is truncated.

Idea priority Medium
  • Guest
    Reply
    |
    Dec 13, 2023
    IBM believes that the solution for the Idea described is already available.

    When a parameter marker value is truncated on the OPEN, a warning is issued with SQLSTATE 01004. This follows the rules defined by the SQL standard.

    The documentation for the SQL OPEN statement will be corrected to reflect the existing behavior. This will happen when it is refreshed in the spring of 2024.
    The new sentence will read:
    If V is a string, the value will be truncated with a warning (SQLSTATE 01004) if its length is greater than the length attribute of the target.

    Db2 for i development team
    IBM Power Systems Development