Examples for validating dates in plsql

by  |  01-Jun-2016 14:16

examples for validating dates in plsql-11examples for validating dates in plsql-53examples for validating dates in plsql-80

It seems REALLY basic, but it won't go for reasons that I do not understand.

(I've included the procedures) ERROR at line 1: ORA-01898: too many precision specifiers ORA-06512: at "DOGFISH. TEST_PROC", line 5 ORA-06512: at line 1 create or replace FUNCTION check_date_func (in_date in date) RETURN BOOLEAN IS l_date date; l_today boolean; BEGIN l_date := trunc(in_date,'DD-MON-YY'); IF trunc(new_time(SYSDATE,'CDT','PDT'),'DD-MON-YY') = l_date THEN l_today := true; ELSE l_today := false; END IF; return l_today; END check_date_func; / create or replace procedure test_proc IS BEGIN if check_date_func(sysdate) then htp.prn('check_date_func = true'); else htp.prn('false'); end if; END test_proc; / Please, I am a very frustrated beginnner who cannot find help on any of the newsgroups. You are giving TRUNC a format mask -- one that you might use on a date with the to_char() function (eg: given a date and the format mask dd-mon-yy, it will format the 7 byte binary date into that character string).

Here goes again (I know it's simple, but it's killing me right now) I am accepting 3 values from a form on a web page - day(1), month('JAN') and year(2000) - and I need to convert them to a date, and check them against the server's date, to ensure that the date supplied is the current date (minus 2 hours, as I need to use pacific coast time) If the date is current, the information will be processed, if not, the form will be re-posted with the information asking the user to choose the current date.

I have simplified my procedures as much as possible for debugging purposes, but they still give me the following error message.

I need to validate the date and check that it is in the right format. = 'YYYY/MM/DD') THEN raise_application_error (-20093,' Date not valid'); END IF; v DATE := TO_DATE(pdate, 'yyyymmdd'); IF (pdate !

Community Discussion