SQL> create or replace procedure p_split (i_date_dt DATE,o_hour OUT NUMBER, o_min OUT NUMBER)
2 is
3 begin
4 DBMS_OUTPUT.put_line(o_hour||'/'||o_min);
5 o_hour:= to_NUMBER(to_char(i_date_dt,'hh24'));
6 o_min := TO_CHAR(i_date_dt,'mi');
7 DBMS_OUTPUT.put_line(o_hour||'/'||o_min);
8 end;
9 /
Procedure created.
SQL>
SQL> declare
2 v_hour NUMBER:=12;
3 v_min NUMBER:=20;
4 begin
5 p_split(sysdate, v_hour, v_min);
6 DBMS_OUTPUT.put_line ('Total minutes:'||(v_hour*60+v_min));
7 end;
8 /
/
21/27
Total minutes:1287
PL/SQL procedure successfully completed.
SQL>
|