Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

LPAD removes trailing value in IG text field column validation with format mask

Indy MaatDec 21 2021 — edited Dec 21 2021

I have an Interactive Grid with a text field column (DEVULTD). This text field represents a 24-hour clock and is saved as a Number(4,0) in the database. The format mask is set to 0000 so that the following values are formatted correctly upon render of the IG:
1 -> 0001
30 -> 0030
110 -> 0110
1730 -> 1730
When processing, we validate this clock with another date to determine if it is after a certain date. To be sure we are validating the right 24-hour clock value we use LPAD(:DEVULTD, 4, '0'). However, when using LPAD in combination with the format mask, LPAD seems to remove a trailing number. The following values have been logged using apex_debug.info():

apex_debug.info(':DELVRDT = ' || :DELVRDT);
apex_debug.info(':DEVULDT = ' || :DEVULDT);
apex_debug.info(':DEVULTD = ' || :DEVULTD);
apex_debug.info('lpad(:DEVULTD, 4, ''0'') = ' || lpad(:DEVULTD, 4, '0'));
apex_debug.info('lpad(:DEVULTD, 4, 0) = ' || lpad(:DEVULTD, 4, 0));
apex_debug.info('lpad(to_char(:DEVULTD), 4, ''0'') = ' || lpad(to_char(:DEVULTD), 4, '0'));
apex_debug.info('to_date(:DELVRDT, ''DD-MM-YYYY HH24:MI'') = ' || to_char(to_date(:DELVRDT, 'DD-MM-YYYY HH24:MI'), 'DD-MM-YYYY HH24:MI'));
apex_debug.info('to_timestamp(:DELVRDT, ''DD-MM-YYYY HH24:MI'') = ' || to_timestamp(:DELVRDT, 'DD-MM-YYYY HH24:MI'));
apex_debug.info('to_date(:DEVULDT || '' '' || lpad(:DEVULTD, 4, ''0''), ''DD-MM-YYYY HH24MI'') = ' || to_char(to_date(:DEVULDT || ' ' || lpad(:DEVULTD, 4, '0'), 'DD-MM-YYYY HH24MI'), 'DD-MM-YYYY HH24:MI'));
apex_debug.info('to_timestamp(:DEVULDT || '' '' || :DEVULTD, ''DD-MM-YYYY HH24MI'') = ' || to_timestamp(:DEVULDT || ' ' || :DEVULTD, 'DD-MM-YYYY HH24MI'));
apex_debug.info('to_timestamp(:DEVULDT || '' '' || lpad(:DEVULTD, 4, ''0''), ''DD-MM-YYYY HH24MI'') = ' || to_timestamp(:DEVULDT || ' ' || lpad(:DEVULTD, 4, '0'), 'DD-MM-YYYY HH24MI'));

image.pngimage.png
When not using the format mask, LPAD is working as expected however, the values are not formatted how we want:
image.pngimage.pngimage.png
Any chance this is a bug? Or am I missing something here?

Kind regards,
Indy Maat

Comments

Processing

Post Details

Added on Dec 21 2021
0 comments
138 views