create or replace package body rxc_date as function convert(rxcdate varchar2, rxctime varchar2 default '000000') return date is temp_time varchar2(6); begin /* Any dates and times coming in are expected to be good full dates and times or good partial dates and times. Anything else will cause a run-time error. This is guaranteed because procedures run against values from value_text, not exception_value_text. */ if length(rxcdate) = 8 then /* A full date was specified */ /* At this point, rxctime can be zero, four or six digits. (Rxctime is null if a null is passed in as the second argument to this function. The default value only applies if no second argument has been specified.) If there are only four, append 00 as seconds */ if rxctime is null then temp_time := '000000'; else if length(rxctime) = 4 then temp_time := rxctime || '00'; else temp_time := rxctime; end if; end if; /* Do the conversion: */ return to_date(rxcdate||temp_time,'YYYYMMDDHH24MISS'); else return null; end if; end convert;end rxc_date;