0

我正在尝试让 SQL*Plus 在其输出文件中写入进度,该文件应该可以作为报告呈现,即没有应用程序原生的不良格式。特别是,我想摆脱每行似乎都以 SQL> 开头的 SQL>。这是我调用 sqlplus 的 shell 脚本:

#!/usr/bin/ksh

$ORABIN/sqlplus $ORADBUSER/$ORADBPASSWD@$ORADB<<!!>./orclTest.log

SELECT 'IN sqlplus' AS MESSAGE1 FROM dual;


VARIABLE rowCnt number;
BEGIN
SELECT COUNT(*) INTO :rowCnt FROM dual;
END;
/

SELECT 'Dual has ' || :rowCnt || ' rows' AS MESSAGE2 FROM  dual;


!!

当我运行它时,这是我在 orclTest.log 中得到的:

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Oct 22 18:06:02 2012

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> SQL>
MESSAGE1 
----------
IN sqlplus

SQL> SQL> SQL> SQL>   2    3    4
PL/SQL procedure successfully completed.

SQL> SQL>
MESSAGE2
------------------------------------------------------
Dual has 1 rows

告诉 sqlplus 不要给我它的标准格式的任何方法,比如标题和前缀,并且只输出:

MESSAGE1 
----------
IN sqlplus


MESSAGE2
------------------------------------------------------
Dual has 1 rows
4

1 回答 1

3

如果你想省略SQL>提示

 set sqlprompt ''

如果要删除打印的数字以表示多行语句中的后续行

set sqlnumber off
于 2012-10-22T22:22:50.337 回答