SQL> create or replace function f_getTime_tx (i_diff_nr NUMBER)return VARCHAR2 is
2 v_out_tx VARCHAR2(2000);
3
4 v_hr_nr NUMBER;
5 v_min_nr NUMBER;
6 v_sec_nr NUMBER;
7
8 begin
9 v_hr_nr:=trunc(i_diff_nr/(60*60));
10 v_min_nr:= trunc((i_diff_nr-v_hr_nr*60*60)/60);
11 v_sec_nr:=mod(i_diff_nr,60);
12
13 v_out_tx:=v_hr_nr||' hours '||
14 v_min_nr||' min '||v_sec_nr||' sec';
15 return v_out_tx;
16 end f_getTime_tx;
17 /
Function created.
SQL>
SQL> select f_getTime_tx(123) from dual;
F_GETTIME_TX(123)
--------------------
0 hours 2 min 3 sec
SQL>
|