PostgreSQL Create Table With Dynamic Table Name

fazliakca

Fazlı Akça

Posted on November 7, 2023

PostgreSQL Create Table With Dynamic Table Name
DO
$$
BEGIN
    EXECUTE 'create table zz_find_entity'  ||  TO_CHAR(CURRENT_TIMESTAMP,'YYYYMMDD_HH24MISS') || ' AS  select * from find_entity';
END
$$;

Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
fazliakca
Fazlı Akça

Posted on November 7, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related