Hi I am working in Postgres. I have below code
DO $$
DECLARE
item integer;
begin
item:=5;
DROP TABLE IF EXISTS temp_data;
CREATE temp TABLE temp_data AS
select current_timestamp + interval '1 day' as op;
END $$;
select * from temp_data;
In the above code in the Text ‘1 Day’ I would like to replace 1 with variable item. Can someone please help me? Thanks
2
Answers
you can concat value with item variable
Intervals overload the multiplication operator with
DOUBLE PRECISION
(thatINT
can be autocast to):