I would like to have a variable in my query.
CREATE TEMP TABLE tmp_date_var AS SELECT
'2023-02-21'::DATE AS TargetDate;
and then I used it in my (long) query where TargetDate appears quite often.
The first run was successful, then I changed the TargetDate to be '2023-02-20', I received an Error: "ERROR: relation "tmp_date_var" already exists" and the TargetDate remains '2023-02-21'.
How can I solve it?
Thanks a lot in advance!
CREATE TEMP TABLE tmp_date_var AS SELECT '2023-02-21'::DATE AS TargetDate;