小编akh*_*tty的帖子

一次更新多个值

我的任务是更新数据库中的几行。有两列,其中一列是ID,另一列是CURRENCY。我已经使用下面的更新语句更新了这些行:

update account set currency = 'INR' where id =15;
update account set currency = 'EURO' where id =12;
update account set currency = 'DOLLAR' where id =18;
update account set currency = 'Pound' where id =13; 
-- and so on.
Run Code Online (Sandbox Code Playgroud)

实际上,在这种情况下,由于行数相对较少,我可以使用这些更新语句轻松完成,但是如果有数千或数十万行怎么办?这是更新它们的唯一方法,还是有其他方法或脚本?

postgresql update

3
推荐指数
1
解决办法
5393
查看次数

查询的错误输出

使用以下查询时,我无法从 bnrcno 列中获取数据。

select 'insert into table values('||id||','||bnrcno||','||chargetype||','||domno||','||coa_id||','||liability_gl||','||revenue_gl||','||taxno||')' 
from bill_charges_map where  domno=5
Run Code Online (Sandbox Code Playgroud)

brcno列是整数类型,其中的大多数值都为空。

postgresql insert dynamic-sql

-2
推荐指数
1
解决办法
178
查看次数

标签 统计

postgresql ×2

dynamic-sql ×1

insert ×1

update ×1