This will not answer your question, but may be solve your problem, i.e. create an index
Why you want to use LPAD when creating an Index over a numeric date and time?
I assume the numeric date is defined as DEC(8, 0) and includes a numeric date in the format YYYYMMDD and the time is defined as DEC(6, 0) and include a time in the format HHMMSS.
In this case you could create an index as follows:
Create Index YourSchema.YourIndex
on YourSchema.Yourtable
(timestamp(digits(NumDate) concat digits(Numtime)) as TS);
Just in case your time is only 4 digit in the format HHMM you could create an index as follows:
Create Index yourschema.yourindex
on yourschema.yourtable
(timestamp(digits(NumDate) concat digits(NumTime4) concat '00') as TS);
... but keep in mind the index can only be used if you use the same syntax (for the timestamp) in your queries.
The easiest way would be to generate a view with an additional column where the timestamp is prepared in the same way as in your index (or vice versa).
------------------------------
Birgitta Hauser
Database and Software Engineer
Selfemployed - Modernization-Education-Consulting on IBM i
Kaufering
+49 170 5269964
------------------------------
Original Message:
Sent: Fri April 05, 2024 02:21 AM
From: John Gojnich
Subject: Built-in Function Selection
Thanks Kent. SQL0356 is a bit obscure.
CREATE INDEX testtime3 ON testtime (TIMESTAMP(lmdt||LPAD(lmtm,6,0),0));
------------------------------
John Gojnich
Original Message:
Sent: Thu March 28, 2024 04:14 PM
From: Kent Milligan
Subject: Built-in Function Selection
A Db2 implementation detail to consider before choosing a function to use.
https://db2ibmi.blogspot.com/2024/03/not-all-db2-functions-are-created-equal.html
------------------------------
Kent Milligan
IBM Technology Expert Labs
------------------------------
#SQL