1,查询表中有多少个索引,user_temp指的是表名
select * from pg_indexes where tablename='user_temp' ;
2: 把A表中的数据插入A表中
insert ino user1 select sys_guid(),
now(),
created_by
now(),
updated_by,
remark from user1 where row_id='12345611'
3:把A表中的数据插入B中
DO $$
<<FORST_BLOCK>>
DECLARE
I RECORD;
ALLNUM_integer;
cur_itvmh_ist record;
begin
fro cur_ltvmh_list in ( select client_no as client_no from vip_remp where created_by='yu2023' and length(client_no)>11 limit 20 ) LOOP
ALL_NUM:=ALL_NUM+1;
insert into vip_sx_tem ( row_id,created_date, client_no, remark)
select (select max(row_id)+1 from vip_sx_tem,
now(),
'yu',
cur_ltvm_list.client_no,
'测试');
if ALL_NUM>=100 then
commit;
end if ;
end loop;
commit;
END FIRST_BLOCK $$;
本文展示了三个数据库操作示例:1)查询user_temp表的索引数量;2)将A表中特定行的数据复制到自身;3)使用循环从A表(VIP_remp)中选取数据并插入到B表(VIP_sx_tem)中,每100条数据提交一次事务。
7113

被折叠的 条评论
为什么被折叠?



