Good day!
More work notes.
There was a need to update the data on the IP addresses of the database servers on the objects.
Those. Based on the result of the SELECT, perform an UPDATE on another table.
We will use the EXECUTE BLOCK construct:
- execute block
- as
- declare term_id int; -- № терминала
- declare adr varchar(20); -- IP адрес пк с базой
- begin
- FOR
- -- Выбираем IP адреса
- select a.terminal_id, a.ip_addr from app_version a
- group by a.terminal_id, a.ip_addr
- -- в эти переменные
- into :term_id, :adr
- do
- begin
- -- Изменяем другую таблицу
- update connections c set c.server_name = :adr where c.terminal_id = :term_id;
- end
- suspend;
- end