database - SQL postgresql insert statement -
i have following question, example have following table:
create table "regions" (gid serial primary key, "__gid" int8, "name" varchar(20), "language" varchar(7), "population" int8); and want insert records, 1 of values "name" - 'b', sort of code have write change 'b' 'english-speaking'? done sort of trigger? have write trigger change values automatically on insert? appriciated!!!
it's update statement wish, in case:
update regions set name = 'english-speaking' name = 'b'; to put in function use like:
create or replace function insert_into_wgs() returns void $$ begin update regions set name = 'english-speaking' name = 'b'; end $$ language 'pgpsql'; then create trigger run function:
create trigger log_update after update on accounts each row when (old.* distinct new.*) execute procedure insert_into_wgs();
Comments
Post a Comment