I can't get this function to behave as i desire. Can anyone point out why it always returns null instead of CURRENT_TIMESTAMP?
CREATE OR REPLACE FUNCTION nowts RETURN TIMESTAMP IS
vTimestamp TIMESTAMP;
BEGIN
SELECT type_date
INTO vTimestamp
FROM param_table
WHERE param_table = 3
AND exists (
SELECT *
FROM param_table
WHERE param_table = 2
);
IF vTimestamp IS NULL THEN
vTimestamp := CURRENT_TIMESTAMP;
END IF;
return vTimestamp;
END nowts;
Right now there is nothing in the table named param_table.