DECLARE str Varchar(10);-- 定义一个字符串变量str BEGIN for i in 1 .. 10000000 loop -- INSERT INTO FW_TEST(NAME) VALUES('bbb' + i);DECODE('1','','',DECODE('2','','',DECODE('3','','','2'||'3'))) NVL2('1',NVL2('2',NVL2('3','2'||'3',''),''),'') SELECT DECODE('1','','',DECODE('2','','',DECODE('3','','','2'||'3'))) AS str INTO str FROM dual;-- 把查询出来的值赋值给str sys.dbms_output.put_line(str || i);-- 打印该字符串 end loop; commit; END; /
因为循环次数太多,需要在命令行首先执行SQL语句:
set serveroutput on size 10000000