## RVY_ARELTODATE

Doc
Details
Grants
References
Dependencies
Code

TEXT
    FUNCTION RVY_ARELTODATE(ANNEE_CIVILE NUMBER, SEMAINE NUMBER, JOUR NUMBER, HEURE VARCHAR) RETURN DATE IS
    BEGIN
       RETURN TO_DATE(TO_CHAR(greatest(trunc(to_date(ANNEE_CIVILE||'-01-01','RRRR-MM-DD'),'IW')+(SEMAINE-(
          CASE ANNEE_CIVILE
             WHEN 2011 THEN 1
             WHEN 2013 THEN 1
          ELSE 0 END))*7,to_date(ANNEE_CIVILE||'-01-01','RRRR-MM-DD'))+JOUR,'RRRR-MM-DD')||REPLACE(HEURE,'h',':'),'RRRR-MM-DD HH24:MI');
    EXCEPTION
       WHEN OTHERS THEN
          RETURN SYSDATE;
    END;