PL/pgSQL Variables

PHOTO EMBED

Fri Apr 30 2021 16:47:48 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira

do $$ 
declare
   created_at time := now();
begin 
   raise notice '%', created_at;
   perform pg_sleep(10);
   raise notice '%', created_at;
end $$;
Code language: PostgreSQL SQL dialect and PL/pgSQL (pgsql)
content_copyCOPY

https://www.postgresqltutorial.com/plpgsql-variables/