Return Date got no hour and minutes returned

前端 未结 1 1873
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 07:48

This is my code

CREATE OR REPLACE FUNCTION GET_DATE(P_DAYS IN  NUMBER) RETURN DATE AS
  V_DATE DATE;
BEGIN
  V_DATE := SYSDATE+P_DAYS;
  DBMS_OUTPUT.PUT         


        
1条回答
  •  粉色の甜心
    2021-01-29 08:21

    I think you need to do something like this:

    CREATE OR REPLACE FUNCTION GET_DATE(p_days IN NUMBER) RETURN VARCHAR2 AS
        v_date VARCHAR2(30);
    BEGIN
        v_date := TO_CHAR(SYSDATE + p_days, 'YYYY-MM-DD HH24:MI:SS');
        RETURN v_date;
    END;
    /
    

    0 讨论(0)
提交回复
热议问题