ANTON KADACH

Generation

text to sql syntaxTue, 17 Jan 2023

Функция plpgsql с циклом по таблице change_request

create or replace function change_request() returns void as $$ DECLARE r record; BEGIN for r in select * from change_request loop execute format('ALTER TABLE %I ADD COLUMN %I %s', r.table_name, r.column_name, r.column_type); end loop; END $$ language plpgsql;

Questions about programming?Chat with your personal AI assistant