Global Data Management Forum

Data Management Global

A hub for collaboration, learning, networking, and cultural exchange, and contributing to positive global engagement

 View Only
  • 1.  Sql code 901 when converting timestamp from numeric

    Posted 09/13/24 12:58 PM

    Hi I am getting sqlcode 901 when running rpgle program from db2 store procedure 

    When I call the same db2 procedure from rpgle code no errors appear. 

    Here is the problem part of the Code

    select TIMESTAMP_FORMAT(char(20240101),'YYYYMMDD') into :tmpt  FROM sysibm.sysdummy1;
    This will return sqlcode 901 when calling from db2 procedure 
    If change 20240101 to '20240101'
    (Numeric to char) then no errors  appear 


    ------------------------------
    doron perlstein
    ------------------------------


  • 2.  RE: Sql code 901 when converting timestamp from numeric

    Posted 09/15/24 05:05 AM

    It seems you are missing some PTFs.

    For me the following conversions work both:

    values(Timestamp_Format(Cast(20241231 as Char(10)), 'YYYYMMDD'),
           Timestamp_Format(Char(20241231), 'YYYYMMDD'));

    Birgitta



    ------------------------------
    Birgitta Hauser
    Database and Software Engineer
    Birgitta Hauser - Modernization-Education-Consulting on IBM i (selfemployed)
    Kaufering
    +49 170 5269964
    ------------------------------