Db2 for z/OS

Db2 for z/OS on IBM Z

Db2 for z/OS on IBM Z

Leading enterprise data server technology powering business critical transactions and analytics

 View Only

DB2 Stored Procedure VARCHAR

  • 1.  DB2 Stored Procedure VARCHAR

    Posted Fri May 19, 2023 02:16 PM
    Edited by GIRISH VENKATARAMANAPPA Sat May 20, 2023 06:06 AM

    Hi 

    I am using Db2 External Stored Procedure( paramater type used VARCHAR(32K))
    Db2 Table column is defined  VARCHAR 32k
    Data of length "32K " is inserted to the table, the first/last byte has a trailing space, which needs to be retained( this is my goal)
    Looking at the table it appears to retain the space, since Db2 Table adds delimiters <> if the string is lets  say "abc   " then it stores "<abc   >"  
    when the SP fetches this 32K VARCHAR data from the TABLE and returns to the calling application it shows data size 32k without the trailing space

    Question:
    DB2 Stored procedure: 
    Does it strip leading/trailing space that has data length max of 32K ?
    or
    Stored Procedure parameter Type VARCHAR32k does it drop this leading/trailing space ?  
    is there anyway possible to retain the leading/trailing spaces in VARCHAR parameter in the Stored procedure ?
    Thanks and Regards




    ------------------------------
    GIRISH VENKATARAMANAPPA
    ------------------------------