In PostgreSQL database I create procedure which looks like this:
CREATE OR REPLACE PROCEDURE tracker(CUSTOM_TIME VARCHAR) AS $FUNCTION$
BEGIN
UPDATE SURVEYS SET CONDITION = 3 WHERE CONDITION = 2 AND CUSTOM_TIME > END_PERIOD;
UPDATE SURVEYS SET BLOCKED = TRUE WHERE CONDITION = 2 AND CUSTOM_TIME BETWEEN START_PERIOD AND END_PERIOD;
END;
$FUNCTION$ LANGUAGE plpgsql;
When I try to start this procedure it raise error.
CALL tracker('2019-03-29 16:37:00');
Error:
SQL Error [42883]: ERROR: operator does not exist: character varying > timestamp without time zone
No operator matches the given name and argument types. You might need to add explicit type casts.
PL/pgSQL function tracker(character varying) line 3 at SQL statement
Where I make mistake?
varcharfor a date/time. Use a date/time type liketimestampfor the parametercustom_time.timestamp. Result is the same when I call procedure. Do you have any ideas?