CREATE OR REPLACE FUNCTION is_dates (parmin VARCHAR2) RETURN NUMBER IS val DATE; BEGIN val := TO_DATE (NVL (parmin,'a'),'yyyy-MM-dd'); RETURN 1; EXCEPTION WHEN OTHERS THEN RETURN 0;
使用: select is_dates(to_char(sysdate,'yyyy-MM-dd')) from dual
CREATE OR REPLACE FUNCTION is_dates (parmin VARCHAR2) RETURN NUMBER IS val DATE; BEGIN val := TO_DATE (NVL (parmin,'a'),'yyyy-MM-dd'); RETURN 1; EXCEPTION WHEN OTHERS THEN RETURN 0;
使用: select is_dates(to_char(sysdate,'yyyy-MM-dd')) from dual