Search code examples
sqlibm-midrangerpgle

ILE RPG SQLStored Procedure set option for timestamp?


I want to create new records in RPG with a stored procedure.

First, I assign the values to every field of the table. For the Timestamp field it's

TSTPfield = %TIMESTAMP();

When I select the created records, every record's timestamp has three zeros at the end like 2018-06-14-11.01.31.028000.

If I create a record in a rpg program without the stoed procedure, the timestamp looks normal without the unnormal zeros.

What can I do to get a correct timestamp without zeros? Do I have to adjust the settings of the .sql file of the stored procedure? There I have defined these options:

CREATE OR REPLACE PROCEDURE exampleproc 
(
 **fields**
)    
LANGUAGE RPGLE
NOT DETERMINISTIC
MODIFIES SQL DATA
EXTERNAL NAME exampleproc GENERAL
;

Solution

  • I'm not sure what you mean by "I create a record in a rpg program without the stoed procedure"

    But RPG's %timestamp() BIF only supports 3 digits of decimal precision.

    Only the first three digits of the fractional seconds portion of the timestamp will be set to a non-zero value. The remaining fractional seconds will be zero.