Oracle 打印解释计划
declare b1 date; begin execute immediate 'alter session set statistics_level=ALL'; b1 := sysdate - 1; for test in ( /*业务SQL(sql后面不需要加";")*/ select nvl(abs(sum(bin_box_num)),0) from bin_mstr where 1=1 and 'KPOL23060001' = bin_nbr ) loop null; end loop; for x in (select p.plan_table_output from table(dbms_xplan.display_cursor(null, null, 'advanced -bytes -PROJECTION allstats last')) p) loop dbms_output.put_line(x.plan_table_output); end loop; rollback; end;
打印解释计划,进行SQL调优。
与你共亲到无可亲密时,便知友谊万岁是尽头。