Thursday, February 21, 2019

How to convert number to time format in oracle sql

SQL> variable x number
SQL> exec :x := 123456

PL/SQL procedure successfully completed.

SQL> select lpad(substr(to_char(:x),1,length(to_char(:x))-4),2,'0')||':'||
  2  substr(to_char(:x),-4,2)||':'||
  3  substr(to_char(:x),-2)
  4  from dual;

LPAD(SUBSTR(TO_CHAR(:X),1,
--------------------------
12:34:56

No comments:

Post a Comment

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...