自己亲自使用的,绝对OK --添加数据declare i number; --用for实现 begin for i in 0 .. 500 loop insert into cust(custsn,type,code,pwd,provincecode,citycode,partycodetype,partycodevalue,partycitycode,identtype,identnum,name,brand,servicelevel,address) values(sys_guid(),'0
1.主键自增实现方法:http://www.cnblogs.com/Donnnnnn/p/5959871.html 2.for循环往Oracle中插入n条数据 BEGIN .. loop insert into S_Depart(departId,Departname,Departorder)values(S_S_Depart.Nextval,); end loop; end; 上面循环了50次 执行后,记得commit提交.....
需求 需要跑一个数据,时间从17年5月到21年3月. 代码(简单粗暴实现) DECLARE i number; BEGIN i:= 201705; WHILE i <202104 LOOP if i=201713 then i:=201801; elsif i=201813 then i:=201901; elsif i=201913 then i:=202001; elsif i=202013 then i:=202101; end if; DBMS_OUTPUT.PUT_LINE(i||':
系统上的某个接口提交数据经常超时(超过3秒),而我单独在后台数据库(Oracle)执行insert,只需要17ms.提交数据的客户端没有任何的调试日志,只能通过跟踪后台语句记录实际调用过程中的数据库执行时间.从而发现问题耗时最多的阶段. 安装dbms_support包 SQL> @?\rdbms\admin\dbmssupp.sql SQL> grant execute on dbms_support to test; 找到需要跟踪的会话,一个接口可能会建立多个会话,需要根据会话建立的时间来判
应用场景:将数据表TB_USER中字段NNDP的内容中为[sannanyinv]转换为[3男1女] 主要脚本:一个游标脚本+分割字符串函数+拼音转数字脚本 操作步骤如下: 1.创建类型 create or replace type splitTable is table of varchar2(100); 2.创建函数fn_splitString(功能是将字符串分割成多条记录)--测试语句select * from table(fn_splitString('ernanyinv','nan'))