I have a quick thing, in my PL/SQL query I have a VARCHAR2 field for Time which has Hour & Min like 9:30 instead of 09:30. When I do SUBSTR(TIME,1,2) I get 9:
, where I need to LPAD 0 in the front and make it 09
Below is the way I did, I get the data but I need short version of this.
SELECT CASE WHEN SUBSTR('09:30',1,2) LIKE '%:%' THEN '0' || REPLACE(SUBSTR('9:30',1,2),':','')
ELSE SUBSTR('09:30',1,2) END