SQL Plus中的?号

Posted dingdingfish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL Plus中的?号相关的知识,希望对你有一定的参考价值。

在SQL Plus中通过START,@或@@执行脚本时,脚本路径中的?号表示$ORACLE_HOME。

相关文档在SQL*Plus®User’s Guide and Reference中。

13.41.21 SET ESCCHAR的说明中:

@ in a filename will be translated to Oracle SID
? is translated to Oracle Home in Unix
% is translated to Oracle Home in Windows

以下通过一个示例来说明,下面的脚本会安装SQL Plus的帮助:

SQL> connect system
SQL> @?/sqlplus/admin/help/hlpbld.sql helpus.sql
-- 写成以下也可以
SQL> @$ORACLE_HOME/sqlplus/admin/help/hlpbld.sql helpus.sql

以上示例也说明,@和@@是认环境变量的。

然后帮助就可以用了,尽管帮助默认就是安装的:

SQL> help column

 COLUMN
 ------

 Specifies display attributes for a given column, such as:
     - text for the column heading
     - alignment for the column heading
     - format for NUMBER data
     - wrapping of column data
 Also lists the current display attributes for a single column
 or all columns.

 COL[UMN] [column | expr [option ...] ]

 where option represents one of the following clauses:
     ALI[AS] alias
     CLE[AR]
     ENTMAP ON|OFF
     FOLD_A[FTER]
     FOLD_B[EFORE]
     FOR[MAT] format
     HEA[DING] text
     JUS[TIFY] L[EFT] | C[ENTER] | R[IGHT]
     LIKE expr | alias
     NEWL[INE]
     NEW_V[ALUE] variable
     NOPRI[NT] | PRI[NT]
     NUL[L] text
     OLD_V[ALUE] variable
     ON|OFF
     WRA[PPED] | WOR[D_WRAPPED] | TRU[NCATED]

SHOW命令可以查看单个或所有参数的设置:

SQL> show escchar
escchar OFF

SQL> show all
appinfo is OFF and set to "SQL*Plus"
arraysize 15
AUTOCOMMIT ON for every 100 DML statements
autoprint OFF
autorecovery OFF
autotrace OFF
blockterminator "." (hex 2e)
btitle OFF and is the first few characters of the next SELECT statement
cmdsep OFF
colinvisible OFF
coljson OFF
colsep " "
compatibility version NATIVE
concat "." (hex 2e)
copycommit 0
COPYTYPECHECK is ON
define "&" (hex 26)
describe DEPTH 1 LINENUM OFF INDENT ON
echo OFF
editfile "afiedt.buf"
embedded OFF
errorlogging is OFF
escape OFF
escchar OFF
exitcommit ON
FEEDBACK ON for 6 or more rows SQL_ID OFF
flagger OFF
flush ON
fullcolname OFF
heading ON
headsep "|" (hex 7c)
history is OFF
instance "local"
jsonprint NORMAL
linesize 80
lno 5584
loboffset 1
lobprefetch 0
logsource ""
long 80
longchunksize 80
markup html OFF HEAD "<style type='text/css'> body font:10pt Arial,Helvetica,sans-serif; color:black; background:White; p font:10pt Arial,Helvetica,sans-serif; color:black; background:White; table,tr,td font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; th font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px; h1 font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
 h2 font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt; a font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PREFORMAT OFF
markup CSV OFF DELIMITER , QUOTE ON
newpage 1
null ""
numformat ""
numwidth 10
pagesize 14
PAUSE is OFF
pno 1
recsep WRAP
recsepchar " " (hex 20)
release 2103000000
repfooter OFF and is NULL
repheader OFF and is NULL
rowlimit OFF
rowprefetch 1
securedcol is OFF
serveroutput OFF
shiftinout INVISIBLE
showmode OFF
spool OFF
sqlblanklines OFF
sqlcase MIXED
sqlcode 0
sqlcontinue "> "
sqlnumber ON
sqlpluscompatibility 21.0.0
sqlprefix "#" (hex 23)
sqlprompt "SQL> "
sqlterminator ";" (hex 3b)
statementcache is 0
suffix "sql"
tab ON
termout ON
timing OFF
trimout ON
trimspool OFF
ttitle OFF and is the first few characters of the next SELECT statement
underline "-" (hex 2d)
USER is "SYSTEM"
verify ON
wrap : lines will be wrapped
xmloptimizationcheck OFF

以上是关于SQL Plus中的?号的主要内容,如果未能解决你的问题,请参考以下文章

SQL PLUS 使用小技巧

Shell 脚本中的 SQL* PLUS 连接问题

如何从 SQL *PLUS 中的批量插入中查找失败的插入语句

shell脚本中的SQL*Plus的环境变量

sql*plus 中的 DEFINE_EDITOR=vi

读书笔记:SQL 查询中的SQL*Plus 替换变量(DEFINE变量)和参数