sqlplus中可以通过控制echo的开关来停止关闭脚本执行中的显示过程
在sqlplus中执行sql脚本有三种形式
1. start sql
2. @sql
3. @@sql
echo设置默认关闭,关闭状态下的脚本执行只有结果,不显示执行过程
SQL> show echo
echo OFF
SQL> host cat /tmp/select.sql
select * from bonus where sal = 99;
-- truncate table bonus;
/*
begin
for i in 1 .. 100
loop
insert into bonus values('yumeng','yumeng',i,i);
end loop;
commit;
end;
/
*/
select count(*) from bonus;
SQL> start /tmp/select
ENAME JOB SAL COMM
---------- --------- ---------- ----------
yumeng yumeng 99 99
COUNT(*)
----------
100
将echo开启后,运行脚本时将显示执行命令
SQL> set echo on
SQL> show echo
echo ON
SQL> @@/tmp/select
SQL> select * from bonus where sal = 99;
ENAME JOB SAL COMM
---------- --------- ---------- ----------
yumeng yumeng 99 99
SQL>
SQL> -- truncate table bonus;
SQL>
SQL> /*
SQL> begin
SQL> for i in 1 .. 100
SQL> loop
SQL> insert into bonus values('yumeng','yumeng',i,i);
SQL> end loop;
SQL> commit;
SQL> end;
SQL> /
SQL> */
SQL>
SQL> select count(*) from bonus;
COUNT(*)
----------
100