Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想以数组的形式传递一堆更新查询pl/pgsql作为参数,我需要执行这些sql更新查询。有可能吗?请帮助我摆脱困境。
pl/pgsql
sql
传入数组并不难。生成一个带引号的 csv 查询列表,用{}大括号括起来并将其作为绑定参数传递。例如....
{}
{"UPDATE foo SET bar = 1 where baz = 1","alter table foo add foobar int","drop database critical_prodiction_database"}
然后将其作为text[]参数传入。
text[]