'&'在sqlplusw中被定义为自定义变量标示符号

因为'&'在sqlplusw中被定义为自定义变量标示符合,因此'&'
符合后面的字符自然被解析为变量名字

 

 

set verify off
column value new_val V
define S="&1"
set autotrace off
select a.name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
The mystat2.sql script simply prints out the difference between the beginning value and
the end value of that statistic:
set verify off
select a.name, b.value V, to_char(b.value-&V,'999,999,999,999') diff
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'

你可能感兴趣的:(sql)