发布新记录时,我希望从表A(主表)更新表B。 表数据是相同的,只是转储到表B以保持更多的数据量。
我正在为此编写存储过程,下面是我所拥有的,但是在begin语句中抛出错误
ID列是此处的唯一标识符。 DB是PostgreSQL
create or replace procedure proc 1 ()
as
begin
INSERT into table B (Col1, Col2, Col3, etc)
select (Col1, Col2, Col3, etc) from table A
where not exists (
select (Col1, Col2, Col3, etc)
from table B
where table A.id = TableB.id
end
非常感谢您的帮助。