Oracle function always returning null

Posted by JavaRocky on Stack Overflow See other posts from Stack Overflow or by JavaRocky
Published on 2010-05-23T23:27:20Z Indexed on 2010/05/23 23:30 UTC
Read the original article Hit count: 221

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about function