我如何 "Clean" 从 sqlplus 查询输出?

How can i "Clean" output from sqlplus query?

我有一个简单的查询,我只需要其中的一个值 = VALID

查询是:

select 'VALUE('||status||')' as value from user_indexes where index_name = '&1';

但我已经进去了:

C:\Program Files\zabbix\bin\win64\oracle>sqlplus -s @"C:\Program Files\zabbix\bi
n\win64\oracle\conn2.sql" OLAPTABLEVELSID
old   1: select status from user_indexes where index_name = '&1'
new   1: select status from user_indexes where index_name = 'OLAPTABLEVELSID'
VALID

旧字符串和新字符串是什么?我怎样才能关闭它?

谢谢。

SET VERIFY OFF 应该能帮到你。请在查询前在您的脚本中添加这样的行。

在 sqplus 中你有替换变量。它们由 & 或 &&

引用

当您 运行 您的脚本并传递它时 'OLAPTABLEVELSID' - 查询采用 '&1' 并将其替换为 ''OLAPTABLEVELSID'

SQL*Plus 在输出中告诉你

SQL> set verify off
SQL> select '&1' from dual;
Enter value for 1: hello Whosebug

'HELLOWhosebug
-------------------
hello Whosebug
SQL>