[Oracle]Sqlplus 中使用 new_value
发布时间:2020-12-12 13:35:50 所属栏目:百科 来源:网络整理
导读:通过再sqlplus 中使用 new_value,可以把从表中查询出来的值,放置到 变量中。 然后使用变量时,类似与宏定义一样,就可以像使用表中字段一样方便。 这使得sqlplus 的脚本具备和pl/sql 类似的能力,方便监控和诊断程序的编写。 下面是一个小例子,通过 new_v
通过再sqlplus 中使用 new_value,可以把从表中查询出来的值,放置到 变量中。 col? opt_mode_val new_value my_opt_mode_val noprintselect?? value???? opt_mode_valfrom?? v$parameterwhere?? name = ‘optimizer_mode‘;SQL> select ‘The current optimizer mode is ‘||‘&&my_opt_mode_val‘ from dual;old?? 1: select ‘The current optimizer mode is ‘||‘&&my_opt_mode_val‘ from dualnew?? 1: select ‘The current optimizer mode is ‘||‘ALL_ROWS‘ from dual‘THECURRENTOPTIMIZERMODEIS‘||‘ALL_ROWS--------------------------------------The current optimizer mode is ALL_ROWSSQL> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |