Hi
I have a procedure which works in a similar way to the following:
PROCEDURE main (p_date_from times.id%TYPE)
l_time_from varchar2(40);
BEGIN
l_time_from:=p_date_from
IF l_time_from IS NULL THEN
l_time_from:='23:59';
ELSIF NOT regexp_replace(l_time_from,'.[0-9]{2}:.[0-9]{2}') THEN
RAISE invalid_time
END IF;
EXCEPTIONS
WHEN invalid_time THEN
dbms_output.put_line('Not a valid time');
END main;
I want to validate p_time_from parameter so that it only accepts the following format 'NN:NN' i.e. '22:31'. I've thought that using a regular expression would work within an IF statement, however as you can see my syntax is poorly constructed at best and doesn't actually work. Is there a better way of doing this??
Many thanks
Edited by: tri_harder on Dec 4, 2008 11:50 AM