最近应用开发的过程中出现了一个小问题,顺便录记一下原因和方法--命令安装
对于经常在SQL*Plus 下任务的师大们而言,是总时不时查询SQL*Plus的帮助命令。实着太多了,记不住。SQL*Plus下直接供给了help命令来帮助描述有所命令的用法。嘎嘎,再也用不查SQL*Plus reference了。对于Oracle 10g缺省情况下,SQL*Plus的help手册并没有被安装,要需手动安装。Oracle 10/11g下用采同相的安装方法,上面来描述一下help的安装与应用。
1、安装sqlplus help
system@CNMMBO> help SP2-0171: HELP system not available. robin@SZDB:~> cd $ORACLE_HOME/sqlplus/admin/help --脚本路径位于ORACLE_HOME,sqlplus/admin/hlep目录下 robin@SZDB:/users/oracle/OraHome10g/sqlplus/admin/help> ls helpbld.sql helpdrop.sql helpus.sql hlpbld.sql robin@SZDB:/users/oracle/OraHome10g/sqlplus/admin/help> head -40 hlpbld.sql -- -- Copyright (c) Oracle Corporation 1983, 2003. All Rights Reserved. -- -- NAME -- hlpbld.sql -- -- DESCRIPTION -- Builds the SQL*Plus HELP table and loads the HELP data from a -- data file. The data file must exist before this script is run. -- -- USAGE -- To run this script, connect as SYSTEM and pass the datafile to be -- loaded as a parameter e.g. -- -- sqlplus system/<system_password> @hlpbld.sql helpus.sql -- -- DEFINE DATAFILE = &1 -- -- Create the HELP table -- DROP TABLE HELP; CREATE TABLE HELP ( TOPIC VARCHAR2 (50) NOT NULL, SEQ NUMBER NOT NULL, INFO VARCHAR2 (80) ) PCTFREE 0 STORAGE (INITIAL 48K PCTINCREASE 0); GRANT SELECT ON HELP TO PUBLIC; -- -- Insert the data into HELP. -- @@&DATAFILE system@CNMMBO> @$ORACLE_HOME/sqlplus/admin/help/hlpbld.sql helpus.sql DROP TABLE HELP * ERROR at line 1: ORA-00942: table or view does not exist Table created. Grant succeeded. ... Commit complete. View dropped.
2、help手册的用法
--看查刚创立的表已添加了978行 system@CNMMBO> select count(*) from help; COUNT(*) ---------- 978 --直接在命令提示符下入输help,则给出SQL*plus help的用法:HELP|? [topic] --help index or ? index则列出了前当sqlplus下有所可用命令 system@CNMMBO> help HELP ---- Accesses this command line help system. Enter HELP INDEX or ? INDEX for a list of topics. In iSQL*Plus, click the Help button to display iSQL*Plus online help. You can view SQL*Plus resources at http://otn.oracle.com/tech/sql_plus/ and the Oracle Database Library at http://otn.oracle.com/documentation/ HELP|? [topic] --切换别的帐户来试测help是不是可用 system@CNMMBO> conn goex_admin/xxxxx Connected. --上面的试测其他帐户也可以应用,因为在创立时创立了视图其授予了其他用户select 限权 goex_admin@CNMMBO> help index Enter Help [topic] for help. @ COPY PAUSE SHUTDOWN @@ DEFINE PRINT SPOOL / DEL PROMPT SQLPLUS ACCEPT DESCRIBE QUIT START APPEND DISCONNECT RECOVER STARTUP ARCHIVE LOG EDIT REMARK STORE ATTRIBUTE EXECUTE REPFOOTER TIMING BREAK EXIT REPHEADER TTITLE BTITLE GET RESERVED WORDS (SQL) UNDEFINE CHANGE HELP RESERVED WORDS (PL/SQL) VARIABLE CLEAR HOST RUN WHENEVER OSERROR COLUMN INPUT SAVE WHENEVER SQLERROR COMPUTE LIST SET CONNECT PASSWORD SHOW --看查每个命令的详细用法 --直接在提示符下help <command> 或者 ? <command> goex_admin@CNMMBO> help define DEFINE ------ Specifies a substitution variable and assigns a CHAR value to it, or lists the value and variable type of a single variable or all variables. DEF[INE] [variable] | [variable = text] -- Author : Robinson -- Blog : http://blog.csdn.net/robinson_0612 goex_admin@CNMMBO> help accept ACCEPT ------ Reads a line of input and stores it in a given substitution variable. In iSQL*Plus, displays the Input Required screen for you to enter a value for the substitution variable. ACC[EPT] variable [NUM[BER] | CHAR | DATE | BINARY_FLOAT | BINARY_DOUBLE] [FOR[MAT] format] [DEF[AULT] default] [PROMPT text | NOPR[OMPT]] [HIDE] --有了它,再也不必为记不住的命令犯愁了。
更多参考
PL/SQL 结合数组与套嵌表
PL/SQL 变长数组
PL/SQL --> PL/SQL录记
dbms_xplan之display_cursor数函的应用
文章结束给大家分享下程序员的一些笑话语录:
联想——对内高价,补贴对外倾销的伟大“民族”企业。