Home

SQL*Plus User`s Guide and Reference, Release 9.2

image

Contents

1. Convention Meaning Example lowercase Lowercase typeface indicates SELECT last_name employee_id FROM programmatic elements that you supply employees For example lowercase indicates names lpl hr Jora of tables columns or files SAJ PAUS YORTER ZAMR CREATE USER mjones IDENTIFIED BY Note Some programmatic elements use a t Mb mixture of UPPERCASE and lowercase Y f Enter these elements as shown Conventions for Windows Operating Systems The following table describes conventions for Windows operating systems and provides examples of their use Convention Meaning Example Choose Start gt How to start a program To start the Oracle Database Configuration File and directory names QN xxvi Assistant choose Start Programs Oracle HOME NAME Configuration and Migration Tools Database Configuration Assistant File and directory names are not case c winnt system32 is the same as sensitive The following special characters C WINNTNSYSTEM32 are not allowed left angle bracket right angle bracket gt colon double quotation marks slash pipe 1 and dash The special character backslash is treated as an element separator even when it appears in quotes If the file name begins with then Windows assumes it uses the Universal Naming Convention Represents the Windows command C oracle oradata gt prompt of the current hard disk drive
2. Note For this feature a PL SQL block is regarded as one transaction regardless of the actual number of SQL commands contained within it To turn the autocommit feature off again enter the following command SET AUTOCOMMIT OFF To confirm that AUTOCOMMIT is now set to OFF enter the following SHOW command SHOW AUTOCOMMIT AUTOCOMMIT OFF For more information see the AUTOCOMMIT variable of the SET command on page 13 95 Stopping a Command while it is Running Suppose you have displayed the first page of a 50 page report and decide you do not need to see the rest of it Press Cancel the system s interrupt character which is usually CTRL C SQL Plus stops the display and returns to the command prompt In iSQL Plus click the Cancel button Note Pressing Cancel does not stop the printing of a file that you have sent to a printer with the OUT clause of the SQL Plus SPOOL command You will learn about printing query results in Chapter 7 Formatting SQL Plus Reports You can stop the printing of a file through your operating system For more information see your operating system s installation and user s guide Running Host Operating System Commands You can execute a host operating system command from the SOL Plus command prompt This is useful when you want to perform a task such as listing existing host operating system files 5 12 SQL Plus User s Guide and Reference Listing a Table Definit
3. ame Null Type EMPLOYEE ID NOT NULL NUMBER 6 JOB ID NOT NULL VARCHAR2 10 AANAGER ID NUMBER 6 DEPARTMENT ID NUMBER 4 LOCATION ID NUMBER 4 COUNTRY ID CHAR 2 FIRST NAME VARCHAR2 20 LAST NAME NOT NULL VARCHAR2 25 SALARY NUMBER 8 2 COMMISSION PCT NUMBER 2 2 DEPARTMENT NAME NOT NULL VARCHAR2 30 JOB TITLE NOT NULL VARCHAR2 35 CITY NOT NULL VARCHAR2 30 STATE PROVINCE VARCHAR2 25 COUNTRY NAME VARCHAR2 40 REGION NAME VARCHAR2 25 Unlocking the Sample Tables The Human Resources HR Sample Schema is installed as part of the default Oracle9i installation The HR user is locked by default You need to unlock the HR tables and user before you can use the HR sample schema To unlock the HR tables and user log in as the SYSTEM user and enter the following command ALTER USER HR IDENTIFIED BY your password ACCOUNT UNLOCK SQL Plus Overview 1 7 Oracle9i Sample Tables and SQL Plus For further information about unlocking the HR tables and login see the Oracle9i Sample Schemas guide The HR user is primarily to enable you to access the HR sample schema and is necessary to enable you to run the examples in this guide Each table in the database is owned by a particular user You may wish to have your own copies of the sample tables to use as you try the examples in this guide To get your own copies of the HR tables see your DBA or see the Oracle9i Sample Schemas guide or you can create the
4. Example 6 14 Prompting for and Accepting Input To direct the user to supply a report title and to store the input in the variable MYTITLE for use in a subsequent query first clear the buffer CLEAR BUFFER Next set up a script as shown and save this file as PROMPTI INPUT 4 PROMPT Enter a title of up to 30 characters 5 ACCEPT MYTITLE PROMPT Title 6 TTITLE LEFT MYTITLE SKIP 2 7 SELECT EMPLOYEE ID FIRST NAME LAST NAME SALARY 8 FROM EMP DETAILS VIEW 9 WHERE JOB ID SA MAN 10 SAVE PROMPT1 Created file PROMPT1 sql The TTITLE command sets the top title for your report For more information about the TTITILE command see Defining Page and Report Titles and Dimensions on page 7 23 Finally run the script responding to the prompt for the title as shown START PROMPT1 Enter a title of up to 30 characters Title Department Report Department Report EMPLOYEE ID FIRST NAME LAST NAME SALARY 145 John Russell 14000 146 Karen Partners 13500 147 Alberto Errazuriz 12000 148 Gerald Cambrault 11000 149 Eleni Zlotkey 10500 Before continuing turn the TTITLE command off TTITLE OFF 6 28 SQL Plus User s Guide and Reference Writing Interactive Commands E Customizing Prompts for Substitution Variable If you want to customize the prompt for a substitution variable value use PROMPT and ACCEPT in conjunction with the substitution variable as shown in the following example Example
5. Name Null Type EMPLOYEE ID NOT NULL NUMBER 6 JOB ID NOT NULL VARCHAR2 10 AANAGER ID NUMBER 6 DEPARTMENT ID NUMBER 4 LOCATION ID NUMBER 4 COUNTRY ID CHAR 2 FIRST NAME VARCHAR2 20 LAST NAME NOT NULL VARCHAR2 25 SALARY NUMBER 8 2 COMMISSION PCT NUMBER 2 2 DEPARTMENT NAME NOT NULL VARCHAR2 30 JOB TITLE NOT NULL VARCHAR2 35 CITY NOT NULL VARCHAR2 30 STATE PROVINCE VARCHAR2 25 COUNTRY NAME VARCHAR2 40 REGION NAME VARCHAR2 25 To format EMP DETAILS VIEW so that the output displays with indentation and line numbers use the SET DESCRIBE command as follows SET DESCRIBE DEPTH 2 LINENUM ON INDENT ON 13 106 SQL Plus User s Guide and Reference SET To display the above settings enter DESCRIBE EMP_DETAILS_VIEW um ame Null Type 1 EMPLOYEE ID NOT NULL NUMBER 6 2 JOB ID NOT NULL VARCHAR2 10 3 ANAGER ID NUMBER 6 4 DEPARTMENT ID NUMBER 4 5 LOCATION ID NUMBER 4 6 COUNTRY ID CHAR 2 7 FIRST NAME VARCHAR2 20 8 LAST NAME NOT NULL VARCHAR2 25 9 SALARY NUMBER 8 2 10 COMMISSION PCT NUMBER 2 2 11 DEPARTMENT NAME NOT NULL VARCHAR2 30 12 JOB TITLE NOT NULL VARCHAR2 35 13 CITY NOT NULL VARCHAR2 30 14 STATE PROVINCE VARCHAR2 25 15 COUNTRY NAME VARCHAR2 40 16 REGION NAME VARCHAR2 25 SET ECHO ON OFF Controls whether the START command lists each command in a script as the command is executed ON lists the commands OFF suppresses th
6. username password G connect string NOLOG start Q9 URL filename ext lt parameter gt Cause A SQL Plus command option was invalid Action Check the syntax for The SOLPLUS Command on page 4 3 for the correct usage SP2 0423 Illegal GET command Cause An invalid option was used in the GET command Action Check the syntax of the command you used for the correct options SP2 0425 value is not a valid number Cause The value entered in the ACCEPT command was not a number Action Enter a valid number SP2 0426 Input truncated to number of characters characters Cause There was no carriage return at the last line of the SOL statement Action Insert a carriage return SP2 0450 Usage WHENEVER SOLERROR CONTINUE COMMIT ROLLBACK NONE EXIT SUCCESS FAILURE WARNING n variable bindvariable COMMIT ROLLBACK Cause An option to WHENEVER SOLERROR was invalid in SQL Plus Action Specify a valid option 14 18 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0453 Usage WHENEVER OSERROR CONTINUE COMMIT ROLLBACK NONE EXIT SUCCESS FAILURE WARNING n variable lt bindvariable gt OSCODE COMMIT ROLLBACK Cause An option to WHENEVER OSERROR was invalid in SOL Plus Action Specify a valid option SP2 0480 A missing FROM or TO clause uses the current SOL Plus connection Usage COPY FROM lt db gt
7. If multiple COMPUTE commands reference the same column in the ON clause only the last COMPUTE command applies To reference a SOL SELECT expression or function reference in an ON clause place the expression or function reference in quotes Column names and aliases do not need quotes Enter COMPUTE without clauses to list all COMPUTE definitions In order for the computations to occur the following conditions must all be true One or more of the expressions columns or column aliases you reference in the OF clause must also be in the SELECT command a The expression column or column alias you reference in the ON clause must occur in the SELECT command and in the most recent BREAK command a Ifyou reference either ROW or REPORT in the ON clause also reference ROW or REPORT in the most recent BREAK command To remove all COMPUTE definitions use the CLEAR COMPUTES command Note that if you use the NOPRINT option for the column on which the COMPUTE is being performed the COMPUTE result is also suppressed To subtotal the salary for the account manager AC MGR and salesman SA_ MAN job classifications with a compute label of TOTAL enter BREAK ON JOB ID SKIP 1 COMPUTE SUM LABEL TOTAL OF SALARY ON JOB ID SELECT JOB ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE JOB ID IN AC MGR SA MAN ORDER BY JOB ID SALARY JOB ID LAST NAME SALARY AC MGR Higgins 12000 TORTIE RY pt al Ge a ec TOTAL 12000
8. The HTTP protocol connection between the web browser and the Oracle HTTP Server a The Oracle Net connection between the iSQL Plus Server in the Oracle HTTP Server and Oracle9i It is useful to note that in iSQL Plus you cannot access the middle tier operating system to run commands such as HOST EDIT and SPOOL which depend on operating system access In iSQL Plus security for the connection between the web browser and the Oracle HTTP Server is provided by standard HTTPS which is fully supported by Oracle It enables secure listener connections with an Oracle provided encryption mechanism via the Secure Sockets Layer SSL It can be implemented when installing the Oracle HTTP Server by installing the mod_ss module For detailed information about implementing HTTPS security in Oracle see the Oracle Advanced Security Administrator s Guide The Oracle Net connection between the iSQL Plus Server and Oracle9i provides the same security as in previous client server architectures For more information about Oracle Net connection security see the Oracle9i Net Services Administrator s Guide and the Oracle Advanced Security Administrator s Guide Administration Privileges There are three modes of access to iSQL Plus Connect as a normal user Requires an Oracle Database account username and password entered in the iSQL Plus Login screen Connect as a SYSDBA or SYSOPER privileged user Requires an Oracle Database account usern
9. DCL See Data Control Language DCL DDL See Data Definition Language DDL default A clause or option value that SQL Plus uses if you do not specify an alternative default database See local database directory On some operating systems a named storage space for a group of files It is actually one file that lists a set of files on a particular device dismounted database A database that is not mounted by any instance and thus cannot be opened and is not currently available for use display format See format display width The number of characters or spaces allowed to display the values for an output field Glossary 9 Glossary 10 DML See Data Manipulation Language DML DUAL table A standard Oracle database table named DUAL which contains exactly one row The DUAL table is useful for applications that require a small dummy table the data is irrelevant to guarantee a known result such as true editor A program that creates or modifies files end user The person for whom a system is being developed for example an airline reservations clerk is an end user of an airline reservations system See also SQL Plus error message A message from a computer program for example SOL Plus informing you of a potential problem preventing program or command execution expression A formula such as SALARY COMMISSION used to calculate a new value from existing values An expressi
10. PLAN_PLUS_EXP Shows each step of the report OBJECT_NODE_PLUS_EXP Shows database links or parallel query servers used Tuning SQL Plus 9 3 Tracing Statements Statistics The format of the columns may be altered with the COLUMN command For example to stop the PARENT_ID_PLUS_EXP column being displayed enter COLUMN PARENT_ID_PLUS_EXP NOPRINT The default formats can be found in the site profile for example glogin sql The Execution Plan output is generated using the EXPLAIN PLAN command For information about interpreting the output of EXPLAIN PLAN see the Oracle9i Database Performance Tuning Guide and Reference The statistics are recorded by the server when your statement executes and indicate the system resources required to execute your statement The client referred to in the statistics is SQL Plus Oracle Net refers to the generic process communication between SQL Plus and the server regardless of whether Oracle Net is installed You cannot change the default format of the statistics report The results include the following statistics For a more complete list of database statistics see the Oracle9i Database Reference For more information about the statistics and how to interpret them see the Oracle9i Database Performance Tuning Guide and Reference Database Statistic Name Description recursive calls Number of recursive calls generated at both the user and system level Oracle maintains tables
11. Table A 1 SQL Plus Limits Item Limit filename length username length user variable name length user variable value length command line length length of a LONG value entered through SQL Plus LINESIZE LONGCHUNKSIZE value output line size line size after variable substitution number of characters in a COMPUTE command label number of lines per SOL command maximum PAGESIZE total row width maximum ARRAYSIZE maximum number of nested scripts maximum page number maximum PL SQL error message size maximum ACCEPT character string length maximum number of DEFINE variables system dependent 30 bytes 30 bytes 240 characters 2500 characters LINESIZE value system dependent system dependent system dependent 3 000 characters internal only 500 characters 500 assuming 80 characters per line 50 000 lines 60 000 characters for VMS otherwise 32 767 characters 5000 rows 20 for VMS CMS Unix otherwise 5 99 999 2K 240 Bytes 2048 A 2 SQL Plus User s Guide and Reference B SQL Plus COPY Command This appendix discusses the following topics COPY Command Syntax Copying Data from One Database to Another Copying Data between Tables on One Database Read this chapter while sitting at your computer and try out the example shown Before beginning make sure you have access to the sample tables described in Chapter 1 SQL Plus Overview The COPY command w
12. The COPY command behaves differently based on whether the destination table already exists and on the action clause you enter CREATE in the example above For more information see Controlling Treatment of the Destination Table later in this chapter By default the copied columns have the same names in the destination table that they have in the source table If you want to give new names to the columns in the destination table enter the new names in parentheses after the destination table name If you enter any column names you must enter a name for every column you are copying Note To enable the copying of data between Oracle and non Oracle databases NUMBER columns are changed to DECIMAL columns in the destination table Hence if you are copying between Oracle databases a NUMBER column with no precision will be changed to a DECIMAL 38 column When copying between Oracle databases you should use SQL commands CREATE TABLE AS and INSERT or you should ensure that your columns have a precision specified The USING clause specifies a query that names the source table and specifies the data that COPY copies to the destination table You can use any form of the SQL SELECT command to select the data that the COPY command copies Here is an example of a COPY command that copies only two columns from the source table and copies only those rows in which the value of DEPARTMENT_ID is 30 COPY FROM HR your_password BOSTON
13. Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0103 Nothing in SOL buffer to run Cause Nothing was in the SQL buffer to run Action Enter a valid SQL command SP2 0105 Illegal or missing entity name Cause File name was not specified in the GET or SAVE commands Action Specify a file name and try again SP2 0107 Nothing to save Cause Nothing in the SQL buffer when attempting to save the content to a file Action Enter a SOL command to save SP2 0108 The names CREATE REPLACE APPEND and abbreviations may not be used Cause The file name specified was the word file Action Put the name in single quotes SQL Plus Error Messages 14 7 SQL Plus Error Messages SP2 0109 Cannot append to file file_name Cause An attempt was made to append the content of the SOL buffer to a file and the file could not be written Possible causes Anerror was encountered when creating the destination file a A directory name specified in the SAVE statement was not found a A system error made it impossible to open the file Action Take the following actions a Check that the destination is valid and that there is sufficient space on the destination device a Check the statement for a typing mistake in the directory name Then issue the statement again after correcting the directory name SP
14. Action No action possible SPOOL OUT has been disabled possibly because of lack of printing support at the operating system level SP2 0332 Cannot create spool file Cause Possible causes Insufficient privileges to create a file a A system error made it impossible to create a file Action Take the following actions Change privileges to allow creation of the file Consult the operating system documentation or contact the System Administrator 14 16 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0333 Illegal spool file name spool name bad character character_name Cause An invalid filename was entered in the SPOOL command Action Correct the filename and re enter SP2 0341 Line overflow during variable substitution number of characters characters at line line number Cause The maximum number of characters was exceeded in the SOL buffer after the substitution variable was expanded Action Reduce the length in the substitution variable and try again SP2 0357 Out of temporary storage Cause Unable to allocate memory while trying to run the command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0359 Memory exhausted Cause Unable to allocate memory while trying to run the command Action Free up additional memory by closing applications not
15. Action No action required SQL Plus Error Messages 14 21 SQL Plus Error Messages SP2 0547 option name option value out of range lower value through upper_ value Cause The specified SET option was out of range Action Enter a value within the SET option range and re try the SET command SP2 0548 Usage VAR IABLE lt variable gt NUMBER CHAR CHAR n CHAR I BYTE VARCHAR2 n CHARIBYTE NCHAR NCHAR n INVARCHAR n CLOB NCLOB REFCURSOR Cause Incorrect syntax for the VARIABLE command was entered Action Check the syntax of the VARIABLE command for the correct usage SP2 0549 Usage PRINT lt variable gt Cause Incorrect syntax for the PRINT command was entered Action Check the syntax of the PRINT command for the correct usage SP2 0550 Usage SHOW ERRORS FUNCTION PROCEDURE PACKAGE PACKAGE BODY TRIGGER VIEW TYPE TYPE BODY JAVA SOURCE JAVA CLASS schema name Cause Incorrect syntax for the SHOW ERRORS command was entered Action Check the syntax of the SHOW ERRORS command for the correct options SP2 0552 Bind variable variable name not declared Cause The specified bind variable was not declared Action Run the VARIABLE command to check that the bind variables you used in your SQL statement exist Before running a SQL statement with bind variables you must use the VARIABLE command to declare each variable SP2 0556 Invalid file name Cause Missing file n
16. An Oracle database may not always be available to all users To open or close a database or to start up or shut down an instance you must have DBA privileges or be connected as SYSOPER or SYSDBA Other users cannot change the current status of an Oracle database You cannot use STARTUP or SHUTDOWN to start or stop Oracle instances on Oracle7 servers Database Startup Starting a database involves three steps 1 Starting an instance An instance controls the background processes and the allocation of memory area to access an Oracle database 2 Mounting the database Mounting the database associates it with a previously started instance 3 Opening the database Opening the database makes it available for normal database operations For more information about database startup see the Oracle9i Database Concepts guide For information about the STARTUP command see Chapter 13 SOL Plus Command Reference 11 2 SQL Plus User s Guide and Reference Introduction to Database Startup and Shutdown Example 11 1 Starting an Instance To start an Oracle instance without mounting the database enter STARTUP NOMOUNT Example 11 2 Mounting the Database To start an instance mount the database but leave the database closed enter STARTUP MOUNT Example 11 3 Opening the Database To start an instance using the Oracle9i Server parameter file INITSALE ORA mount and open the database named SALES in exclusive mode and restrict a
17. EXECUTE n 1 PL SQL procedure successfully completed For information on how to create a bind variable see the VARIABLE command in this chapter SQL Plus Command Reference 13 63 EXIT EXIT Syntax Terms EXITIQUIT SUCCESS FAILURE WARNING n variable BindVariable CO MMIT RO LLBACK Commits or rolls back all pending changes logs out of Oracle terminates SQL Plus and returns control to the operating system In iSQL Plus commits or rolls back all pending changes stops processing the current iSQL Plus script and returns focus to the Input area There is no way to access the return code in iSQL Plus In iSQL Plus click the Logout button to log out of Oracle Refer to the following list for a description of each term or clause EXIT QUIT Can be used interchangeably QUIT is a synonym for EXIT SUCCESS Exits normally FAILURE Exits with a return code indicating failure WARNING Exits with a return code indicating warning COMMIT Saves pending changes to the database before exiting n Represents an integer you specify as the return code variable Represents a user defined or system variable but not a bind variable such as SOL SOLCODE EXIT variable exits with the value of variable as the return code 13 64 SQL Plus User s Guide and Reference EXIT Usage Examples BindVariable Represents a variable created in SQL Plus with the VARIABLE com mand and then referenced in PL SQL
18. Examples n NONE Directs SQL Plus to take no action before continuing If you do not enter the WHENEVER OSERROR command the default behavior of SQL Plus is to continue and take no action when an operating system error occurs If you do not enter the WHENEVER SOLERROR command the default behavior of SQL Plus is to continue and take no action when a SQL error occurs The commands in the following script cause SQL Plus to exit and COMMIT any pending changes if a failure occurs when reading from the output file WHENEVER OSERROR EXIT START no such file OS Message No such file or directory Disconnected from Oracle SQL Plus Command Reference 13 153 WHENEVER SQLERROR WHENEVER SQLERROR Syntax Terms 13 154 WHENEVER SQLERROR EXIT SUCCESS FAILURE WARNING n variable BindVariable COMMIT ROLLBACK CONTINUE COMMIT ROLLBACK NONE Performs the specified action exits SQL Plus by default if a SQL command or PL SQL block generates an error In iSQL Plus performs the specified action stops the current script by default and returns focus to the Input area if a SOL command or PL SQL block generates an error Refer to the following list for a description of each term or clause SUCCESS FAILUR E WARNING n variable BindVariable Directs SQL Plus to perform the specified action as soon as it detects a SQL command or PL SQL block error but after printing the error mes sage SOL Pl
19. Index 9 footers continued indenting 13 90 listing current definition 13 87 setting at the end of reports 7 23 suppressing definition 13 90 FORCE clause 13 134 FORMAT clause 13 10 13 31 in ATTRIBUTE command 13 17 in COLUMN command 7 5 7 6 in REPHEADER and REPFOOTER commands 13 90 in TTITLE and BTITLE commands 7 28 13 142 format models number 7 5 13 33 formfeed to begin a new page 7 32 13 114 FROM clause 13 80 FROM clause SQL Plus B 5 functionality 2 3 G GET command 13 66 disabling 10 5 LIST clause 13 66 NOLIST clause 13 66 retrieving scripts 13 66 globalization support 12 1 Oracle9i database 12 2 12 4 GLOGIN SQL 3 2 9 4 9 8 See also LOGIN SQL glogin sql 10 13 GRANT command 10 2 disabling 10 5 H HEAD clause 4 6 HEAD option 4 6 headers aligning elements 7 25 displaying at top of page 13 89 displaying system maintained values 13 89 setting at the start of reports 7 23 suppressing 7 25 HEADING clause 7 2 13 34 HEADING variable 13 109 Index 10 headings aligning elements 13 90 column headings 13 109 formatting elements 13 90 indenting 13 90 listing current definition 13 91 suppressing definition 13 90 HEADSEP variable 13 97 13 110 use in COLUMN command 7 3 13 34 help iSQL Plus online 4 14 HELP command 13 68 help online 4 12 13 68 HIDE clause 13 11 History screen 2 6 HOST command 5 13 13 69 disabling 10 5 host opera
20. SALARY DEPARTMENT ID Errazuriz Zlotkey Cambrault Russell Partners Job SA MAN 6 rows selected MANAGER ID 13 38 SQL Plus User s Guide and Reference SALARY DEPARTMENT ID Job Report HIRE DATE 17 FEB 96 13 000 00 13 000 00 Job Report HIRE DATE 10 MAR 97 12 000 00 29 JAN 00 10 500 00 15 OCT 99 11 000 00 01 OCT 96 14 000 00 05 JAN 97 13 500 00 Job Report HIRE DATE 12 200 00 u 04 19 01 04 19 01 COLUMN C x5 To change the default format of DATE columns to YYYY MM DD you can enter ALTER SESSION SET NLS DATE FORMAT YYYY MM DD Session altered To display the change enter a SELECT statement such as SELECT HIRE DATE FROM EMPLOYEES WHERE EMPLOYEE ID 206 Job Report 04 19 01 Job SA MAN HIRE DATE 1994 06 07 See the Oracle9i SQL Reference for information on the ALTER SESSION command Note that in a SELECT statement some SQL calculations or functions such as TO CHAR may cause a column to be very wide In such cases use the FORMAT option to alter the column width SQL Plus Command Reference 13 39 COMPUTE COMPUTE Syntax Terms COMP UTE function LAB EL text OF exprcolumnlalias ON fexpr column aliasR EP ORT ROW Calculates and prints summary lines using various standard computations on subsets of selected rows It also lists all COMPUTE definitions For details on how to create summaries see Clar
21. SQL Plus Command Reference 13 121 SET If you then enter GET EXAMPLE SQL Plus will look for a file named EXAMPLE UFI instead of EXAMPLE SQL SET TAB ON OFF SET TAB is not supported in iSQL Plus Determines how SQL Plus formats white space in terminal output OFF uses spaces to format white space in the output ON uses the TAB character TAB settings are every eight characters The default value for TAB is system dependent SET TERM OUT ON OFF SET TERMOUT is not supported in iSQL Plus Controls the display of output generated by commands executed from a script OFF suppresses the display so that you can spool output from a script without seeing the output on the screen ON displays the output TERMOUT OFF does not affect output from commands you enter interactively SET TI ME ON OFF SET TIME is not supported in iSQL Plus Controls the display of the current time ON displays the current time before each command prompt OFF suppresses the time display SET TIMI NG ON OFF Controls the display of timing statistics ON displays timing statistics on each SQL command or PL SQL block run OFF suppresses timing of each command For information about the data SET TIMING ON displays see the Oracle installation and user s manual s provided for your operating system Refer to the TIMING command for information on timing multiple commands SET TRIM OUT ON OFF SET TRIMOUT is not supported in iSQL Plus Determines wh
22. lt BODY gt lt HTML gt Generating HTML Reports from SQL Plus 8 13 Creating Reports using iSQL Plus Replace machine_name domain with the host and domain names and replace port with the port number of your Oracle HTTP Server Save the HTML file on your Oracle HTTP Server Load the HTML file in your web browser and click on Run Employee Report iSQL Plus requests your username and password Log in to iSQL Plus iSQL Plus executes the script and displays the results in your web browser Example 8 5 Creating a Dynamic Report with Parameters Create and save the following script to a file called employee_name sql on your Oracle HTTP Server SET VERIFY OFF SET PAGESIZE 200 SET FEEDBACK OFF SET MARKUP HIML ENTMAP OFF PROMPT lt H1 gt Employee Details for Employee s with Last Name like amp last_name lt H1 gt SET MARKUP HTML ENTMAP ON SELECT FROM EMPLOYEES WHERE UPPER last name LIKE UPPER amp last_name3 Create an HTML file which contains lt HTML gt lt HEAD gt lt TITLE gt lt em gt i lt em gt SQL Plus Dynamic Report lt TITLE gt lt HEAD gt lt BODY gt lt H1 gt lt em gt i lt em gt SQL Plus Report Hl lt H2 gt Query by Last Name lt H2 gt lt FORM METHOD get ACTION http machine_name domain port isqlplus gt lt INPUT TYPE hidden NAME script VALUE http machine_ name domain port employee name sql Enter last name of employee lt INPUT TYPE text NAME
23. on separate lines in your script on the same line as a SOL command or on a line in a PL SQL block You must enter a space after the slash asterisk beginning a comment otherwise the comment is treated as a command and the slash is interpreted as an execute command executing any command in the SQL Plus buffer The comments can span multiple lines but cannot be nested within one another Commission Report to be run monthly COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 COLUMN COMMISSION PCT HEADING COMMISSION FORMAT 90 90 6 10 SQL Plus User s Guide and Reference Placing Comments in Scripts Using C x5 x5 REMARK Includes only salesmen SELECT LAST NAME SALARY COMMISSION PCT FROM EMP DETAILS VIEW Include only salesmen WHERE JOB ID SA MAN If you enter a SOL comment directly at the command prompt SOL Plus does not store the comment in the buffer You can use ANSI ISO style comments within SOL statements PL SQL blocks or SQL Plus commands Since there is no ending delimiter the comment cannot span multiple lines For PL SQL and SQL enter the comment after a command on a line or on a line by itself Commissions report to be run monthly DECLARE block for reporting monthly sales For SQL Plus commands you can only include style comments if they are on a line by themselves For example these comments are lega
24. BTITLE OFF These commands cause SQL Plus to cease displaying titles on reports but do not clear the current definitions of the titles You may restore the current definitions by entering TTITLE ON BTITLE ON Displaying Column Values in Titles You may wish to create a master detail report that displays a changing master column value at the top of each page with the detail query results for that value below You can reference a column value in a top title by storing the desired value in a variable and referencing the variable in a TTITLE command Use the following form of the COLUMN command to define the variable COLUMN column name NEW VALUE variable name You must include the master column in an ORDER BY clause and in a BREAK command using the SKIP PAGE clause Example 7 24 Creating a Master Detail Report Suppose you want to create a report that displays two different managers employee numbers each at the top of a separate page and the people reporting to the manager on the same page as the manager s employee number First create a variable MGRVAR to hold the value of the current manager s employee number COLUMN MANAGER ID NEW VALUE MGRVAR NOPRINT Because you will only display the managers employee numbers in the title you do not want them to print as part of the detail The NOPRINT clause you entered above tells SQL Plus not to print the column MANAGER ID Next include a label and the value in your page title enter
25. Cause The specified value was not in the range Action Specify a value in the range SP2 0747 PAGESIZE must be at least max page size to run this query with LINESIZE line size Cause The PAGESIZE setting was too small to display the specified LINESIZE Action Increase the PAGESIZE to at least match the specified LINESIZE SP2 0749 Cannot resolve circular path of synonym synonym name Cause An attempt was made to use a synonym to point to an object that no longer exists where the synonym had the same name as the base object or an attempt was made to use a synonym that has a circular path that points back to itself Action Make sure that the last synonym in the synonym path points to an object that exists and that it doesn t point back to itself SQL Plus Error Messages 14 33 SQL Plus Error Messages SP2 0750 You may need to set ORACLE HOME to your Oracle software directory Cause SQL Plus was unable to find a message file during program initialization and could not display error messages or text required for normal operation The most common cause is that ORACLE HOME has not been set Other possible causes are a corrupt or unreadable message file This message is hard coded in English in the SQL Plus source code so it can be displayed on message file error It could never be read from this message file because the error occurs only when the message files cannot be opened This entry in the message file is for documentation p
26. If you have left SQL Plus and started again since performing Example 5 2 Entering a SOL Plus Command the column has reverted to its original format For information about the significance of case in a CHANGE command and on using wildcards to specify blocks of text in a CHANGE command refer to the COLUMN command on page 13 29 Adding a New Line To insert a new line after the current line use the INPUT command To insert a line before line 1 enter a zero 0 and follow the zero with text SQL Plus inserts the line at the beginning of the buffer and that line becomes line 1 0 SELECT EMPLOYEE ID Using Scripts in SQL Plus 6 7 Editing Scripts in SQL P lus n Example 6 5 Adding a Line Suppose you want to add a fourth line to the SOL command you modified in Example 6 4 Correcting the Error Since line 3 is already the current line enter INPUT which may be abbreviated to I and press Return INPUT SQL Plus prompts you for the new line 4 Enter the new line Then press Return 4 ORDER BY SALARY SQL Plus prompts you again for a new line 5 Press Return again to indicate that you will not enter any more lines and then use RUN to verify and re run the query 1 SELECT EMPLOYEE ID LAST NAME JOB ID SALARY 2 FROM EMP DETAILS VIEW WHERE JOB ID SA MAN 4 ORDER BY SALARY EMPLOYEE ID LAST NAME JOB ID MONTHLY SALARY 149 Zlotkey SA MAN 10 500 148 Cambrault SA MAN 1
27. SQL Plus displays the prompt DOC gt in place of SQL gt until you end the documentation The pound character f on a line by itself ends the documentation If you have set DOCUMENT to OFF SQL Plus suppresses the display of the block of documentation created by the DOCUMENT command See SET DOCUMENT later in this appendix Purpose Advances spooled output n lines beyond the beginning of the next page Syntax NEWPAGE 1 n Usage Notes Refer to the NEWPAGE variable of the SET command on page 13 114 for information on the current method for advancing spooled output SET BUFFER Purpose Makes the specified buffer the current buffer Syntax SET BUF FER buffer SQL Usage Notes Initially the SOL buffer is the current buffer SQL Plus does not require the use of multiple buffers the SOL buffer alone should meet your needs C 4 SQL Plus User s Guide and Reference SET DOCUMENT If the buffer name you enter does not already exist SET BUFFER defines creates and names the buffer SQL Plus deletes the buffer and its contents when you exit SOL Plus Running a query automatically makes the SQL buffer the current buffer To copy text from one buffer to another use the GET and SAVE commands To clear text from the current buffer use CLEAR BUFFER To clear text from the SOL buffer while using a different buffer use CLEAR SQL SET CLOSECURSOR Purpose Sets the cursor usage behavior Syntax SET CLOSECUR SO
28. The iSQLP1lusLogLevel parameter determines whether logging is enabled to record iSQL Plus Server messages and the level of logging Logging is useful to help resolve user problems Logging can be turned off set to warn level or set to debug level which provides the richest information iSQLPlusLogLevel defaults to warn if it is set to an invalid value or if it is not set If the log file cannot be opened or written it is set to o f The default logfile location is SORACLE_HOME sqlplus log isqlplus log xml in Windows and SORACLE_HOME sqlplus log isqlplus log xml in UNIX A new log file is started when its size reaches 64 kilobytes The old file is renamed with a unique name like log1006130580 xml A maximum of 10 log files are kept and older files are automatically deleted 3 8 SQL Plus User s Guide and Reference iSQL Plus Configuration When logging is enabled iSQL Plus appends log data to an existing log file or creates a new file if one does not exist If there is any sort of write error that prevents writing to the logfile iSQL Plus starts but does not create a log file or log any messages The log directory must be writable by iSQL Plus The log directory has owner write permissions If iSQL Plus is running as nobody and therefore cannot write to the log file the iSQL Plus administrator must manually give iSQL Plus write permissions on the log file It is not recommended to grant world write pe
29. This appendix covers earlier versions of some SQL Plus commands While these older commands still function within SQL Plus they are no longer supported It is recommended that you use the alternative SOL Plus commands listed in the following table Obsolete SQL Plus Commands C 1 SQL Plus Obsolete Command Alternatives SQL Plus Obsolete Command Alternatives Obsolete commands are available in current releases of SOL Plus In future releases they may only be available by setting the SQLPLUSCOMPATIBILITY variable You should modify scripts using obsolete commands to use the alternative commands Obsolete Alternative Description of Alternative Command Command Command BTITLE BTITLE see 13 23 Places and formats a title at the bottom of each old form report page or lists the current BTITLE definition COLUMN DEFAULT COLUMN CLEAR Resets column display attributes to default values see 13 29 DOCUMENT REMARK see 13 86 Places a comment which SQL Plus does not interpret as a command NEWPAGE SET NEWPAGE see Sets the number of blank lines to be printed from 13 114 the top of each page to the top title SET BUFFER EDIT see 13 61 Enables the editing of the SOL Plus command buffer or the contents of a saved file Use the SOL PIus SAVE GET 9 and START commands to create and use external files SET none Obsolete CLOSECURSOR SET DOCUMENT none Obsolete SET MAXDATA none Obsolete SET SCAN SET DEFINE see Sets the character used to prefix substi
30. a Oracle9i Database Reference a Oracle9i Database Performance Tuning Guide and Reference a Oracle9i Real Application Clusters Concepts a Oracle9i Net Services Administrator s Guide a Oracle Call Interface Programmer s Guide a Pro COBOL Precompiler Programmer s Guide a Pro C C Precompiler Programmer s Guide Oracle installation and user s manual s provided for your operating system Many of the examples in this book use the sample schemas of the seed database which is installed by default when you install Oracle Refer to Oracle9i Sample Schemas for information on how these schemas were created and how you can use them yourself In North America printed documentation is available for sale in the Oracle Store at http oraclestore oracle com Customers in Europe the Middle East and Africa EMEA can purchase documentation from http www oraclebookshop com Other customers can contact their Oracle representative to purchase printed documentation To download free release notes installation documentation white papers or other collateral please visit the Oracle Technology Network OTN You must register online before using OTN registration is free and can be done at http otn oracle com admin account membership html If you already have a username and password for OTN then you can go directly to the documentation section of the OTN Web site at http otn oracle com docs index htm To access the database
31. and earlier term A computer program designed to store and retrieve shared data In a relational system data is stored in tables consisting of one or more rows each containing the same set of columns Oracle is a relational database management system Other types of database systems are called hierarchical or network database systems remark In SQL Plus a comment you can insert into a script with the REMARK command Glossary 19 Glossary 20 remote computer A computer on a network other than the local computer remote database A database other than your default database which may reside on a remote computer in particular one that you reference in the CONNECT COPY and SOLPLUS commands report 1 The results of a query 2 Any output but especially output that has been formatted for quick reading in particular output from SQL Plus reserved word 1 A word that has a special meaning in a particular software or operating system 2 In SQL a set of words reserved for use in SQL statements you cannot use a reserved word as the name of a database object roles Named groups of related privileges that are granted to users or other roles rollback To discard pending changes made to the data in the current transaction using the SQL ROLLBACK command You can roll back a portion of a transaction by identifying a savepoint row 1 Synonym for record one row of data in a database table having values for o
32. 0 physical reads 0 redo size 848 bytes sent via SQL Net to client 503 bytes received via SQL Net from client 4 SQL Net roundtrips to from client 0 sorts memory 0 sorts disk 6 rows processed This option is useful when you are tuning a large query but do not want to see the query report Example 9 6 Tracing Statements Using a Database Link To trace a statement using a database link enter SET AUTOTRACE TRACEONLY EXPLAIN SELECT FROM EMPLOYEES MY_LINK Execution Plan 0 SELECT STATEMENT REMOTE Optimizer CHOOSE 1 0 TABLE ACCESS FULL OF EMPLOYEES MY LINK DB DOMAIN The Execution Plan shows that the table being accessed on line 1 is via the database link MY LINK DB DOMAIN Collecting Timing Statistics Use the SQL Plus TIMING command to collect and display data on the amount of computer resources used to run one or more commands or blocks TIMING collects data for an elapsed period of time saving the data on commands run during the period in a timer See the TIMING command on page 13 139 and the Oracle installation and user s guide provided for your operating system for more information See also Iracing Statements for information about using AUTOTRACE to collect statistics To delete all timers enter CLEAR TIMING at the command prompt Tracing Parallel and Distributed Queries When you trace a statement in a parallel or distributed query the Execution Plan shows the cost based optimizer estimates of the numb
33. 13 120 SQL Plus User s Guide and Reference SET To change your SQL Plus prompt to display your username and SID enter SET SQLPROMPT amp CONNECT IDENTIFIER gt To change your SQL Plus prompt to display your SID enter SET TERMOUT OFF COLUMN X NEW VALUE Y SELECT RTRIM INSTANCE CHR 0 X FROM V THREAD SET SOLPROMPT amp Y SQL gt SET TERMOUT ON To set the SOL Plus command prompt to show the current user enter SET TERMOUT OFF COLUMN D22 NEW VALUE VAR SELECT USERNAME D22 FROM USER USERS SET SOLPROMPT amp amp VAR SET TERMOUT ON These settings are not dynamic You need to reset them whenever you change instances such as when you use the connect command to log on to another instance SET SQLT ERMINATOR c ON OFF Sets the character used to end and execute SOL commands to c It cannot be an alphanumeric character or a whitespace OFF means that SQL Plus recognizes no command terminator you terminate a SQL command by entering an empty line If SQLBLANKLINES is set ON you must use the BLOCKTERMINATOR to terminate a SQL command ON resets the terminator to the default semicolon SET SUF FIX SQL text Example SET SUFFIX is not supported in iSQL Plus Sets the default file extension that SQL Plus uses in commands that refer to scripts SUFFIX does not control extensions for spool files To change the default command file extension from the default SQL to UFI enter SET SUFFIX UFI
34. 13 42 SQL Plus User s Guide and Reference COMPUTE C SA_MAN Zlotkey Cambrault Errazuriz Partners Russell KKK KK RK KKK a TOTAL 6 rows selected To calculate the total of salaries greater than 12 000 on a report enter COMPUTE SUM OF SALARY ON REPORT BREAK ON REPORT COLUMN DUMMY HEADING SELECT DUMMY SALARY EMPLOYEE ID FROM EMP DETAILS VIEW WHERE SALARY 12000 ORDER BY SALARY SALARY EMPLOYEE ID 13000 201 13500 146 14000 145 17000 101 17000 102 24000 100 sum 98500 6 rows selected To calculate the average and maximum salary for the executive and accounting departments enter BREAK ON DEPARTMENT NAME SKIP 1 COMPUTE AVG LABEL Dept Average MAX LABEL Dept Maximum OF SALARY ON DEPARTMENT NAME SELECT DEPARTMENT NAME LAST NAME SALARY FROM EMP DETAILS VIEW WHERE DEPARTMENT NAME IN Executive ORDER BY DEPARTMENT NAME Accounting SQL Plus Command Reference 13 43 COMPUTE DEPARTMENT_NAME LAST_NAME SALARY Accounting Higgins 12000 Gietz 8300 KKK KKK KKK KKK KEK KKK KKK KK kk kk kk KK l llll Dept Average 10150 Dept Maximum 12000 Executive King 24000 Kochhar 17000 De Haan 17000 KKK KK KK KKK KKK kc k ck ck kk ck ckck ck kc kk kk KK 2l lll2l2c2 Dept Average 19333 3333 Dept Maximum 24000 To sum salaries for departments 20 without printing the compute label enter COLUMN DUMMY NOPRINT COMPUTE
35. 6 32 storing current date in variable for titles 7 31 semicolon in PL SQL blocks 5 7 in SOL commands 5 4 5 5 in SOL Plus commands 5 10 13 1 not stored in buffer 6 5 Index 17 server iSQL Plus parameters 2 14 SERVEROUTPUT variable 13 116 service name in CONNECT command 4 22 in COPY command B 5 B 8 B 9 in SOLPLUS command 4 21 session concurrent 1 5 identification 1 5 3 7 4 14 stateful behavior 3 7 SET AUTOTRACE 9 2 SET clause 13 138 SET command 3 3 5 10 13 95 affecting substitution variables 6 24 APPINFO variable 9 10 13 99 ARRAYSIZE variable 9 10 13 95 13 100 B 8 AUTOCOMMIT variable 5 11 13 95 13 101 AUTOPRINT variable 13 95 13 101 13 147 AUTORECOVERY variable 13 96 13 101 AUTOTRACE variable 13 96 13 102 BLOCKTERMINATOR variable 13 96 13 102 BUFFER variable C 4 CLOSECURSOR variable C 2 C 5 CMDSEP variable 13 96 13 103 COLSEP variable 7 34 13 96 13 104 COMPATIBILITY variable 13 96 13 104 CONCAT variable 6 23 13 96 13 105 COPYCOMMIT variable 13 96 13 105 B 8 COPYTYPECHECK variable 13 96 13 105 DEFINE clause 6 23 DEFINE variable 13 96 13 105 DESCRIBE variable 13 96 13 106 disabling 10 5 DOCUMENT variable C 2 C 5 ECHO variable 6 14 13 96 13 107 EDITFILE variable 13 96 13 107 EMBEDDED variable 13 96 13 107 ESCAPE variable 6 23 13 96 13 108 FEEDBACK variable 13 96 13 108 FLAGGER variable 13 97 13 108 FLUSH variable 13 97 13 1
36. COL n CE NTER SIKIP n R IGHT TAB n BOLD LE FT FORMAT text Places and formats a specified title at the bottom of each report page or lists the current BTITLE definition For a description of the old form of BTITLE see Appendix C Obsolete SQL Plus Commands Refer to the TTITLE command in this chapter for information on terms and clauses in the BTITLE command syntax Enter BTITLE with no clauses to list the current BTITLE definition If you do not enter a printspec clause before the first occurrence of text BTITLE left justifies the text SOL Plus interprets BTITLE in the new form if a valid printspec clause LEFI SKIP COL and so on immediately follows the command name To set a bottom title with CORPORATE PLANNING DEPARTMENT on the left and a date on the right enter BTITLE LEFT CORPORATE PLANNING DEPARTMENT RIGHT 1 JAN 2001 To set a bottom title with CONFIDENTIAL in column 50 followed by six spaces and a date enter BTITLE COL 50 CONFIDENTIAL TAB 6 1 JAN 2001 SQL Plus Command Reference 13 23 CHANGE CHANGE Syntax Terms Usage CHANGE is not available in iSQL Plus C HANGE sepchar old sepchar new sepchar Changes the first occurrence of the specified text on the current line in the buffer Refer to the following list for a description of each term or clause sepchar old new ayy Represents any non alphanumeric character such as or Use a sep
37. Enter the second line of the command FROM EMP_DETAILS_VIEW WHERE SALARY gt 12000 The semicolon means that this is the end of the command Press Return SQL Plus processes the command and displays the results on the screen EMPLOYEE_ID LAST_NAME JOB_ID SALARY 100 King AD_PRES 24 000 101 Kochhar AD_VP 17 000 102 De Haan AD_VP 17 000 145 Russell SA_MAN 14 000 146 Partners SA_MAN 13 500 201 Hartstein MK_MAN 13 000 6 rows selected After displaying the results and the number of rows retrieved SQL Plus displays the command prompt again If you made a mistake and therefore did not get the results shown above simply re enter the command The headings may be repeated in your output depending on the setting of a system variable called PAGESIZE Sometimes the result from a query will not fit the available page width You will need to adjust a system variable called LINESIZE which sets the width of the output in characters see Setting Page Dimensions on page 7 31 Typically in the examples in this guide this is set to 70 characters You may need to SET LINESIZE to 70 so the query output appears the same as in this guide Whether you see the message concerning the number of records retrieved depends on the setting of a system variable called FEEDBACK You will learn more about system variables in System Variables that Affect How Commands Run To save space the number of records selected will not be shown in the rest of th
38. Now rerun the query with the slash command LAST MONTHLY NAME SALARY COMMISSION Russell 14000 4 Partners 13500 o3 Errazuriz 12000 ae Cambrault 11000 3 Zlotkey 10500 2 Example 7 3 Setting the Underline Character To change the character used to underline headings to an equal sign and rerun the query enter the following commands SET UNDERLINE LAST MONTHLY NAME SALARY COMMISSION Formatting SQL Plus Reports 7 3 Formatting Columns Russell 14000 4 Partners 13500 CES Errazuriz 12000 53 Cambrault 11000 23 Zlotkey 10500 2 Now change the underline character back to a dash SET UNDERLINE Note You must enclose the dash in quotation marks otherwise SQL Plus interprets the dash as a hyphen indicating that you wish to continue the command on another line Formatting NUMBER Columns When displaying NUMBER columns you can either accept the SQL Plus default display width or you can change it using the COLUMN command The sections below describe the default display and how you can alter the default with the COLUMN command The format model will stay in effect until you enter a new one reset the column s format with COLUMN column_name CLEAR or exit from SQL Plus Default Display A NUMBER column s width equals the width of the heading or the width of the FORMAT plus one space for the sign whichever is greater If you do not explicitly use FORMAT then the column s width
39. OPRINT SALARY ON DUMMY LS VIEW 2000 TMENT ID LAST NAME MY DEPARTMENT ID LAST NAME SALARY Hartstein Russell Partners King Kochhar De Haan d The format of the column SALARY controls the appearance of the sum of SALARY as well as the individual values of SALARY When you establish the format of a NUMBER column you must allow for the size of the sums included in the report Formatting SQL Plus Reports 7 19 Clarifying Your Report with Spacing and Summary Lines Computing Summary Lines at the End of the Report E You can calculate and print summary lines based on all values in a column by using BREAK and COMPUTE in the following forms BREAK ON REPORT COMPUTE function LABEL label_name OF column column column ON REPORT Example 7 14 Computing and Printing a Grand Total To calculate and print the grand total of salaries for all sales people and change the compute label first enter the following BREAK and COMPUTE commands BREAK ON REPORT COMPUTE SUM LABEL TOTAL OF SALARY ON REPORT Next enter and run a new query SELECT LAST_NAME SALARY FROM EMP_DETAILS_VIEW WHERE JOB ID SA MAN LAST NAME SALARY Russell 14000 Partners 13500 Errazuriz 12000 Cambrault 11000 Zlotkey 10500 TOTAL 61000 To print a grand total or grand average grand maximum and so on in addition to subtotals or sub averages and so on include a break column and an ON REPORT clause in your BREA
40. Provides a summary of SOL Plus commands and detailed descriptions of each SQL Plus command in alphabetical order Chapter 14 SQL Plus Error Messages Lists error messages generated by SOL Plus iSQL Plus and the COPY command It provides likely causes and appropriate actions for recovery PART IV SQL Plus Appendixes Contains SQL Plus Appendixes Appendix A SQL Plus Limits Lists the maximum values for elements of SOL Plus Appendix B SQL Plus COPY Command Provides syntax and usage information for the COPY command Appendix C Obsolete SQL Plus Commands Provides information on Obsolete SOL Plus commands Appendix D Commands Not Supported in iSQL Plus Lists SOL Plus commands that are not supported in iSQL Plus Glossary Defines technical terms associated with Oracle and SQL Plus Related Documentation For more information see these Oracle resources a SQL Plus Quick Reference a PL SQL User s Guide and Reference a Oracle9i SQL Reference a Oracle9i Database Concepts a Oracle9i Database Administrator s Guide a Oracle9i User Managed Backup and Recovery Guide a Oracle9i Application Developer s Guide Fundamentals a Oracle9i XML Database Developer s Guide Oracle XML DB a Oracle9i Database Globalization Support Guide Oracle9i Heterogeneous Connectivity Administrator s Guide a Oracle9i Replication a Orfacle9i Database Utilities xxi a Oracle9i Database Error Messages a Oracle9i Database Migration
41. SET SQLBLANKLINES ON REM Using the SQLTERMINATOR default is REM Could have used the BLOCKTERMINATOR default is SELECT FROM DUAL 13 118 SQL Plus User s Guide and Reference SET 0M The following output results D X SET SQLC ASE MIX ED LO WER UP PER Converts the case of SOL commands and PL SQL blocks just prior to execution SQL Plus converts all text within the command including quoted literals and identifiers to uppercase if SOLCASE equals UPPER to lowercase if SOLCASE equals LOWER and makes no changes if SOLCASE equals MIXED SOLCASE does not change the SOL buffer itself SET SQLCO NTINUE gt text Example SET SQLCONTINUE is not supported in iSQL Plus Sets the character sequence SQL Plus displays as a prompt after you continue a SQL Plus command on an additional line using a hyphen To set the SOL Plus command continuation prompt to an exclamation point followed by a space enter SET SOLCONTINUE SQL Plus will prompt for continuation as follows TTITLE MONTHLY INCOME RIGHT SQL PNO SKIP 2 CENTER PC DIVISION The default continuation prompt is SQL Plus Command Reference 13 119 SET SET SQLN UMBER ON OFF SET SOLNUMBER is not supported in iSQL Plus Sets the prompt for the second and subsequent lines of a SOL command or PL SQL block ON sets the prompt to be the line number OFF sets the prompt to the value of SOLPR
42. SET clause 13 138 stored functions 6 32 stored procedures creating 5 6 substitution variables 6 18 6 24 appending characters immediately after 6 20 avoiding unnecessary prompts for value 6 21 substitution variables continued concatenation character 13 96 13 105 DEFINE command 6 21 13 49 defined 6 21 parsing 9 11 prefixing 13 96 13 105 C 2 restrictions 6 23 single and double ampersands 6 21 system variables used with 6 23 undefined 6 19 where and how to use 6 19 SUFFIX variable 13 98 13 121 used with at sign command 13 5 used with EDIT command 13 61 used with GET command 13 66 used with SAVE command 13 93 used with START command 13 132 SUM function 7 17 summary lines computing and printing 7 16 13 40 computing and printing at ends of reports 7 20 computing same type different columns 7 20 printing grand and sub summaries totals 7 20 printing multiple on same break column 7 21 Syntax COPY command B 5 syntax rules SOL commands 5 4 SOL Plus commands 5 9 SYSDATE 7 31 SYSDBA clause 13 47 SYSOPER clause 4 11 13 47 system variables 5 10 13 95 affecting SOL Plus performance 9 10 listing current settings 5 11 13 124 listing old and new values 13 98 13 118 setting iniSQL Plus 2 14 storing and restoring 3 3 used with substitution variables 6 23 System variables screen 2 14 system maintained values displaying in headers and footers 13 89 displaying in titles 7 27 1
43. See the RECOVER command in this chapter for more information about database recovery SQL Plus Command Reference 13 101 SET Example To set the recovery mode to AUTOMATIC enter SET AUTORECOVERY ON RECOVER DATABASE SET AUTOT RACE ON OFF TRACE ONLY EXP LAIN STAT ISTICS Displays a report on the execution of successful SQL DML statements SELECT INSERT UPDATE or DELETE The report can include execution statistics and the query execution path OFF does not display a trace report ON displays a trace report TRACEONLY displays a trace report but does not print query data if any EXPLAIN shows the query execution path by performing an EXPLAIN PLAN STATISTICS displays SQL statement statistics Information about EXPLAIN PLAN is documented in the Oracle9i SQL Reference manual Using ON or TRACEONLY with no explicit options defaults to EXPLAIN STATISTICS The TRACEONLY option may be useful to suppress the query data of large queries If STATISTICS is specified SQL Plus still fetches the query data from the server however the data is not displayed The AUTOTRACE report is printed after the statement has successfully completed Information about Execution Plans and the statistics is documented in the Oracle9i Database Performance Tuning Guide and Reference manual When SQL Plus produces a STATISTICS report a second connection to the database is automatically created This connection is closed when the STATISTI
44. The STORE command was unable to close the specified file Another resource may have locked the file Action Check that the file is not locked before closing it SP2 0608 Object object_name is a remote object cannot further describe Cause Unable to DESCRIBE the remote object Action No action required SP2 0609 Usage SET AUTOT RACE OFF ON TRACE ONLY EXP LAIN STAT ISTICS Cause An invalid option was used in the SET AUTOTRACE command Action Check the syntax of the SET AUTOTRACE command for the correct options SP2 0610 Error initializing feature_name Cause Not enough memory to enable this feature Action Free up additional memory by closing applications not required or reduce the size of the command statement or query output 14 26 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0612 Error generating report_name report Cause Unable to generate the report using AUTOTRACE Action Make a note of the message and the number then contact the Database Administrator SP2 0613 Unable to verify PLAN_TABLE format or existence Cause An AUTOTRACE command was issued by a user with insufficient privileges or who did not have a PLAN_TABLE Action Make sure the user has been granted the PLUSTRACE role and that a PLAN_TABLE has been created for the user SP2 0614 Server version too low for this feature Cause The current version of the Oracle Server is too low for this feature Action
45. option 8 6 SQL Plus User s Guide and Reference Creating Reports using Command line SQL Plus The nesting of quotes may be different in some operating systems or program scripting languages Creating Reports with CGI Scripts The SQLPLUS MARKUP command allows you to start a SQL Plus session in markup mode rather than using the SET MARKUP command interactively This allows you to run a SQL Plus session embedded inside a Common Gateway Interface CGI script A file created in this way can be displayed directly in a web browser You can call SQL Plus using any script language which is supported by your web server such as a UNIX shell script a Windows batch file Java JavaScript or a Perl script You can use this embedded approach to produce web pages that use existing SQL Plus scripts without change It provides an easy way to provide dynamically created web based reports Example 8 3 Creating a Report from a CGI Script You can use a CGI script to run SQL Plus and so produce a web report from a SQL script There are three main elements required a A web page to call and pass parameters to the CGI script a A CGI script to gather the input and run SQL Plus The SQL script to be run by the SQL Plus session Web Page for CGI Example In this example the web page is an HTML form with fields for a username and password a database connection string and the name of the SQL script to run Note You need to careful
46. right center flush left flush right or flush center of the defined width of a field anonymous block A PL SQL program unit that has no name and does not require the explicit presence of the BEGIN and END keywords to enclose the executable statements archived redo log Recovery structure where online redo log files are archived before being reused ARCHIVELOG Redo log mode where the filled online redo log files are archived before they are reused in the cycle In ARCHIVELOG mode the database can be completely recovered from both instance and disk failure The database can also be backed up while it is open and available for use However additional administrative Glossary 1 Glossary 2 operations are required to maintain the archived redo log See also archived redo log argument A data item following the script name in a START command The argument supplies a value for a parameter in the script array processing Processing performed on multiple rows of data rather than one row at a time In some Oracle utilities such as SQL Plus Export Import and the precompilers users can set the size of the array increasing the array size often improves performance ASCII A convention for using digital data to represent printable characters ASCII is an acronym for American Standard Code for Information Interchange autocommit A feature unique to SQL Plus that enables SQL Plus to automatically commit changes to the database
47. see Example 6 1 Using a System Editor to Write a SOL Script to list the employees with various jobs not just those whose job is SA MAN You could do that by editing a different CHAR value into the WHERE clause each time you run the command but there is an easier way By using a substitution variable in place of the value SA MAN in the WHERE clause you can get the same results you would get if you had written the values into the command itself A substitution variable is a user variable name preceded by one or two ampersands amp When SQL Plus encounters a substitution variable in a command SQL Plus executes the command as though it contained the value of the substitution variable rather than the variable itself For example if the variable SORTCOL has the value JOB ID and the variable MYTABLE has the value EMP DETAILS VIEW SQL Plus executes the commands SELECT amp SORTCOL SALARY FROM amp MYTABLE WHERE SALARY gt 12000 as if they were SELECT JOB ID SALARY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 6 18 SQL Plus User s Guide and Reference Writing Interactive Commands n Where and How to Use Substitution Variables You can use substitution variables anywhere in SOL and SQL Plus commands except as the first word entered at the command prompt When SQL Plus encounters an undefined substitution variable in a command SQL Plus prompts you for the value You can enter any string at the prompt
48. such as A 3 amp or blanks and can have from 1 to 2000 bytes or can be null For more information about the CHAR datatype refer to the Oracle9i SOL Reference character A single location on a computer system capable of holding one alphabetic character or numeric digit One or more characters are held in a field One or more fields make up a record and one or more records may be held in a file or database table character string A group of sequential letters numerals or symbols usually comprising a word or name or portion thereof clause A part of a SOL statement that does not constitute the full statement for example a WHERE clause client A user software application or computer that requests the services data or processing of another application or computer the server In a two task environment the client is the user process In a network environment the client is the local user process and the server may be local or remote CLOB datatype A standard Oracle datatype The CLOB datatype is used to store single byte character large object data and can store up to 2 gigabytes of character data column A vertical space in a database table that represents a particular domain of data A column has a column name and a specific datatype For example in a table of employee information all of the employees dates of hire would constitute one column A record group column represents a database column column e
49. 10 5 bind variables 6 31 creating 13 145 displaying 13 77 displaying automatically 13 101 13 147 in PL SOL blocks 13 147 in SOL statements 13 147 in the COPY command 13 147 blank line in PL SQL blocks 5 7 in SOL commands 5 5 preserving in SOL commands 13 98 13 118 blocks PL SOL continuing 5 7 editing in buffer 6 4 editing with host system editor 6 2 13 61 entering and executing 5 7 listing current in buffer 6 5 run from SQL buffer 5 7 saving current 13 93 setting character used toend 13 96 13 102 stored in SQL buffer 5 7 timing statistics 13 122 within SQL commands 5 6 BLOCKTERMINATOR 13 96 13 102 13 118 13 121 BODY clause 4 6 BODY option 4 6 BOLD clause 13 90 13 142 break columns 7 12 13 18 inserting space when value changes 7 13 specifying multiple 7 14 suppressing duplicate values in 7 12 BREAK command 7 12 13 18 and SQL ORDER BY clause 7 12 7 13 7 14 13 19 clearing BREAKS 7 16 displaying column values in titles 7 29 DUPLICATES clause 13 21 inserting space after every row 7 14 inserting space when break column changes 7 13 listing current break definition 7 16 13 21 ON column clause 7 13 13 18 ON expr clause 13 19 ON REPORT clause 7 20 13 20 ON ROW clause 7 14 13 20 printing grand and sub summaries 7 20 printing summary lines at ends of reports 7 20 removing definition 13 27 SKIP clause 7 14 13 20 SKIP PAGE clause 7 13 7 14 13 21 specifying multiple
50. 13 5 13 132 substitution variables 6 18 ANALYZE command disabling 10 5 APPEND clause in COPY command B 3 B 7 in SAVE command 13 93 APPEND command 6 4 6 8 13 12 APPINFO clause 9 10 13 99 ARCH background process 13 14 ARCHIVE LOG command 11 4 13 13 mode 11 4 argument in START command 6 26 ARRAYSIZE variable 9 10 13 95 13 100 relationship to COPY command B 4 B 8 ATTRIBUTE command 13 16 ALIAS clause 13 16 and CLEAR COLUMN command 13 17 CLEAR clause 13 16 clearing columns 13 27 13 30 controlling display characteristics 13 17 display characteristics 13 16 entering multiple 13 17 FORMAT clause 13 17 LIKE clause 13 17 listing attribute display characteristics 13 16 OFF clause 13 17 ON clause 13 17 restoring column display attributes 13 17 suppressing column display attributes 13 17 AUDIT command disabling 10 5 authentication Index 2 adding connection entries 10 12 adding username password entries 3 11 10 11 DBA access in iSQL Plus 10 9 10 11 enabling for iSQL Plus users 3 11 htpasswd utility 10 12 iSQL Plus 10 10 iSQL Plus Server statistics 10 9 AUTOCOMMIT variable 5 11 13 95 13 101 AUTOMATIC clause 13 80 AUTOPRINT variable 13 95 13 101 AUTORECOVERY variable 13 96 13 101 autotrace report 9 2 AUTOTRACE variable 9 2 13 96 13 102 AVG function 7 17 background process startup after abnormal termination 13 129 batch mode 6 17 13 65 BEGIN command 5 7 disabling
51. 22 Displaying the Current Page Number in a Title To display the current page number at the top of each page along with the company name enter the following command TTITLE LEFT ACME WIDGET RIGHT PAGE SQL PNO SKIP 2 Now rerun the current query ACMEWIDGET PAGE 1 Formatting SQL Plus Reports 7 27 Defining Page and Report Titles and Dimensions DEPARTMENT_ID LAST_NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTIAL 6 rows selected Note that SQL PNO has a format ten spaces wide You can change this format with the FORMAT clause of TTITLE or BTITLE Example 7 23 Formatting a System Maintained Value in a Title To close up the space between the word PAGE and the page number reenter the TTITLE command as shown TTITLE LEFT ACME WIDGET RIGHT PAGE FORMAT 999 SOL PNO SKIP 2 Now rerun the query 5 il ACME WIDGET PAGE 1 DEPARTMENT_ID LAST_NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTIAL 6 rows selected 7 28 SQL Plus User s Guide and Reference Defining Page and Report Titles and Dimensions Listing Suppressing and Restoring Page Title Definitions To list a page title definition enter the appropriate title command with no clauses TTITLE BTITLE To suppress a title definition enter TTITLE OFF
52. 31 when truncated for CHAR and LONG columns 7 6 when truncated for DATE columns 7 6 when truncated for NUMBER columns 7 4 column separator 13 96 13 104 C 2 columns assigning aliases 13 30 computing summary lines 7 16 13 40 copying display attributes 7 9 13 17 13 34 copying values between tables B 2 B 5 B 9 displaying values in bottom titles 7 30 13 35 displaying values in top titles 7 29 13 34 formatting CHAR VARCHAR LONG and DATE 13 31 formatting in reports 7 2 13 29 formatting MLSLABEL RAW MLSLABEL ROWLABEL 13 31 formatting NUMBER 7 4 13 32 listing display attributes for all 7 9 13 29 listing display attributes for one 7 9 13 29 names in destination table when copying B 3 B 6 printing line after values that overflow 7 10 13 98 13 115 resetting a column to default display 7 10 13 30 C 2 resetting all columns to default display 13 27 restoring display attributes 7 10 13 17 13 36 setting printing to off oron 7 29 13 35 starting new lines 13 34 storing values in variables 7 29 13 34 suppressing display attributes 7 10 13 17 13 36 truncating display for all when value overflows 7 7 13 123 truncating display for one when value overflows 7 7 13 36 wrapping display for all when value overflows 7 7 13 123 wrapping display for one when value overflows 7 7 13 36 wrapping whole words for one 7 10 COLUMNS clause 13 27 comma number format 7 5 command file extension 13 98 co
53. 51 DEL Examples ca ca m Assume the SQL buffer contains the following query SELECT LAST_NAME DEPARTMENT_ID FROM EMP_DETAILS_VIEW WHERE JOB ID SA MAN ORDER BY DEPARTMENT ID To make the line containing the WHERE clause the current line you could enter LIST 3 3 WHERE JOB ID SA MAN followed by DEL The SQL buffer now contains the following lines SELECT LAST NAME DEPARTMENT ID FROM EMP DETAILS VIEW ORDER BY DEPARTMENT ID To delete the third line of the buffer enter DEL 3 The SQL buffer now contains the following lines SELECT LAST NAME DEPARTMENT ID FROM EMP DETAILS VIEW 13 52 SQL Plus User s Guide and Reference DESCRIBE DESCRIBE Syntax Terms Usage DESC RIBE f schema objeci Gconnect identifier Lists the column definitions for the specified table view or synonym or the specifications for the specified function or procedure Refer to the following list for a description of each term or clause schema Represents the schema where the object resides If you omit schema SQL Plus assumes you own object object Represents the table view type procedure function package or syn onym you wish to describe connect_identifier Consists of the database link name corresponding to the database where object exists For more information on which privileges allow access to another table in a different schema refer to the Oracle9i SQL Refere
54. 6 15 Using PROMPT and ACCEPT in Conjunction with Substitution Variables As you have seen in Example 6 14 SQL Plus automatically generates a prompt for a value when you use a substitution variable You can replace this prompt by including PROMPT and ACCEPT in the script with the query that references the substitution variable First clear the buffer with CLEAR BUFFER To create such a file enter the following PROMPT Enter a valid employee ID PROMPT For Example 145 206 ACCEPT ENUMBER NUMBER PROMPT Employee ID SELECT FIRST NAME LAST NAME SALARY FROM EMP DETAILS VIEW WHERE EMPLOYEE ID amp ENUMBER Save this file as PROMPT2 Next run this script SOL Plus prompts for the value of ENUMBER using the text you specified with PROMPT and ACCEPT START PROMPT2 SQL Plus prompts you to enter an Employee ID Enter a valid employee ID For Example 145 206 Employee ID 205 old 3 WHERE EMPLOYEE ID amp ENUMBER new 3 WHERE EMPLOYEE ID 205 Department Report FIRST NAME LAST NAME SALARY Shelley Higgins 12000 Using Scripts in SQL Plus 6 29 Writing Interactive Commands What would happen if you typed characters instead of numbers Since you specified NUMBER after the variable name in the ACCEPT command SQL Plus will not accept a non numeric value Try entering characters instead of numbers to the prompt for Employee ID SQL Plus will respond with an error message and prompt you again to
55. 7 13 126 SPOOL command 7 33 13 131 disabling 10 5 file name 7 34 13 131 OFF clause 7 24 13 131 OUT clause 7 35 13 131 to HTML file 4 8 turning spooling off 7 34 13 131 use with SET MARKUP 8 3 SQL buffer 5 2 SQL clause 13 28 SQL DML statements reporting on 13 96 13 102 SQL optimizer 9 3 SQL Plus command prompt 4 2 command summary 13 2 13 95 command line 2 2 configuring globalization support 12 2 database administration 11 2 execution plan 9 3 exiting 4 13 13 64 exiting conditionally 13 152 13 154 globalization support 12 1 limits A 1 obsolete command alternatives C 2 running commands in batch mode 6 17 setting up environment 3 2 shortcuts to starting 4 3 starting 4 2 4 3 statistics 9 4 system variables affecting performance 9 10 tuning 9 2 who can use 1 5 Index 19 SQL Plus error messages 14 2 SQLBLANKLINES variable 13 98 13 118 SQLCASE variable 13 98 13 119 SQLCODE clause 13 126 SHOW command 13 126 SQLCONTINUE variable 13 98 13 119 SQLNUMBER variable 13 98 13 120 SQLPLUS command 4 2 clause 4 4 clause 4 4 and at sign 4 3 4 21 6 15 and EXIT FAILURE 6 16 BODY option 4 6 commands SQLPLUS 43 connect identifier 4 11 connecting to a remote database 4 21 display syntax 4 4 ENTMAP option 4 6 HEAD option 4 6 HTML option 4 5 MARKUP clause 4 5 MARKUP option 4 4 MARKUP SPOOL clause 4 6 NOLOG clause 4 11 PREFORMAT option 4
56. 8 RESTRICT 4 9 10 8 running scripts 6 15 service name 4 11 4 21 SILENT clause 4 10 SILENT option 4 10 8 12 SPOOL clause 4 7 syntax 4 3 SYSDBA clause 4 11 TABLE option 4 6 unsuccessful connection 6 16 username password 4 2 4 10 SQL PNO referencing in report titles 7 27 SOLPREFIX variable 13 98 13 120 SOLPROMPT variable 13 98 13 120 SOL SOLCODE using in EXIT command 13 64 SOLTERMINATOR 13 118 SOLTERMINATOR variable 13 69 13 98 13 121 SSL security 10 9 Index 20 STANDBY DATAFILE clause 13 82 STANDBY TABLESPACE clause 13 82 START clause 13 14 13 139 START command 6 14 13 132 arguments 6 26 disabling 10 5 passing parameters to a script 6 26 script 6 14 13 132 similar to at sign command 6 14 13 6 13 133 similar to double at sign command 13 8 13 133 starting iSQL Plus 4 14 4 15 Oracle HTTP Server 3 13 SQL Plus 2 2 4 2 SQL Plus shortcuts 4 3 STARTUP command 13 134 FORCE clause 13 134 MOUNT clause 13 135 NOMOUNT clause 13 135 OPEN clause 13 135 PFILE clause 13 134 RECOVER clause 13 135 RESTRICT clause 13 134 specifying a database 13 135 statements executing 5 3 statistics 9 4 collecting TIMING statistics 9 7 interpreting iSQL Plus active statistics 9 13 iSQL Plus Server 2 12 iSQL Plus Server active statistics 9 12 STD function 7 17 STOP clause 13 14 13 139 stop query 5 12 stopping Oracle HTTP Server 3 13 STORE command 3 3 13 138
57. B 5 and l at sign B 2 B 5 and ARRAYSIZE variable B 4 B 8 and COPYCOMMIT variable B 4 B 8 and LONG variable B 4 B 8 APPEND clause B 3 B 7 copying data between databases B 5 copying data between tables on one database B 9 CREATE clause B 3 B 7 creating a table B 3 B 7 destination table B 3 B 6 determining actions B 6 determining source rows and columns B 3 B 6 disabling 10 5 FROM clause B 5 INSERT clause B 3 B 7 inserting data in a table B 3 B 7 interpreting messages B 8 mandatory connect identifier B 3 naming the source table with SELECT B 3 B 6 query B 3 B 6 referring to another user s table B 9 REPLACE clause B 3 B 7 replacing data in a table B 3 B 7 sample command B 5 B 6 service name B 5 B 8 B 9 specifying columns for destination B 3 B 6 specifying the data to copy B 3 B 6 TO clause B 5 username password B 2 B 5 B 8 B 9 USING clause B 3 B 6 copy command error messages 14 45 COPYCOMMIT variable 13 96 13 105 relationship to COPY command B 4 B 8 COPYTYPECHECK variable 13 96 13 105 COUNT function 7 17 CREATE clause in COPY command B 3 B 7 CREATE command disabling 10 5 entering PL SQL 5 6 creating a PLAN TABLE 9 2 creating flat files 7 34 creating PLUSTRACE role 9 3 creating sample tables 1 8 creating the PRODUCT USER PROFILE table 10 2 CSS user interface 3 11 cursor variables 13 147 D database connect identifier 13 46 mounting 13 135
58. CHAR 240 NUMBER 15 2 CHAR 240 DATE LONG Description and Use of PUP Columns The following list describes each column in the PUP table Product Userid Attribute Scope Must contain the product name in this case SQL Plus You cannot enter wildcards or NULL in this column Must contain the username in uppercase of the user for whom you wish to disable the command To disable the command for more than one user use SOL wild cards 6 or make multiple entries Thus all of the following entries are valid HR a CLASS1 a CLASS all users whose names start with CLASS a all users Must contain the name in uppercase of the SOL SOL Plus or PL SQL command to disable for example RUN If you are disabling a role it must contain the character string ROLES You cannot enter a wildcard See PUP Table Administration for a list of SQL and SQL Plus commands you can disable See Creating and Controlling Roles for information on how to disable a role Not used it is recommended that you enter NULL Other products may store specific file restrictions or other data in this column SQL Plus Security 10 3 Disabling SQL Plus SQL and PL SQL Commands Numeric_Value Not used it is recommended that you enter NULL Other products may store numeric values in this column Char_Value Must contain the character string DISABLED to disable a SQL SQL Plus or PL SQL command If you are disabli
59. Contents Send Us Your Comments 0 00 0 cccccccccccccscssessesssessessesseesessuessscsessessussessessuessessessusssseeessessessesseesess XV 1 e Sane arcane i et e eT OO nb PO RUNE NEN xvii Intended Audience iier teet ye eet andre ce spur e oV e den Pene debe ee EE Ro esee ee des Seedeurcdesouses xviii Documentation Accessibility sessin uag dte ente nih e preter tente aes xviii Documentation Str cU E e nibus eie rti a HE va Hav o UH Hb nv xix Related Doecunientation 2 dn gna e p eb ete iq ti pop oes xxi Conyventons d a mat ue nd IR ideo cet eae Oe don te eese eios Peuva leo Hales dur T xxiii What s New in SQL Plus 1 7st tentent tentent tentes xxix New Features in SQL Plus 92 eUam Refine ette d edes ite ete XXX New Features in 35 OE Plus 92 n deed ee tee dee e Ee eee eoa xxxii Upgrading iSQL Plus Server from 9 0 1 to 9 2 sse eee eene nnne nennen XXXIV New Features in SOL Plus 90 cos ete Hebe tete eee eA Se XXXVI SQL Plus Quick SAN o ete oe ake eke e aad aera thn xxxix ISOL P luis Quick Start ec eee ee cm te ete cete eile ed ea deett xl SQL Plus Command line Quick Start for Windows essent nennen xli SQL Plus Command line Quick Start for UNIX esses eene ether xlii Part SQL Plus Getting Started 1 SQL Plus Overview Whatis SOE Plus 22 gen Heel te e eR E edet Men E eH eI eo 12 SQL Plus Command line Architecture sess eene nennen rnnt nnne 1 4 1SOL
60. E SALARY gt 12000 The statement can be automatically traced when it is run SET AUTOTRACE ON LAST NAME SALARY JOB TITLE King 24000 President Kochhar 17000 Administration Vice President De Haan 17000 Administration Vice President Russell 14000 Sales Manager Partners 13500 Sales Manager Hartstein 13000 Marketing Manager 6 rows selected Execution Plan Tuning SQL Plus 9 5 Tracing Statements 0 SELECT STATEMENT Optimizer CHOOSE 1 0 TABLE ACCESS BY INDEX ROWID OF EMPLOYEES 2 Br NESTED LOOPS 3 2 TABLE ACCESS FULL OF JOBS 4 2 INDEX RANGE SCAN OF EMP JOB IX NON UNIQUE Statistics 0 recursive calls 2 db block gets 34 consistent gets 0 physical reads 0 redo size 848 bytes sent via SQL Net to client 503 bytes received via SQL Net from client SQL Net roundtrips to from client sorts memory sorts disk rows processed O0 0 n Example 9 5 Tracing Statements Without Displaying Query Data To trace the same statement without displaying the query data enter SET AUTOTRACE TRACEONLY 6 rows selected Execution Plan 0 SELECT STATEMENT Optimizer CHOOSE 1 0 TABLE ACCESS BY INDEX ROWID OF EMPLOYEES 2 T NESTED LOOPS 3 2 TABLE ACCESS FULL OF JOBS 4 2 INDEX RANGE SCAN OF EMP JOB IX NON UNIQUE 0 recursive calls 2 db block gets 34 consistent gets 9 6 SQL Plus User s Guide and Reference Tracing Parallel and Distributed Queries n
61. EAR option where option represents one of the following clauses BRE AKS BUFF ER COL UMNS COMP UTES SCR EEN SQL TIMI NG Resets or erases the current value or setting for the specified option Refer to the following list for a description of each term or clause BRE AKS Removes the break definition set by the BREAK command BUFF ER Clears text from the buffer CLEAR BUFFER has the same effect as CLEAR SQL unless you are using multiple buffers see the SET BUFFER command in Appendix C Obsolete SQL Plus Commands COL UMNS Resets column display attributes set by the COLUMN command to default settings for all columns To reset display attributes for a single column use the CLEAR clause of the COLUMN command CLEAR COLUMNS also clears the ATTRIBUTEs for that column COMP UTES Removes all COMPUTE definitions set by the COMPUTE command SCRIEEN Clears your screen CLEAR SCREEN is not available in iSQL Plus SQL Plus Command Reference 13 27 CLEAR SQL Clears the text from SQL buffer CLEAR SQL has the same effect as CLEAR BUFFER unless you are using multiple buffers see the SET BUFFER command in Appendix C Obsolete SQL Plus Commands TIMI NG Deletes all timers created by the TIMING command Examples To clear breaks enter CLEAR BREAKS To clear column definitions enter CLEAR COLUMNS 13 28 SQL Plus User s Guide and Reference COLUMN COLUMN Syntax Terms COL UMN column
62. EXCEPT ROLE1 ROLE2 SQL Plus Security 10 7 Disabling Commands with SQLPLUS RESTRICT To ensure that the user does not use the SET ROLE command to change their roles after login you can disable the SET ROLE command See Disabling SET ROLE for more information To re enable roles delete the row containing the restriction Disabling Commands with SQLPLUS RESTRICT Like the Product User Profile table the RESTRICT option allows you to disable certain commands that interact with the operating system However commands disabled with the RESTRICT option are disabled even when no connection to a server exists and remain disabled until SOL Plus terminates The following table shows which commands are disabled in each restriction level Command Level 1 Level 2 Level 3 EDIT disabled disabled disabled GET disabled HOST disabled disabled disabled SAVE disabled disabled SPOOL disabled disabled START disabled STORE disabled disabled Notes Disabling HOST also disables your operating system s alias for HOST such as on VMS and on UNIX Disabling the SQL Plus START command will also disable the SOL Plus and commands For more information about the RESTRICT option see the SQLPLUS RESTRICT Option on page 4 9 10 8 SQL Plus User s Guide and Reference iSQL Plus Security SQL Plus Security There are two main areas to consider for security and user authentication when using iSQL Plus
63. FROM string missing Oracle Net database specification Cause Missing connect string for the database that contains the data to be copied from in the COPY command Action Include a FROM clause to specify a source database other than the default SP2 0520 TO string missing Oracle Net database specification Cause Missing connect string for the database containing the destination table in the COPY command Action Include a TO clause to specify a source database other than the default SP2 0526 Misplaced INSERT keyword Cause The INSERT keyword was misplaced in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0540 File file name already exists Use SAVE filename ext REPLACE Cause The file specified already exists Action Use the REPLACE option to overwrite the existing file or specify another file name SP2 0544 Invalid command command name Cause An attempt was made to use a command that has been explicitly disabled for your schema in this database Action Ask your System Administrator why the Product User Profile PUP table has been set to disable this command for your schema SP2 0545 SET command requires an argument Cause An argument was missing in the SET command Action Check the syntax of the SET command for the correct options SP2 0546 User requested Interrupt or EOF detected Cause Either end of file was reached or CTRL C was entered to cancel the process
64. For more information about the createXML extract text and getStringVal functions and about creating and manipulating XMLType data see Oracle9i XML API Reference XDK and Oracle XML DB and Oracle9i XML Case Studies and Applications Copying Column Display Attributes E When you want to give more than one column the same display attributes you can reduce the length of the commands you must enter by using the LIKE clause of the COLUMN command The LIKE clause tells SQL Plus to copy the display attributes of a previously defined column to the new column except for changes made by other clauses in the same command Example 7 7 Copying a Column s Display Attributes To give the column COMMISSION_PCT the same display attributes you gave to SALARY but to specify a different heading enter the following command COLUMN COMMISSION_PCT LIKE SALARY HEADING BONUS Rerun the query LAST MONTHLY NAME SALARY BONUS Russell 14 000 0 Partners 13 500 0 Errazuriz 12 000 0 Cambrault 11 000 0 Zlotkey 10 500 0 Listing and Resetting Column Display Attributes To list the current display attributes for a given column use the COLUMN command followed by the column name only as shown below COLUMN column name To list the current display attributes for all columns enter the COLUMN command with no column names or clauses after it COLUMN Formatting SQL Plus Reports 7 9 Formatting Columns iv
65. HTIP Server domain machine name domain you must enter machine name domain 3 6 SQL Plus User s Guide and Reference iSQL Plus Configuration Retained Session Settings Certain settings from a session are either retained or automatically filled in the next time you log in to iSQL Plus from the same workstation Input area size Number of History entries Your username password and Output preference are not saved by iSQL Plus Configuring the Middle Tier jSQL Plus Server The iSQL Plus Server is installed during Oracle9i Database installation on the middle tier You can configure several parameters and settings in the iSQL Plus Server Session Integrity Each iSQL Plus login is uniquely identified so you can Connect multiple times from the same machine Connect multiple times from different machines iSQL Plus supports this stateful behavior by storing session context information in the Oracle HTTP Server You must ensure that your Oracle HTTP Server always routes HTTP requests to the same server otherwise the session context will not be found However you may find it useful to start more than one Oracle HTTP Server to distribute user load across the multiple servers Editing the iSQL Plus Configuration File You can edit the isglplus conf configuration file directly to change settings for iSQL Plus Server parameter settings such as iSQLPlusNumberOfThreads as iSQLPlusLogLeve iSQLPlusTimeOut
66. It also controls the position of centered and right aligned text in TTITLE BTITLE REPHEADER and REPFOOTER Changing the linesize setting can affect text wrapping in output from the DESCRIBE command DESCRIBE output columns are typically allocated a proportion of the linesize Decreasing or increasing the linesize may give unexpected text wrapping in your display You can define LINESIZE as a value from 1 to a maximum that is system dependent Refer to the Oracle installation and user s manual s provided for your operating system SET LOBOF FSET n 1 Example Sets the starting position from which CLOB and NCLOB data is retrieved and displayed To set the starting position from which a CLOB column s data is retrieved to the 22nd position enter SET LOBOFFSET 22 The CLOB data will wrap on your screen SQL Plus will not truncate until the 23rd character SET LOGSOURCE pathname Example C Specifies the location from which archive logs are retrieved during recovery The default value is set by the LOG_ARCHIVE_DEST initialization parameter in the Oracle initialization file init ora Using the SET LOGSOURCE command without a pathname restores the default location To set the default location of log files for recovery to the directory usr oracle90 dbs arch enter SET LOGSOURCE usr oracle90 dbs arch RECOVER DATABASE SQL Plus Command Reference 13 111 SET SET LONG 80 n Example ca Sets maximum
67. Login screen was empty Action Enter a username before attempting to log in SP2 0854 Password cannot be entered twice Cause An error occurred while parsing the Username and Password fields of the iSQL Plus Login screen Action Check that you haven t specified a password as part of the username for example scott tiger and simultaneously put the password in the Password field of the Login screen The password should appear once only This error occurs when iSQL Plus can t determine what password you intended to use SQL Plus Error Messages 14 35 iSQL Plus Error Messages SP2 0855 Connect identifier cannot be entered twice Cause An error occurred while trying to read the connection identifier in the Connection Identifier field of the iSQL Plus Login screen Action If the full connection syntax is used in the Username field for example username password connect_identifier then the Connection Identifier field must be empty SP2 0856 Usage CONN ECT username password GQ connect identifier AS ISYSOPERISYSDBA Cause iSQL Plus was unable to connect to an Oracle instance or the username and password were incorrect An incomplete or incorrect CONNECT command was specified in an iSQL Plus script Action All authentication information must be included in the CONNECT command in iSQL Plus Make sure that both a username and password are used SP2 0857 iSQL Plus restarted Cause Either the web server Oracle H
68. No action required SP2 0667 Message file facility lt lang gt msb not found Cause The SP1 SP2 or CPY message file could not be found SOL Plus cannot run Action Check the Oracle platform specific documentation to make sure SQL Plus is installed correctly This may occur because the ORACLE HOME environment variable or registry equivalent is not set to the location of the Oracle software Make sure this value is set correctly Check that the SOL Plus binary message files exist in the SOL Plus message directory for example ORACLE HOME sglplus mesg Check the value of NL5 LANG environment variable or registry equivalent is correct SP2 0668 Invalid variable name Cause An invalid character was specified as part of the variable name Action Specify the variable with valid characters SP2 0669 Valid characters are alphanumerics and Cause An invalid character was specified as part of the variable name Action Specify the variable with alphanumeric characters and SP2 0670 Internal number conversion failed Cause A conversion request could not be performed because the string contained alphanumeric characters Action Make sure that the string only contains numeric digits SP2 0675 COPY command not available Cause The COPY command is not available in this version of SQL Plus Action Make a note of the message and the number then contact Oracle Support Services SP2 0676 Bind variable length cannot exceed variable
69. Oracle tools such as SQL Forms to exchange data through a network SOL Net supports distributed processing and distributed database capability SOL Net runs over and interconnects many communications protocols SQL Plus An interactive SQL based language for data manipulation data definition and the definition of access rights for an Oracle database Often used as an end user reporting tool statement SQL A SQL statement and analogous to a complete sentence as opposed to a phrase Portions of SOL statements or commands are called expressions predicates or clauses See also SOL statement string Any sequence of words or characters on a line substitution variable In SQL Plus a variable name or numeral preceded by one or two ampersands amp Substitution variables are used in a script to represent values to be provided when the script is run subtotal In a report a total of values in a number column taken over a group of rows that have the same value in a break field See also summary summary Summaries or summary columns are used to compute subtotals grand totals running totals and other summarizations of the data in a report summary line A line in a report containing totals averages maximums or other computed values You create summary lines through the BREAK and COMPUTE commands syntax The orderly system by which commands qualifiers and parameters are combined to form valid command strings SYS usern
70. PIus and then reference in PL SQL or SQL If you create a bind variable in SQL Plus you can use the variable as you would a declared variable in your PL SQL subprogram and then access the variable from SQL Plus You can use bind variables for such things as storing return codes or debugging your PL SQL subprograms Because bind variables are recognized by SQL Plus you can display their values in SQL Plus or reference them in PL SQL subprograms that you run in SQL Plus Creating Bind Variables You create bind variables in SOL Plus with the VARIABLE command For example VARIABLE ret val NUMBER This command creates a bind variable named ret val with a datatype of NUMBER For more information see the VARIABLE command on page 13 145 To list all bind variables created in a session type VARIABLE without any arguments Referencing Bind Variables You reference bind variables in PL SQL by typing a colon followed immediately by the name of the variable For example ret val 1 To change this bind variable in SQL Plus you must enter a PL SQL block For example VARIABLE ret val NUMBER BEGIN ret_val 4 END PL SQL procedure successfully completed This command assigns a value to the bind variable named ret_val Using Scripts in SQL Plus 6 31 Using Bind Variables Displaying Bind Variables To display the value of a bind variable in SQL Plus you use the SQL Plus PRINT command For example PRINT
71. POS SQL Plus will substitute the value MANAGER for amp POS and will not prompt you for a POS value To assign the CHAR value 20 to the variable DEPARTMENT ID type DEFINE DEPARTMENT ID 20 Even though you enter the number 20 SQL Plus assigns a CHAR value to DEPARTMENT ID consisting of two characters 2 and 0 To list the definition of DEPARTMENT ID enter DEFINE DEPARTMENT ID DEFINE DEPARTMENT ID 20 CHAR This result shows that the value of DEPARTMENT ID is 20 13 50 SQL Plus User s Guide and Reference DEL DEL Syntax Terms Usage DEL is not available in iSQL Plus DEL n n m n n LAST n LAST LAST Deletes one or more lines of the buffer Refer to the following list for a description of each term or clause n Deletes line n nm Deletes lines n through m n Deletes line n through the current line nLAST Deletes line n through the last line Deletes the current line n Deletes the current line through line n LAST Deletes the current line through the last line LAST Deletes the last line Enter DEL with no clauses to delete the current line of the buffer DEL makes the following line of the buffer if any the current line You can enter DEL several times to delete several consecutive lines Note DEL is aSQL Plus command and DELETE is a SOL command For more information about the SOL DELETE command see the Oracle9i SOL Reference SQL Plus Command Reference 13
72. PPED WOR D WRAPPEDJITRU NCATED I Controls whether to display output that is DBMS_OUTPUT PUT_LINE of stored procedures or PL SQL blocks in SQL Plus OFF suppresses the output of DBMS_ OUTPUT PUT_LINE ON displays the output SIZE sets the number of bytes of the output that can be buffered within the Oracle8i or Oracle9i database server The default for n is 2000 1 cannot be less than 2000 or greater than 1 000 000 SQL Plus Command Reference 13 115 SET Example 13 116 n When WRAPPED is enabled SQL Plus wraps the server output within the line size specified by SET LINESIZE beginning new lines when required When WORD WRAPPED is enabled each line of server output is wrapped within the line size specified by SET LINESIZE Lines are broken on word boundaries SQL Plus left justifies each line skipping all leading whitespace When TRUNCATED is enabled each line of server output is truncated to the line size specified by SET LINESIZE For each FORMAT every server output line begins on a new output line For more information on DBMS_OUTPUT PUT_LINE see your Oracle9i Application Developer s Guide Fundamentals To enable text display in a PL SQL block using DBMS OUTPUT PUT LINE enter SET SERVEROUTPUT ON The following example shows what happens when you execute an anonymous procedure with SET SERVEROUTPUT ON BEGIN DBMS OUTPUT PUT LINE Task is complete END Task is
73. Plus Command Summary section and the SET MARKUP command on page 13 112 for more information about these commands SOLPLUS MARKUP HTML ON is useful when embedding SQL Plus in program scripts On starting it outputs the HTML and BODY tags before executing any commands All subsequent output is in HTML until SQL Plus terminates The SILENT and RESTRICT command line options may be effectively used with MARKUP to suppress the display of SOL Plus prompt and banner information and to restrict the use of some commands SET MARKUP HTML ON SPOOL ON generates an HTML page for each subsequently spooled file The HTML tags in a spool file are closed when SPOOL OFF is executed or SOL Plus exits You can use SET MARKUP HTML ON SPOOL OFF to generate HTML output suitable for embedding in an existing web page HTML output generated this way has no lt HTML gt or lt BODY gt tags Creating Reports During a SQL Plus session use the SET MARKUP command interactively to write HTML to a spool file You can view the output in a web browser SET MARKUP HTML ON SPOOL ON only specifies that SOL Plus output will be HTML encoded it does not create or begin writing to an output file You must use the SOL Plus SPOOL command to start generation of a spool file This file then has HTML tags including lt HTML gt and lt HTML gt When creating a HTML file it is important and convenient to specify a html or htm file extension which are standard file exte
74. RET_VAL RET_VAL This command displays a bind variable named ret_val For more information about displaying bind variables see the PRINT command on page 13 77 Using REFCURSOR Bind Variables SQL Plus REFCURSOR bind variables allow SQL Plus to fetch and format the results of a SELECT statement contained in a PL SQL block REFCURSOR bind variables can also be used to reference PL SQL cursor variables in stored procedures This allows you to store SELECT statements in the database and reference them from SQL Plus A REFCURSOR bind variable can also be returned from a stored function Note You must have Oracle7 Release 7 3 or above to assign the return value of a stored function to a REFCURSOR variable Example 6 16 Creating Referencing and Displaying REFCURSOR Bind Variables To create reference and display a REFCURSOR bind variable first declare a local bind variable of the REFCURSOR datatype VARIABLE employee info REFCURSOR Next enter a PL SOL block that uses the bind variable in an OPEN FOR SELECT statement This statement opens a cursor variable and executes a query See the PL SQL User s Guide and Reference for information on the OPEN command and cursor variables In this example we are binding the SQL Plus employee info bind variable to the cursor variable BEGIN OPEN employee info FOR SELECT EMPLOYEE ID SALARY FROM EMP DETAILS VIEW WHERE 6 32 SQL Plus User s Guide and Reference Usi
75. Reference SET SET Syntax Usage Sets a system variable to alter the SQL Plus environment settings for your current session for example display width for data customize HTML formatting enabling or disabling the printing of column headings thenumber of lines per page You can also use the System Variables screen in iSQL Plus to set system variables SET system variable value where system variable and value are shown in the SET System Variable Summary following SQL Plus maintains system variables also called SET command variables to enable you to setup a particular environment for a SQL Plus session You can change these system variables with the SET command and list them with the SHOW command SET ROLE and SET TRANSACTION are SQL commands see the Oracle9i SQL Reference for more information When not followed by the keywords TRANSACTION or ROLE SET is assumed to be a SOL Plus command SET System Variable Summary System Variable Page Description SET APPINFO4ONJOFF text 13 99 Sets automatic registering of scripts through the DBMS APPLICATION INFO package SET ARRAYSIZE 15 n 13 100 Sets the number of rows called a batch that SOL Plus will fetch from the database at one time SET AUTOCOMMIT ON OFF IMMEDIATE n 13 101 Controls when Oracle commits pending changes to the database SET AUTOPRINT ONJOFF 13 101 Sets the automatic printing of bind variables SQL Plus Command Refer
76. S Government or anyone licensing or using the programs on behalf of the U S Government the following notice is applicable Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are commercial computer software and use duplication and disclosure of the Programs including documentation shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement Otherwise Programs delivered subject to the Federal Acquisition Regulations are restricted computer software and use duplication and disclosure of the Programs shall be subject to the restrictions in FAR 52 227 19 Commercial Computer Software Restricted Rights June 1987 Oracle Corporation 500 Oracle Parkway Redwood City CA 94065 The Programs are not intended for use in any nuclear aviation mass transit medical or other inherently dangerous applications It shall be the licensee s responsibility to take all appropriate fail safe backup redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes and Oracle Corporation disclaims liability for any damages caused by such use of the Programs Oracle is a registered trademark and Oracle7 Oracle8 Oracle8i Oracle9i PL SQL iSQL Plus SOL Plus SOL Net Oracle Store Pro C C and Pro COBOL are trademarks or registered trademarks of Oracle Corporation Other names may be trademarks of their respective owners
77. SOL or PL SQL statement at the end of the Input area even if it is incomplete or does not have a final or If you intend to run iSQOL Plus scripts in the SQL Plus command line you should make sure you use a 7 or to terminate your statements iSQL Plus retains the state of your current system variables and other options from one execution to the next If you use the History screen to re execute a script you may get different results from those previously obtained depending on the current system variable values Some SQL Plus commands have no logical sense or are not applicable in iSQL Plus See Appendix D Commands Not Supported in iSQL Plus for a list of SOL Plus commands not supported in iSQL Plus Running SQL Commands The SOL command language enables you to manipulate data in the database See your Oracle9i SQL Reference for information on individual SOL commands Example 5 1 Entering a SQL Command In this example you will enter and execute a SOL command to display the employee number name job and salary of each employee in the EMP DETAILS VIEW view 1 Atthe command prompt enter the first line of the command SELECT EMPLOYEE ID LAST NAME JOB ID SALARY SQL Plus Basics 5 3 Running SQL Commands If you make a mistake use Backspace to erase it and re enter When you are done press Return to move to the next line SQL Plus will display a 2 the prompt for the second line
78. SOL statement to produce output serially Line 2 also shows that the parallel query server had the identifier Q2000 Numbers identifying parallel report lines cross reference the line of the parent report For example in the last line of the above example 4 PARALLEL COMBINED WITH PARENT The 4 refers to the 4 3 TABLE ACCESS line in the parent report Tuning SQL Plus 9 9 System Variables Influencing SQL Plus Performance n Example 9 8 To monitor disk reads and buffer gets SET AUTOTRACE ON TRACEONLY STATISTICS The following shows typical results Statistics 70 recursive calls 0 db block gets 591 consistent gets 404 physical reads 0 redo size 315 bytes sent via SQL Net to client 850 bytes received via SQL Net from client 3 SQL Net roundtrips to from client 3 sorts memory 0 sorts disk 0 rows processed If consistent getsorphysical reads is high relative to the amount of data returned it indicates that the query is expensive and needs to be reviewed for optimization For example if you are expecting less than 1 000 rows back and consistent gets is 1 000 000and physical reads is 10 000 further optimization is needed Note Youcan also monitor disk reads and buffer gets using V SQL or TKPROF System Variables Influencing SQL Plus Performance The following system variables can influence SQL Plus performance SET APPINFO OFF Sets automatic registering of scripts through the DBMS_AP
79. SQL Plus commands COPY HOST SET EDIT PASSWORD SPOOL EXECUTE QUIT START EXIT RUN GET SAVE Notes Disabling HOST also disables your operating system s alias for HOST such as on VMS and on UNIX Disabling the SQL Plus SET command will also disable the SQL SET CONSTRAINTS SET ROLE and SET TRANSACTION commands Disabling the SQL Plus START command will also disable the SOL Plus and commands You can also disable the following SQL commands ALTER GRANT SET CONSTRAINTS ANALYZE INSERT SET ROLE AUDIT LOCK SET TRANSACTION CONNECT NOAUDIT TRUNCATE CREATE RENAME UPDATE DELETE REVOKE DROP SELECT You can also disable the following PL SQL commands BEGIN DECLARE Note Disabling BEGIN and DECLARE does not prevent the use of the SOL Plus EXECUTE command EXECUTE must be disabled separately SQL Plus Security 10 5 Creating and Controlling Roles Example 10 1 Setting Restrictions in the PUP Table This is an example of how to insert a row into the PUP table to restrict the user HR from using the SELECT statement 1 Log in as SYSTEM with the command SQLPLUS SYSTEM your password 2 Inserta row into the PUP table with the command INSERT INTO PRODUCT USER PROFILE VALUES SQL Plus HR SELECT NULL NULL DISABLED NULL NULL 3 Connect as HR and try to SELECT something CONNECT HR your password SELECT FROM EMP DETAILS VIEW This command ca
80. Syntax Terms QXurl file name ext arg Runs the SQL Plus statements in the specified script The script can be called from the local file system or from a web server Only the url form is supported in iSQL Plus Refer to the following for a description of the term or clause url Specifies the Uniform Resource Locator of a script to run on the speci fied web server SQL Plus supports HTTP and FIP protocols file name ext Represents the script you wish to run If you omit ext SOL Plus assumes the default command file extension normally SQL For infor mation on changing the default extension see the SUFFIX variable of the SET command on page 13 121 When you enter file_name ext SQL Plus searches for a file with the filename and extension you specify in the current default directory If SQL Plus does not find such a file SOL Plus will search a sys tem dependent path to find the file Some operating systems may not support the path search See the Oracle installation and user s man ual s provided for your operating system for specific information related to your operating system environment arg Represent data items you wish to pass to parameters in the script If you enter one or more arguments SOL Plus substitutes the values into the parameters amp 1 amp 2 and so forth in the script The first argument replaces each occurrence of amp 1 the second replaces each occurrence of amp 2 and so forth
81. TO lt db gt lt opt gt lt table gt lt cols gt USING lt sel gt db database string e g hr hr d chicago mktg opt ONE of the keywords APPEND CREATE INSERT or REPLACE lt table gt name of the destination table cols a comma separated list of destination column aliases sel any valid SOL SELECT statement Cause Usage for COPY command was specified incorrectly Action Specify a valid option SP2 0495 FROM and TO clauses both missing specify at least one Cause The FROM and TO clauses were missing from the COPY statement Action Specify at least one clause Check the syntax of the command you used for the correct options SP2 0496 Misplaced FROM clause Cause The FROM keyword was in the wrong position in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0497 Misplaced TO clause Cause The TO keyword was in the wrong position in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0498 Missing parenthetical column list or USING keyword Cause A parenthetical list was missing in the column list or the USING keyword is missing in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0499 Misplaced APPEND keyword Cause The APPEND keyword was in the wrong position in the COPY command Action Check the syntax of the COPY command for the correct options SQL Plus E
82. The command DEFINEs the parameters with the values of the argu ments if you run the script again in this session you can enter new arguments or omit the arguments to use the current values SQL Plus Command Reference 13 5 at sign Usage Examples x5 For more information on using parameters refer to the subsection Sub stitution Variables in iSQL Plus under Writing Interactive Com mands on page 6 24 All previous settings like COLUMN command settings stay in effect when the script starts If the script changes any setting then this new value stays in effect after the script has finished In a script you can include any command you would normally enter interactively typically SQL SQL Plus commands or PL SQL blocks An EXIT or QUIT command used in a script terminates SQL Plus The command functions similarly to START If the START command is disabled see Disabling SQL Plus SQL and PL SQL Commands on page 10 4 this will also disable the command See START on page 13 132 for information on the START command SQL Plus removes the SQLTERMINATOR a semicolon by default before the command is issued If you require a semicolon in your command add a second SQLTERMINATOR See the SQLTERMINATOR variable of the SET command in this chapter for more information To run a script named PRINTRPT with the extension SQL enter PRINTRPT To run a script named WKRPT with the extens
83. To reset the display attributes for a column to their default values use the CLEAR clause of the COLUMN command as shown below COLUMN column name CLEAR Example 7 8 Resetting Column Display Attributes to their Defaults To reset all column display attributes to their default values enter CLEAR COLUMNS columns cleared Suppressing and Restoring Column Display Attributes You can suppress and restore the display attributes you have given a specific column To suppress a column s display attributes enter a COLUMN command in the following form COLUMN column name OFF OFF tells SQL Plus to use the default display attributes for the column but does not remove the attributes you have defined through the COLUMN command To restore the attributes you defined through COLUMN use the ON clause COLUMN column name ON Printing a Line of Characters after Wrapped Column Values As you have seen by default SOL PIus wraps column values to additional lines when the value does not fit the column width If you want to insert a record separator a line of characters or a blank line after each wrapped line of output or after every row use the RECSEP and RECSEPCHAR variables of the SET command RECSEP determines when the line of characters is printed you set RECSEP to EACH to print after every line to WRAPPED to print after wrapped lines and to OFF to suppress printing The default setting of RECSEP is WRAPPED RECSEPCHAR sets the char
84. UPDATE INSERT and DELETE which can be used independently or within a PL SOL block specify changes you wish to make to the information stored in the database These changes are not made permanent until you enter a SOL COMMIT command or a SOL DCL or DDL command such as CREATE TABLE or use the autocommit feature The SQL Plus autocommit feature causes pending changes to be committed after a specified number of successful SQL DML transactions A SQL DML transaction is either an UPDATE INSERT or DELETE command or a PL SQL block You control the autocommit feature with the SOL Plus SET command s AUTOCOMMIIT variable Example 5 3 Turning Autocommit On To turn the autocommit feature on enter SET AUTOCOMMIT ON Alternatively you can enter the following to turn the autocommit feature on SET AUTOCOMMIT IMMEDIATE Until you change the setting of AUTOCOMMIT SQL Plus automatically commits changes from each SOL DML command that specifies changes to the database After each autocommit SQL Plus displays the following message COMMIT COMPLETE When the autocommit feature is turned on you cannot roll back changes to the database To commit changes to the database after a number of SOL DML commands for example 10 enter SET AUTOCOMMIT 10 SQL Plus counts SOL DML commands as they are executed and commits the changes after each 10 SQL DML command SQL Plus Basics 5 11 Stopping a Command while itis Running E
85. Use a higher version of the Oracle Server SP2 0617 Cannot construct a unique STATEMENT_ID Cause Unable to construct a unique statement ID in AUTOTRACE Action Check that AUTOTRACE is configured and that you have the PLUSTRACE role enabled SP2 0618 Cannot find the Session Identifier Check PLUSTRACE role is enabled Cause Unable to find the session identifier Action Check that the PLUSTRACE role has been granted SP2 0619 Error while connecting Cause An error occurred while AUTOTRACE attempted to make a second connection to the database instance Action Check that the database limit on number of active sessions has not been exceeded SP2 0620 Error while disconnecting Cause An error occurred while AUTOTRACE attempted to disconnect from the database instance Action Check that the database is still available SQL Plus Error Messages 14 27 SQL Plus Error Messages SP2 0621 Error ORA error_number while gathering statistics Cause No data was found in the PLAN_TABLE while gathering statistics using AUTOTRACE Action Refer to the Oracle9i Database Error Messages for the specified ORA error message SP2 0622 Starting line number must be less than ending line number Cause The starting line number specified is larger than the ending number Action Re enter the starting line number with a smaller line number SP2 0623 Error accessing PRODUCT_USER_PROFILE Warning Product user profile information not loaded
86. a SQL Plus Command line Quick Start for UNIX Some Resources Here are some resources you might find useful when working with iSQL Plus a SQL Plus Discussion Forum at http www oracle com forums a SQL Plus on the Oracle Technology Network at http otn oracle com tech sql_plus a SQL Plus Product and Documentation feedback by emailing sqlplus oracle com XXXIX isQL Plus Quick Start Do the following steps to start iSQL Plus xl 1 2 Connect to the Internet or your intranet and start your web browser Enter your Oracle9i HTTP Server URL followed by isqlplus in your web browser s Location or Address field The iSQL Plus URL looks like this http machine name domain port isqlplus If you do not know the Oracle9i HTTP Server URL ask your System Administrator Press Enter to go to the URL The iSQL Plus Login screen is displayed in your web browser Enter your Oracle9i username and password in the Username and Password fields If you do not know your Oracle9i username and password ask your Database Administrator Leave the Connection Identifier field blank to connect to the default database Enter the Oracle Net database alias to connect to a database other than the default If restricted database access has been configured the Connection Identifier field will be a dropdown list of available databases you can select Click Login to connect to the database The iSQL Plus Work screen is displayed in your web
87. access the Interface Options screen You use the Interface Options screen to set Input area size Whether output is directed to the Work screen to file or to another web browser window a History size See iSQL Plus User Interface Options Set system variables Click Set system variables or the adjacent Go button to access the System Variables screen You use the System Variables screen to set iSQL Plus system variables See Saving Changes to the Database Automatically Change your password Click Change your password or the adjacent Go button to access the Change Password screen See Changing Your Password in iSQL Plus on page 4 19 Go You can click the link or the Go button to navigate to the associated screen OK Cancel Click either the OK or the Cancel button to return to the iSQL Plus Work screen 2 8 SQL Plus User s Guide and Reference iSQL P lus User Interface isQL Plus User Interface Options In the Interface Options screen you can set the Input area size where to output script results and the number of scripts to retain in the History You access the Interface Options screen from the Preferences screen i Ee Edt View lll Favontes look Heb EJ 4 ORACLE 3 em A S Logout New History Preferences Help Session iSQL Plus Work Screen gt Preferences gt Interface Options Interface Options Input Area Eg Width 10 Height Output Work screen C New wi
88. an optional clause Suppose you want to delete the current line to the last line inclusive Use the DEL command as shown below DEL LAST DEL makes the following line of the buffer if any the current line For more information see the DEL command on page 13 51 Using Scripts in SQL Plus 6 9 Placing Comments in Scripts Placing Comments in Scripts You can enter comments in a script in three ways using the SQL Plus REMARK command for single line comments a using the SOL comment delimiters for single of multi line comments using ANSI ISO American National Standards Institute International Standards Organization comments for single line comments For further information about using comments in scripts see Notes on Placing Comments Using the REMARK Command Using Use the REMARK command on a line by itself in a script followed by comments on the same line To continue the comments on additional lines enter additional REMARK commands Do not place a REMARK command between different lines of a single SQL command REMARK Commission Report REMARK to be run monthly COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 COLUMN COMMISSION PCT HEADING COMMISSION FORMAT 90 90 REMARK Includes only salesmen SELECT LAST NAME SALARY COMMISSION PCT FROM EMP DETAILS VIEW WHERE JOB ID SA MAN Enter the SOL comment delimiters
89. and privilege Action No action required This is a debugging message SP2 0901 username username password password connect id connect_id Cause Displays iSQL Plus log in details username password and connection identifier Action No action required This is a debugging message SP2 0902 connect string username password sid privilege Cause Displays the complete syntax of the iSQL Plus connect string username password sid AS SYSDBA SYSOPER as produced by the SOL Plus connect API Action No action required This is a debugging message SP2 0911 Only a password is allowed in the password field Cause An attempt was made to enter a value other than a password in the iSQL Plus Login screen Password field Action Only a valid password is allowed in the Password field SP2 0912 Only a connect identifier is allowed in the connection identifier field Cause An attempt was made to enter a value other than a valid connection identifier in the SQL Plus Login screen Connection Identifier field Action Only a valid connection identifier or a valid alias is allowed in the Connection Identifier field SP2 0913 No keywords recognised by iSOL Plus Cause An attempt was made to request a service from iSQL Plus by manually typing the URL but no keywords were recognized Action Refer to the iSQL Plus documentation for the syntax and types of service that can be manually entered in a URL SP2 0914 Value value for ke
90. application role With these privileges they might issue SQL statements from SQL Plus that could wrongly change database tables To prevent application users from accessing application roles in SQL Plus you can use the PUP table to disable the SET ROLE command You also need to disable the BEGIN and SQL Plus EXECUTE commands to prevent application users setting application roles through a PL SQL block This allows a SOL Plus user only those privileges associated with the roles enabled when they started SQL Plus For more information about the creation and usage of user roles see your Oracle9i SQL Reference and Oracle9i Database Administrator s Guide Disabling User Roles To disable a role for a given user insert a row in the PUP table containing the user s username in the Userid column ROLES in the Attribute column and the role name in the Char_Value column Note When you enter PUBLIC or for the Userid column you disable the role for all users You should only use or PUBLIC for roles which are granted to PUBLIC If you try to disable a role that has not been granted to a user none of the roles for that user are disabled The Scope Numeric Value and Date Value columns should contain NULL For example PRODUCT USERID ATTRIBUTE SCOPE NUMERIC CHAR DATE VALUE VALUE VALUE SOL Plus HR ROLES ROLE SQL Plus PUBLIC ROLES ROLE2 During login these table rows are translated into the command SET ROLE ALL
91. break columns 7 14 13 18 storing current date in variable for titles 7 31 suppressing duplicate values 7 12 used in conjunction with COMPUTE 7 16 used in conjunction with SET COLSEP 13 104 used to format a REFCURSOR variable 13 147 used with COMPUTE 13 18 13 20 13 42 break definition listing current 7 16 13 21 removing current 7 16 13 27 BREAKS clause 7 16 13 27 browse button 2 6 2 15 browser web 8 2 BTITLE clause 13 124 BTITLE command 7 23 13 23 aligning title elements 13 142 BOLD clause 13 142 CENTER clause 13 142 COL clause 13 142 FORMAT clause 13 142 indenting titles 13 142 LEFT clause 13 142 OFF clause 13 141 old form C 3 printing blank lines before bottom title 7 26 referencing column value variable 13 35 RIGHT clause 13 142 SKIP clause 13 142 suppressing current definition 13 141 TAB clause 13 142 TTITLE command 13 23 buffer 5 2 appending text toalinein 6 8 13 12 delete a single line 6 4 delete the current line 6 4 delete the last line 6 4 deleting a range of lines 6 4 13 51 deleting a single line 13 51 deleting alllines 6 4 13 27 13 51 deleting lines from 6 9 13 51 deleting the current line 13 51 deleting the last line 13 51 executing contents 5 7 13 9 13 92 inserting new line in 6 7 13 71 listing a range of lines 6 5 13 73 listing a single line 6 4 13 73 listing alllines 6 4 13 73 listing contents 6 5 13 73 listing the current li
92. can control a column s display attributes for multiple SQL SELECT commands When you enter multiple COLUMN commands for the same column SOL Plus applies their clauses collectively If several COLUMN commands apply the same clause to the same column the last one entered will control the output To make the LAST NAME column 20 characters wide and display EMPLOYEE NAME on two lines as the column heading enter COLUMN LAST NAME FORMAT A20 HEADING EMPLOYEE NAME To format the SALARY column so that it shows millions of dollars rounds to cents uses commas to separate thousands and displays 0 00 when a value is zero enter COLUMN SALARY FORMAT 9 999 990 99 To assign the alias NET to a column containing a long expression to display the result in a dollar format and to display NULL for null values you might enter COLUMN SALARY COMMISSION_PCT BONUS EXPENSES INS TAX ALIAS NET 13 36 SQL Plus User s Guide and Reference COLUMN COLUMN NET FORMAT 9 999 999 99 NULL NULL Note that the example divides this column specification into two commands The first defines the alias NET and the second uses NET to define the format Also note that in the first command you must enter the expression exactly as you enter it in the SELECT command Otherwise SOL Plus cannot match the COLUMN command to the appropriate column To wrap long values in a column named REMARKS you can enter COLUMN REMARKS FORMAT A20 WRAP CUS
93. command 7 2 13 29 ALIAS clause 13 30 and BREAK command 13 20 and DEFINE command 13 49 CLEAR clause 7 10 13 30 DEFAULT clause C 3 displaying column values in bottom titles 7 30 13 35 displaying column values in top titles 7 29 13 34 entering multiple 13 36 ENTMAP clause 13 30 FOLD AFTER clause 13 30 13 31 FOLD BEFORE clause 13 31 FORMAT clause 7 5 7 6 13 31 formatting a REFCURSOR variable 13 147 formatting columns 7 6 formatting NUMBER columns 7 4 13 32 HEADING clause 7 2 13 34 HEADSEP character 13 34 JUSTIFY clause 13 34 LIKE clause 7 9 13 34 listing column display attributes 7 9 13 29 NEW VALUE clause 7 29 7 31 13 34 NEWLINE clause 13 34 NOPRINT clause 7 29 13 35 NULL clause 13 35 OFF clause 7 10 13 36 OLD VALUE clause 7 30 13 35 ON clause 7 10 13 36 PRINT clause 13 35 resetting to default display 7 10 13 30 C 2 restoring column display attributes 7 10 13 36 storing current date in variable for titles 7 31 13 37 suppressing column display attributes 7 10 13 36 TRUNCATED clause 7 7 13 36 WORD_WRAPPED clause 7 7 7 10 13 36 WRAPPED clause 7 7 13 36 column headings aligning 13 34 changing 7 2 13 34 column headings continued changing character used to underline 13 99 13 123 changing to two or more words 7 3 13 34 displaying on more than one line 7 3 13 34 suppressing printing inareport 13 97 13 109 when truncated 13
94. complete PL SQL procedure successfully completed The following example shows what happens when you create a trigger with SET SERVEROUTPUT ON CREATE TRIGGER SERVER TRIG BEFORE INSERT OR UPDATE OR DELETE ON SERVER TAB BEGIN DBMS OUTPUT PUT LINE Task is complete END Trigger created INSERT INTO SERVER TAB VALUES TEXT Task is complete 1 row created SQL Plus User s Guide and Reference SET n 0M To set the output to WORD WRAPPED enter SET SERVEROUTPUT ON FORMAT WORD WRAPPED SET LINESIZE 20 BEGIN DBMS OUTPUT PUT LINE If there is nothing left to do DBMS OUTPUT PUT LINE shall we continue with plan B END If there is nothing left to do Shall we continue with plan B To set the output to TRUNCATED enter SET SERVEROUTPUT ON FORMAT TRUNCATED SET LINESIZE 20 BEGIN DBMS OUTPUT PUT LINE If there is nothing left to do DBMS OUTPUT PUT LINE shall we continue with plan B END If there is nothing shall we continue wi SET SHIFT INOUT VIS IBLE INV ISIBLE Example SET SHIFTINOUT is not supported in iSQL Plus Allows correct alignment for terminals that display shift characters The SET SHIFTINOUT command is useful for terminals which display shift characters together with data for example IBM 3270 terminals You can only use this command with shift sensitive character sets for example JAT6DBCS Use VISIBLE for terminal
95. correctly created in this column of the output data COLUMN DEPARTMENT NAME HEADING DEPARTMENT ENTMAP OFF COLUMN CITY HEADING CITY SET MARKUP HTML ON SPOOL ON enables SQL Plus to write HTML to a spool file The following SPOOL command triggers the writing of the HTML and lt BODY gt tags to the named file SPOOL report html After the SPOOL command anything entered or displayed on standard output is written to the spool file report html Enter a SOL query SELECT A HREF http oracle com DEPARTMENT_NAME htm1 gt DEPARTMENT_ NAME A DEPARTMENT NAME CITY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 Generating HTML Reports from SQL Plus 8 3 Creating Reports using Command line SQL P lus Enter the SPOOL OFF command SPOOL OFF The lt BODY gt and lt HTML gt tags are appended to the spool file report html before it is closed The output from report sq is a file report html that can be loaded into a web browser Open report html in your web browser It should appear something like the following File Edit View Search Go Bookmarks Tasks Help T SQL SELECT lt A HREF http oracle com DEPARTMENT_NAME html gt DEPARTMENT_NAME lt s A gt DEPARTMENT NAME CITY 2FROMEMP DETAILS VIEW 3 WHERE SALARY 12000 DEPARTMENT Executive Seattle Executive Seattle Executive Seattle Oxford Oxford Toronto 6 rows selected SQL
96. created are a SYS CHANGE ON INSTALL a SYSTEM MANAGER Starting SQL Plus 4 17 Login Username and Password C Default passwords and your database account password should be changed as soon as possible See Changing your Password following For further information about the default logins see the Oracle9i Database Administrator s Guide Once you have logged in you can connect under a different username with the SQL Plus CONNECT command The username and password must be valid for the database For example to connect the username TODD to the default database using the password FOX you could enter CONNECT TODD FOX In the command line interface if you omit the username and password SQL Plus prompts you for them You also have the option of typing only the username following CONNECT and omitting the password SQL Plus then prompts for the password Because CONNECT first disconnects you from your current database you will be left unconnected to any database if you use an invalid username and password in your CONNECT command If you log on or connect as a user whose account has expired SOL Plus prompts you to change your password before you can connect If an account is locked a message is displayed and connection as this user is not permitted until the account is unlocked by your DBA You can disconnect the username currently connected to Oracle without leaving SQL Plus by entering the SOL Plus command DISCONNECT Chan
97. data is stored with a length as entered If data entered is more than 4000 bytes an error occurs For more information about the VARCHAR2 datatype refer to the Oracle9i SQL Reference variable A named object that holds a single value SQL Plus uses bind substitution system and user variables view A view can be thought of as a stored query presenting data from one or many tables A view does not actually contain or store data but derives data from the base tables on which it is based Views can be queried updated inserted into and deleted from Operations on a view affect the view s base tables width The width of a column parameter or layout object Width is measured in characters a space is a character wrapping A reporting or output feature in which a portion of text is moved to a new line when the entire text does not fit on one line XMLType datatype A standard Oracle datatype The XMLType datatype is used to store XML documents which can be operated on and can be selected like other Oracle datatypes An XMLType can store up to 2 gigabytes of XML data comment delimiter 6 11 hyphen clause 4 4 continuing a long SQL Plus command 5 9 13 1 period 5 7 slash command default logon 4 11 13 46 entered at buffer line number prompt 5 5 13 9 entered at command prompt 5 7 13 9 executing current PL SOL block 5 7 executing current SOL command 5 7 similar to RUN 5 7 13 9 13 92 us
98. datatype name format Cause The value entered in the ACCEPT command was not in the specified datatype Action Correct the datatype and re enter SP2 0598 value_name does not match input format format_name Cause The value entered in the ACCEPT command was not in the specified format Action Correct the format and try again SP2 0599 Usage SET EDITF ILE filenamel ext Cause Required filename was missing after the SET EDITFILE command Action Check the syntax of the SET EDITFILE command for the correct options SQL Plus Error Messages 14 25 SQL Plus Error Messages SP2 0603 Usage Illegal STORE command STORE SET filename ext CRE ATE REP LACE APP END Cause An invalid option was used in the STORE command Action Check the syntax of the STORE command for the correct options SP2 0605 File file_name already exists Use another name or STORE SET filename ext REPLACE Cause The file specified in the STORE command already exists Action Use the REPLACE option to overwrite the existing file or specify another file name SP2 0606 Cannot create file file_name Cause The STORE command was unable to create the specified file There may be insufficient disk space too many open files or read only protection on the output directory Action Check that there is sufficient disk space and that the protection on the directory allows file creation SP2 0607 Cannot close STORE file file_name Cause
99. during the current session you would be prompted for TABLE because its name has a single ampersand and the variable is therefore not DEFINEd but not for GROUP_COL or NUMBER_COL because their names have double ampersands and the variables are therefore DEFINEd Before continuing set the system variable VERIFY back to ON SET VERIFY ON Restrictions You cannot use substitution variables in the buffer editing commands APPEND CHANGE DEL and INPUT nor in other commands where substitution would be meaningless such as in SOL Plus comments REMARK or The buffer editing commands APPEND CHANGE and INPUT treat text beginning with amp or amp amp literally as any other text string System Variables The following system variables specified with the SOL Plus SET command affect substitution variables SET DEFINE Defines the substitution character by default the ampersand amp and turns substitution on and off SET ESCAPE Defines an escape character you can use before the substitution character The escape character instructs SQL Plus to treat the substitution character as an ordinary character rather than as a request for variable substitution The default escape character is a backslash SET VERIFY ON Lists each line of the script before and after substitution SET CONCAT Defines the character that separates the name of a substitution variable or parameter from characters that immediately fol
100. each department and for all departments Suppressing Duplicate Values in Break Columns The BREAK command suppresses duplicate values by default in the column or expression you name Thus to suppress the duplicate values in a column specified in an ORDER BY clause use the BREAK command in its simplest form 7 12 SQL Plus User s Guide and Reference Clarifying Your Report with Spacing and Summary Lines n BREAK ON break column Note Whenever you specify a column or expression in a BREAK command use an ORDER BY clause specifying the same column or expression If you do not do this breaks occur every time the column value changes Example 7 10 Suppressing Duplicate Values in a Break Column To suppress the display of duplicate department numbers in the query results shown above enter the following commands BREAK ON DEPARTMENT ID For the following query which is the current query stored in the buffer SELECT DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY 12000 ORDER BY DEPARTMENT ID DEPARTMENT ID LAST NAME SALARY 20 Hartstein 13000 80 Russell 14000 Partners 13500 90 King 24000 Kochhar 17000 De Haan 17000 6 rows selected Inserting Space when a Break Column s Value Changes You can insert blank lines or begin a new page each time the value changes in the break column To insert n blank lines use the BREAK command in the following form BREAK ON b
101. expr option where option represents one of the following clauses ALI AS alias CLE AR ENTMAP ONJOFF FOLD A FTER FOLD B EFORE FOR MAT format HEA DING text JUS TIFY L EFT C ENTER C ENTRE R IG HT LIKE fexpral as NEWL INE NEW V ALUE variable NOPRI NT PRI NT NULI L text OLD V ALUE variable ONJOFF WRA PPED WOR D WRAPPED TRU NCATED Specifies display attributes for a given column such as a text for the column heading alignment of the column heading format for NUMBER data wrapping of column data Also lists the current display attributes for a single column or all columns Enter COLUMN followed by column or expr and no other clauses to list the current display attributes for only the specified column or expression Enter COLUMN with no clauses to list all current column display attributes Refer to the following list for a description of each term or clause SQL Plus Command Reference 13 29 COLUMN column expr ALI AS alias CLE AR Identifies the data item typically the name of a column in a SOL SELECT command to which the column command refers If you use an expression in a COLUMN command you must enter expr exactly as it appears in the SELECT command If the expression in the SELECT com mand is a b for example you cannot use b a or a b ina COLUMN command to refer to the expression in the SELECT command If you select columns with the same name fro
102. for a given object of Object Type type name If you select objects of the same Object Type an ATTRIBUTE command for that type name attribute name will apply to all such objects you refer ence in that session ALI AS alias Assigns a specified alias to a type name attribute name which can be used to refer to the type name attribute name in other ATTRIBUTE com mands CLE AR Resets the display characteristics for the attribute name The format specification must be a text constant such as A10 or 9 999 not a vari able 13 16 SQL Plus User s Guide and Reference ATTRIBUTE Usage Examples Eg FOR MAT format Specifies the display format of the column The format specification must be a text constant such as A10 or 9 999 not a variable LIKE type name attribute name alias Copies the display characteristics of another attribute LIKE copies only characteristics not defined by another clause in the current ATTRIBUTE command ONJOFF Controls the status of display characteristics for a column OFF disables the characteristics for an attribute without affecting the characteristics definition ON reinstates the characteristics You can enter any number of ATTRIBUTE commands for one or more attributes All attribute characteristics set for each attribute remain in effect for the remainder of the session until you turn the attribute OFF or until you use the CLEAR COLUMN command Thus the ATTRIBUTE comma
103. gt spool off Business Tech Fune Interact In this example the prompts and query text have not been suppressed Depending on how you invoke a script you can use SET ECHO OFF or command line SILENT options to do this The SQL Plus commands in this example contain several items of usage worth noting a The hyphen used to continue lines in long SQL Plus commands a The TABLE option to set table WIDTH and BORDER attributes The COLUMN command to set ENTMAP OFF for the DEPARTMENT NAME column to enable the correct formation of HTML hyperlinks This makes sure that any HTML special characters such as quotes and angle brackets are not replaced by their equivalent entities amp quot amp amp amp lt and amp gt The use of quotes and concatenation characters in the SELECT statement to create hyperlinks by concatenating string and variable elements 8 4 SQL Plus User s Guide and Reference Creating Reports using Command line SQL P lus View the report html source in your web browser or in a text editor to see that the table cells for the Department column contain fully formed hyperlinks as shown html head lt TITLE gt Department Report lt TITLE gt lt STYLE type text css gt BODY background FFFFC6 gt lt STYLE gt meta name generator content SQL Plus 9 2 0 1 0 gt lt head gt lt body TEXT FFOOF gt SQL amp gt SELECT amp 1t A HREF amp quot http oracle com DEPA
104. home directory is located directly under ORACLE BASE All directory path examples in this guide follow OFA conventions Refer to Oracle9i Database Getting Started for Windows for additional information about OFA compliances and for information about installing Oracle products in non OFA compliant directories C gt exp scot QUERY WHER sal 16 C gt imp SYST FROMUSI t tiger 00N ERSSCO tt TABL TABLES emp E job SALESMAN EM password ES emp C gt net start OracleHOME NAMETNSListener Go to the ORACLE BASENORACLE HOMENrdbms admin directory and dept xxvii xxviii Whats New in SQL Plus This section describes new features of SOL Plus Release 9 2 and provides pointers to additional information New features information from previous releases is also retained to help those users migrating to the current release The following sections describe the new features in SOL Plus a New Features in SQL Plus 9 2 a New Features in iSQL Plus 9 2 Upgrading iSQL Plus Server from 9 0 1 to 9 2 a New Features in SQL Plus 9 0 1 xxix New Features in SQL Plus 9 2 XXX SQL Plus Release 9 2 0 is a superset of SOL Plus 9 0 1 This section describes new features introduced in this release of SQL Plus XMLType Support There is additional support for XMLType in SQL Plus The DESCRIBE command now provides details about XMLType columns and usage i
105. however JAWS may not always read a line of text that consists solely of a bracket or brace Accessibility of Links to External Web Sites in Documentation This documentation may contain links to Web sites of other companies or organizations that Oracle Corporation does not own or control Oracle Corporation neither evaluates nor makes any representations regarding the accessibility of these Web sites Documentation Structure This document contains SQL Plus Quick Start A brief guide to get you up and running after installation PART I SQL Plus Getting Started Provides an overview of SOL Plus describes the command line and iSQL Plus user interfaces provides configuration information and information you need to log in and run SQL Plus Chapter 1 SQL Plus Overview An overview of SQL Plus with instructions on using this guide and information on what you need to run SQL Plus Provides introductory information about iSQL Plus architecture and the iSQL Plus browser based interface to SQL Plus Chapter 2 SQL Plus User Interface Describes the command line and iSQL Plus user interfaces and the iSQL Plus Extension for Windows Chapter 3 Configuring SQL Plus Explains how to configure your SQL Plus command line and iSQL Plus environments Chapter 4 Starting SQL Plus Explains how to start connect to an Oracle database access the command line and online help and exit SOL Plus PART Il Using SQL Plus Contain
106. iSQL Plus URL argument that was not recognized by iSQL Plus or that is only available through an iSQL Plus DBA connection Action Remove the keyword or variable argument or use the iSOL Plus DBA URL instead of the iSQL Plus URL SP2 0889 The value specified for the keyword type must be either URL or TEXT Cause The value entered for the specified keyword was invalid Action Re enter the command using a valid value for the specified keyword Valid values for the keyword type are URL or TEXT SP2 0890 Instance not set or connect identifier not specified Cause No connect identifier or database instance was specified for the connect command or the SET INSTANCE command Action Re enter the command and specify a valid connect identifier or database instance SP2 0891 Enter connection details to load script Cause iSQL Plus could not log in to the server because there was no URL userid argument or the information supplied was insufficient or incorrect Action Log in via the Login screen to load the script into the Work Screen 14 40 SQL Plus User s Guide and Reference iSQL Plus Error Messages SP2 0892 Error expiring session Cause iSQL Plus could not close the timed out session identified by the user session Id Action No action required This is a debugging message SP2 0893 Expired session Cause iSQL Plus has expired the timed out session identified by the user session Id Cause No action requir
107. information about the EXECUTE command see Chapter 13 SOL Plus Command Reference Executing the Current SQL Command or PL SQL Block from the Command Prompt You can run or re run the current SOL command or PL SQL block by entering the RUN command or the slash command at the command prompt The RUN command lists the SOL command or PL SQL block in the buffer before executing the command or block the slash command simply runs the SQL command or PL SQL block Running PL SQL Blocks You can also use PL SQL subprograms called blocks to manipulate data in the database See your PL SQL User s Guide and Reference for information on individual PL SQL statements To enter a PL SQL subprogram in SQL Plus you need to be in PL SQL mode You are placed in PL SOL mode when You type DECLARE or BEGIN at the SQL Plus command prompt After you enter PL SQL mode in this way type the remainder of your PL SQL subprogram Youtype a SOL command such as CREATE FUNCTION that creates a stored procedure After you enter PL SQL mode in this way type the stored procedure you want to create SQL Plus treats PL SQL subprograms in the same manner as SOL commands except that a semicolon or a blank line does not terminate and execute a block Terminate PL SQL subprograms by entering a period by itself on a new line You can also terminate and execute a PL SQL subprogram by entering a slash by itself on a new line SQL Plus st
108. is equivalent to SHUTDOWN NORMAL You must be connected to a database as SYSOPER or SYSDBA You cannot connect via a multi threaded server For more information about connecting to a database see the CONNECT command earlier in this chapter To shutdown the database in normal mode enter Database closed Database dismounted Oracle instance shut down 13 130 SQL Plus User s Guide and Reference SPOOL SPOOL Syntax Terms Usage Examples Eg SPOOL is not available in iSQL Plus Use preference settings to output to a file SPO OL file name ext OFF OUT Stores query results in a file or optionally sends the file to a printer Refer to the following list for a description of each term or clause file name ext Represents the name of the file to which you wish to spool SPOOL fol lowed by file name begins spooling displayed output to the named file If you do not specify an extension SPOOL uses a default extension LST or LIS on most systems OFF Stops spooling OUT Stops spooling and sends the file to your host computer s standard default printer This option is not available on some operating sys tems Enter SPOOL with no clauses to list the current spooling status To spool output generated by commands in a script without displaying the output on the screen use SET TERMOUT OFF SET TERMOUT OFF does not affect output from commands run interactively To record your output in the file DI
109. last name SIZE 20 gt lt INPUT TYPE submit VALUE Run Report lt FORM gt lt BODY gt lt HTML gt The name of the INPUT TYPE should be the same as either a column or substitution variable in your script for example lt INPUT TYPE text NAME last name SIZE 20 gt 8 14 SQL Plus User s Guide and Reference Creating Reports using iSQL Plus maps to the substitution variable Glast_name in the employee_name sql script Replace machine name domain with the host and domain names and port with the port number of your Oracle HTTP Server Save the HTML file on your Oracle HTTP Server Load the HTML file in your web browser Enter a name or partial name in the text field for example Fay Click the Run Report button iSQL Plus executes the script and displays the results in your web browser Example 8 6 Creating a Dynamic Script with Parameters and Login Details Create and save the following script to a file called employee_id sql on your Oracle HTTP Server SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ENTMAP OFF PROMPT lt H1 gt Employee Details for Employee Number amp eid lt H1 gt SET MARKUP HTML ENTMAP ON SELECT FROM EMPLOYEES WHERE EMPLOYEE ID amp eid Create an HTML file which contains lt HTML gt lt HEAD gt lt TITLE gt iSQL Plus Dynamic Report lt TITLE gt lt HEAD gt lt BODY gt lt H1 gt lt em gt i lt em gt SQL Plus Report Hl lt H2 gt Query by Em
110. least release 9 2 14 34 SQL Plus User s Guide and Reference iSQL Plus Error Messages iSQL Plus Error Messages SP2 0850 Command command name is not available in iSQL Plus Cause The command was not recognized by the SQL Plus engine or it is disabled in iSQL Plus This occurs if it is a command that does not have any meaning in iSQL Plus such as a SOL buffer editing command or it is not allowed for security reasons or it is an obsolete command Action Remove the command from your script If you used a disabled command check the documentation for a replacement command SP2 0851 Command beginning command name is not available in iSOL Plus Cause The command was not recognized or it is disabled in iSQL Plus This occurs if it is a command that does not have any meaning in iSQL Plus such as a SQL buffer editing command it is not allowed for security reasons or it is an obsolete command Action Remove the command from the script If you used a disabled command check the documentation for a replacement command SP2 0852 Option not available in iSQL Plus Cause The command option is not available in iSQL Plus This error usually occurs after SP2 158 or SP2 735 Some options are disabled in a web based context because they have no meaning they prevent proper operation or because they pose a security risk Action Remove the option from the command SP2 0853 Empty username field Cause The Username field of the iSQL Plus
111. line before beginning a new line SET LOBOFFSET n 1 13 111 Sets the starting position from which CLOB and NCLOB data is retrieved and displayed SET LOGSOURCE pathname 13 111 Specifies the location from which archive logs are retrieved during recovery SET LONG 80 n 13 112 Sets maximum width in bytes for displaying LONG CLOB NCLOB and XMLType values and for copying LONG values SET LONGCHUNKSIZE 80 n 13 112 Sets the size in bytes of the increments in which SQL Plus retrieves a LONG CLOB NCLOB or XMLIype value SET MARKUP HTML ONJOFF HEAD text 13 112 Outputs HTML marked up text which is the output BODY text TABLE text ENTMAP ON OFF used by iSQL Plus SPOOL ON OFF PREFORMAT ONJOFFJ SET NEWPAGE 1 n NONE 13 114 Sets the number of blank lines to be printed from the top of each page to the top title SET NULL text 13 114 Sets the text that represents a null value in the result of a SOL SELECT command SET NUMFORMAT format 13 114 Sets the default format for displaying numbers SET NUMWIDTH 10 n 13 114 Sets the default width for displaying numbers SET PAGESIZE 24 n 13 115 Sets the number of lines in each page SET PAUSE ON OFF text 13 115 Allows you to control scrolling of your terminal when running reports SET RECSEP WRAPPED EACHIOFF 13 115 RECSEP tells SOL Plus where to make the record separation SQL Plus Command Reference 13 97 SET System Variable Page Description SET RECS
112. must set AUTORECOVERY ON to use the RECOVER command in iSQL Plus Attempting to RECOVER a database with AUTORECOVERY OFF raises the error SP2 0872 SET AUTORECOVERY ON must be used in iSQL Plus SQL Plus Command Reference 13 79 RECOVER Terms Refer to the following list for a description of each term and clause AUTOMATIC Automatically generates the name of the next archived redo log file needed to continue the recovery operation Oracle uses the LOG_ ARCHIVE_DEST or LOG_ARCHIVE_DEST_1 and LOG_ARCHIVE_ FORMAT parameters or their defaults to generate the target redo log filename If the file is found the redo contained in that file is applied If the file is not found SQL Plus prompts you for a filename displaying a generated filename as a suggestion If you do not specify either AUTOMATIC or LOGFILE SQL Plus prompts you for a filename suggesting the generated filename You can then accept the generated filename or replace it with a fully qualified filename If you know the archived filename differs from what Oracle would generate you can save time by using the LOGFILE clause FROM location LOGFILE Specifies the location from which the archived redo log file group is read The value of location must be a fully specified file location follow ing the conventions of your operating system If you omit this parame ter SQL Plus assumes the archived redo log file group is in the location specified by the initialization pa
113. nnn 4 12 Exiting Command line SOL Plus sees e eee insan ii hni 4 13 Starting 1SOL PIus cinereo he ei ne dob ned be lp ete 4 14 Getting Help in jSOL Plus enea dte eo ene eoe ie e te dee Prim des 4 14 Exiting SOLE Plus eite e uen EI e ree orte nieht reet o eere ba doge coe E A Re get be asd 4 15 Starting iSQL Plus from a URL eee eee eee eene nennen nennen 4 15 Login Username and Password sees eene enn enne 4 17 Changing your Password erai eee ttem ettet de eie ener iren telo red dne 4 18 Changing Your Password in SOL PlIus sese eene nennen 4 19 Multi User oy stems ettet rane Tot etie be eie e Pe eee rie 4 20 oiriglexUser Systems e nte Dr n doe OE tee qiie tee prope qa ciere ter rere ir pereo geste 4 20 Database Connection Identifier sss eene nene en nnne 4 20 Connecting to a Remote Database as You Start SOL Plus esses 4 21 Connecting to a Remote Database Using the CONNECT Command 4 22 Part Il Using SQL Plus 5 vi SQL Plus Basics Entering and Executing Commands 0 seen 5 2 The SOL B ffef seed 5 ebrei e eie e ebat la obse t eb ae itte 5 2 Executing Commands annes dope een ERA e dive iba he eres 5 3 Running SOL Conimands 5 onere eee eee pregeti a de ea wea een elaine 5 3 Running PLE SOL Blocks taion cess ee ee e Uer REP ei Peri be ied 5 7 Running SQ
114. o GO d Pp UD Ue dee 13 139 HH INE CE one ite POSS ue cored E EE A A EE RAEE 13 141 UNDEFINE ede ee eto ett eie Ee eet eee uos een eig esee eee Une sues 13 144 VARIABLE oi cess dich ntu er re E e PRG e re aree t hte dee be tp rester EA Re Ed 13 145 WHENEVER OSERROR recibe ire ea tre b o be ttc ed b ee Eu Aiea 13 152 WHENEVER SOLERROR 2 none aeieipen gebe Pt i e e Epeen a EER neve 13 154 14 SQL Plus Error Messages SOL Plus Error Messages onneeceteaim ee a nice ERO EO es Pa eei AEE aaa ESE 14 2 iSOLE Plus Error Messages sete eee ede ete ene erede E ta erede 14 35 COPY Command Messages esie i e nennen eene 14 45 Part IV SQL Plus Appendixes A SQL Plus Limits B SQL Plus COPY Command COPY Command Syntax one eee t etii e eee rte En HE e Re ute Een reda B 2 Copying Data from One Database to Another sess B 5 Copying Data between Tables on One Database esses B 9 C Obsolete SQL Plus Commands D Commands Not Supported in iSQL Plus Glossary Index xiii xiv Send Us Your Comments SQL PIus User s Guide and Reference Release 9 2 Part No A90842 01 Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this document Your input is an important part of the information used for revision Did you find any errors Is the information clearly presented Do you need more information If so where Are the examples cor
115. of backslash enter SET ESCAPE ON SET FEED BACK 6 n ON OFF Displays the number of records returned by a script when a script selects at least n records ON or OFF turns this display on or off Turning feedback ON sets n to 1 Setting feedback to zero is equivalent to turning it OFF SET FLAGGER OFF ENTRY INTERMED IATE FULL Checks to make sure that SOL statements conform to the ANSI ISO SQL92 standard If any non standard constructs are found the Oracle Server flags them as errors and displays the violating syntax This is the equivalent of the SOL language ALTER SESSION SET FLAGGER command You may execute SET FLAGGER even if you are not connected to a database FIPS flagging will remain in effect across SOL Plus sessions until a SET FLAGGER OFF or ALTER SESSION SET FLAGGER OFF command is successful or you exit SOL Plus 13 108 SQL Plus User s Guide and Reference SET When FIPS flagging is enabled SQL Plus displays a warning for the CONNECT DISCONNECT and ALTER SESSION SET FLAGGER commands even if they are successful SET FLU SH ON OFF SET FLUSH is not supported in iSQL Plus Controls when output is sent to the user s display device OFF allows the host operating system to buffer output ON disables buffering Use OFF only when you run a script non interactively that is when you do not need to see output and or prompts until the script finishes running The use of FLUSH OFF may improve performa
116. on the Work screen WHENEVER SQLERROR EXIT SQL SQLCODE select column_does_not_exiSt from dual select column_does_not_exist from dual 2d ERROR at line 1 ORA 00904 invalid column name Disconnected from Oracle The following examples show that the WHENEVER SOLERROR command is not executed after errors with SOL Plus commands but it is executed if SOL commands or PL SQL blocks cause errors WHENEVER SQLERROR EXIT SQL SQLCODE column LAST name headling Employee Name Unknown COLUMN option HEADIING SHOW non_existed_option SQL Plus Command Reference 13 155 WHENEVER SQLERROR The following PL SQL block error causes SQL Plus to exit and return the SQL error code WHENEVER SQLERROR EXIT SQL SQLCODE begin SELECT COLUMN_DOES_NOT_EXIST FROM DUAL END SELECT COLUMN_DOES_NOT_EXIST FROM DUAL ERROR at line 2 ORA 06550 line 2 column 10 PLS 00201 identifier COLUMN DOES NOT EXIST must be declared ORA 06550 line 2 column 3 PL SQL SQL Statement ignored Disconnected from Oracle 13 156 SQL Plus User s Guide and Reference 14 SQL Plus Error Messages This appendix lists error messages with prefixes SP2 and CPY generated by SQL Plus and iSQL Plus This chapter contains information about a SQL Plus Error Messages a iSQL Plus Error Messages COPY Command Messages For error messages with prefixes such as ORA TNS and PLS generated by Oracle refer to the Oracle9i
117. or other subprograms Bind Variable exits the subprogram and returns you to SQL Plus ROLLBACK Executes a ROLLBACK statement and abandons pending changes to the database before exiting EXIT with no clauses commits and exits with a value of SUCCESS EXIT allows you to specify an operating system return code This allows you to run SQL Plus scripts in batch mode and to detect programmatically the occurrence of an unexpected event The manner of detection is operating system specific See the Oracle installation and user s manual s provided for your operating system for details The key words SUCCESS WARNING and FAILURE represent operating system dependent values On some systems WARNING and FAILURE may be indistinguishable The range of operating system return codes is also restricted on some operating systems This limits the portability of EXIT n and EXIT variable between platforms For example on UNIX there is only one byte of storage for return codes therefore the range for return codes is limited to zero to 255 If you make a syntax error in the EXIT options or use a non numeric variable SQL Plus performs an EXIT FAILURE COMMIT For information on exiting conditionally see the WHENEVER SQLERROR and WHENEVER OSERROR commands later in this chapter The following example commits all uncommitted transactions and returns the error code of the last executed SOL command or PL SQL block EXIT SQL SQLCODE SQL Plus Comman
118. page numbers in the old forms of TTITLE and BTITLE by defining a variable named page The default value of page is the formatting string page amp P4 To alter the format you can DEFINE page with a new formatting string as follows SET ESCAPE SQL DEFINE page Page amp P2 This formatting string will print the word page with an initial capital letter and format the page number to a width of two You can substitute any text for page and any number for the width You must set escape so that SQL Plus does not interpret the ampersand amp as a substitution variable See the ESCAPE variable of the SET command on page 13 108 for more information on setting the escape character SQL Plus interprets TTITLE in the old form if a valid new form clause does not immediately follow the command name If you want to use CENTER with TTITLE and put more than one word on a line you should use the new form of TTITLE For more information see the TTITLE command on page 13 141 Example To use the old form of TTITLE to set a top title with a left aligned date and right aligned page number on one line followed by SALES DEPARTMENT on the next line and PERSONNEL REPORT on a third line enter TTITLE SALES DEPARTMENT PERSONNEL REPORT C 8 SQL Plus User s Guide and Reference D Commands Not Supported in SQL Plus This appendix lists SQL Plus commands not supported in the iSQL Plus user interface Attempting to use any of the
119. re enter the correct number START PROMPT2 When SQL Plus prompts you to enter an Employee ID enter the word one instead of a number Enter a valid employee ID For Example 145 206 Employee ID one SP2 0425 one is not a valid number Sending a Message and Accepting Return as Input If you want to display a message on the user s screen and then have the user enter Return after reading the message use the SOL Plus command PAUSE For example you might include the following lines in a script PROMPT Before continuing make sure you have your account card PAUSE Press RETURN to continue Clearing the Screen If you want to clear the screen before displaying a report or at any other time include the SQL Plus CLEAR command with its SCREEN clause at the appropriate point in your script using the following format CLEAR SCREEN Before continuing to the next section reset all columns to their original formats and headings by entering the following command CLEAR COLUMNS 6 30 SQL Plus User s Guide and Reference Using Bind Variables Using Bind Variables Suppose that you want to be able to display the variables you use in your PL SQL subprograms in SQL Plus or use the same variables in multiple subprograms If you declare a variable in a PL SQL subprogram you cannot display that variable in SOL Plus Use a bind variable in PL SQL to access the variable from SOL Plus Bind variables are variables you create in SOL
120. read by SQL Plus at startup SQL Plus To display and enter data in the Japanese character set using UTF 8 character encoding On UNIX do the following 1 Ensure you have exited your current SQL Plus session 2 Set the NLS_LANG variable using either set or setenv depending on the UNIX shell you are using For example in csh you would enter setenv NLS_LANG Japanese_Japan UTF8 On Windows do the following 1 Ensure you have exited your current SQL Plus session 2 Open System from the Control panel 3 Create a new environment variable NLS_LANG with a value of Japanese_ Japan UTF8 4 Restart Windows The NLS_LANG parameter has three components each controlling a subset of the globalization features Your operating system and keyboard must be able to support the character set you have chosen You may need to install additional support software For more information about NLS_LANG and software support see the Oracle9i Database Globalization Support Guide Oracle9i Database To store data in the Japanese character set using UTF 8 character encoding Ensure that your Oracle9i database has been created with the UTF8 character set See your Oracle9i Installation Guide for information about creating your database in a character set other than US7ASCII 12 2 SQL Plus User s Guide and Reference Configuring Globalization Support in iS QL P lus Configuring Globalization Support in SQL Plus To display another language
121. report footer on a separate page and to center it enter REPFOOTER PAGE CENTER END EMPLOYEE LISTING REPORT TTITLE RIGHT Page FORMAT 999 SQL PNO SELECT LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY 12000 LAST NAME SALARY King 24000 Kochhar 17000 De Haan 17000 Russell 14000 Partners 13500 Hartstein 13000 sum 98500 Page END EMPLOYEE LISTING REPORT 6 rows selected To suppress the report footer without changing its definition enter REPFOOTER OFF 13 88 SQL Plus User s Guide and Reference REPHEADER REPHEADER Syntax Terms REPH EADER PAGE printspec text variable ON OFF where printspec represents one or more of the following clauses used to place and format the text COL n S KIP n TAB n LE FT CE NTER R IGHT BOLD FORMAT text Places and formats a specified report header at the top of each report or lists the current REPHEADER definition Refer to the following list for a description of each term or clause These terms and clauses also apply to the REPFOOTER command PAGE lext variable Begins a new page after printing the specified report header or before printing the specified report footer The report header or footer text Enter text in single quotes if you want to place more than one word on a single line The default is NULL A user variable or any of the following system maintained values SOL LNO is the current line number SO
122. required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0381 command name is not available Cause The command specified is not implemented Action Use the appropriate SOL Plus command See the documentation for a list of commands and their correct syntax SP2 0382 The command name command is not available Cause The command was not recognized or it is disabled This occurs if itisa command that does not have any meaning in SQL Plus such as a SOL buffer editing command or it is not allowed for security reasons Action Remove the command from the script See the documentation for a list of commands and their correct syntax SP2 0392 Cannot UNDEFINE the current edit buffer Cause The current edit buffer cannot be undefined Action No action required SQL Plus Error Messages 14 17 SQL Plus Error Messages SP2 0394 Illegal buffer name buffer_name Cause An buffer name contained an illegal character for example hyphen Action Correct and remove the illegal character from the buffer name SP2 0395 Usage SOLPLUS lt option gt lt logon gt lt start gt Where option H V L M lt o gt R lt n gt S H displays the SOL Plus version banner and usage syntax V displays the SOL Plus version banner L attempts logon just once M o uses HTML markup options o R n uses restricted mode n S uses silent mode logon
123. s table ina COPY command by qualifying the table name with the username just as you would in your local database or in a query with a database link For example to make a local copy of a table named DEPARTMENT owned by the username ADAMS on the database associated with the Oracle Net connect identifier BOSTONDB you would enter COPY FROM HR your_password BOSTONDB CREATE EMPLOYEE COPY2 USING SELECT FROM ADAMS DEPT Of course you could get the same result by instructing COPY to log in to the remote database as ADAMS You cannot do that however unless you know the password associated with the username ADAMS Copying Data between Tables on One Database You can copy data from one table to another in a single database local or remote To copy between tables in your local database specify your own username and password and the service name for your local database in either a FROM or a TO clause omit the other clause COPY FROM HR your_password MYDATABASE INSERT EMPLOYEE COPY2 USING SELECT FROM EMPLOYEE COPY To copy between tables on a remote database include the same username password and service name in the FROM and TO clauses COPY FROM HR your_password BOSTONDB TO HR your_password BOSTONDB INSERT EMPLOYEE COPY2 USING SELECT FROM EMPLOYEE COPY SQL Plus COPY Command B 9 Copying Data between Tables on One Database B 10 SQL Plus User s Guide and Reference C Obsolete SQL Plus Commands
124. screen from your web browser with a URL like http machine name domain port isqlplus The Login screen is displayed f File Edt View Favorites Tools Help EJ E ORACLE C iSQL Plusa Help Login Username frrevorl Password ii Connection Identifier Login IEJ Done fit Local intranet A Username Enter a valid username to connect to Oracle9i Password Enter a valid password for the username SQL Plus User s Guide and Reference iSQL P lus User Interface Connection Identifier Leave this field blank to use the default Oracle database if one exists otherwise enter an Oracle Net alias to specify a remote database you want to connect to If you use an Oracle Net alias it must be defined on the machine running the iSQL Plus Server which may not be the same machine from which you run your web browser You can also use the full connection identifier for example DESCRIPTION ADDRESS PROTOCOL TCP HOST www oracle com PORT 1521 CONNECT DATA SERVICE NAME orashop us acme com iSQL Plus can be configured to restrict connections to specific databases If restricted database access has been enabled a dropdown list of available databases is displayed in place of the Connection Identifier text field This allows greater security for iSQL Plus Servers in hosted environments Login Click the Login button to log in to iSQL Plus with the supplied username password and connection identifi
125. setting at start or end of report 7 23 setting lines top of page to top title 7 32 13 97 13 114 C 2 setting lines top title to page end 13 97 13 115 setting top and bottom 7 23 13 23 13 141 C2 spacing between last row and bottom title 7 26 suppressing definition 7 29 13 141 TNS alias 2 5 2 11 4 21 TO clause B 5 tracing queries 9 7 tracing statements for performance statistics 9 5 for query execution path 9 5 using a databaselink 9 7 with parallel query option 9 8 TRIMOUT variable 13 98 13 122 TRIMSPOOL variable 13 99 13 123 TRUNCATE command disabling 10 5 TRUNCATE variable C 2 C 7 TRUNCATED clause 7 7 13 36 TTITLE clause 13 126 TTITLE command 7 23 13 141 aligning title elements 7 25 13 142 BOLD clause 13 142 CENTER clause 7 26 13 142 COL clause 7 26 13 142 FORMAT clause 7 28 13 142 indenting titles 7 26 13 142 LEFT clause 7 26 13 142 listing current definition 7 29 13 143 OFF clause 7 29 13 141 old form C 7 ON clause 7 29 referencing column value variable 7 29 13 34 restoring current definition 7 29 RIGHT clause 7 26 13 142 SKIP clause 7 26 13 142 suppressing current definition 7 29 13 141 TAB clause 13 142 tuning idle timeout 9 14 Index 22 iSQL Plus active statistics 9 12 isQLPlusHashTableSize 9 13 isQLPlusNumberOfThreads 9 13 iSOLPlusTimeOutInterval 9 14 SET APPINFO OFF 9 10 SET ARRAYSIZE 9 10 SET DEFINE OFF 9 11 SET FLUSH OFF 9 11 SET SERVE
126. t P CURE PER eo EE steaks 10 13 Database Administration with SOL Plus OWE VICW nen n E e Ene Be ede pe eq ee opt e iet esee ec ee wes Re 11 2 Introduction to Database Startup and Shutdown 2 sse 11 2 Database Startup n ne ree Eten e He tee dee ehe eee e ce een 11 2 Database Shutdown ois te E et e Lewes ette dees et pee re ee e e EE e Eaa 11 3 Redo Los Files iiec ekethe ndum teieenimieenimice nie it epo te dos 11 4 ARCHIVEEOG Mode unb b b ete eet P ibus 11 4 Database Recovery ebeonetee mie ihe ite ee P eerte 11 5 SQL Plus Globalization Support Configuring Globalization Support in Command line SOL Plus 12 2 Configuring Globalization Support in iSOL Plus eese eee 12 3 Part Ill SQL Plus Reference 13 SQL Plus Command Reference SOL Plus Command Summaary sees ee eene nnne nnne 13 2 Q at sign iniiaiith aeiia a aisne ite ici ane een He v Codes e ee ebd 13 5 double at sign eee b Hee ete epe iir d bi lien 13 7 J Slash 4 tete tea eee Et bm e n iei die i eee RR asec oes 13 9 ACCEPT eret eet eritasceteb tastes ette egets tete est etL ene esu etu eter t LTD Hee I SUL TIS 13 10 APPEND eb eode id s pti rU e Irt T e 13 12 ARCHIVE LOG Unione eene eerte aet bg e Cra RET UL rose diede 13 13 ATTRIBUTE hehe RD ne eee ates ea o aee 13 16 BREAK qq H EES 13 18 BTILLE ne hbEROhRRERURE eret treni ve imn obruo E tn derit ds 13
127. text editors and paste them directly into the Input area In iSQL Plus the Save Script button enables you to save scripts to a text file You can also load scripts with the Load Script button Saving and loading scripts may be useful when editing and testing The SQL Buffer The area where SQL Plus stores your most recently entered SOL command or PL SQL block but not SOL Plus commands is called the SQL buffer The command or block remains there until you enter another If you want to edit or re run the current SOL command or PL SQL block you may do so without re entering it For more information about editing or re running a command or block stored in the buffer see Running Scripts on page 6 14 5 2 SQL Plus User s Guide and Reference Running SQL Commands SOL Plus does not store SOL Plus commands or the semicolon or slash characters you type to execute a command in the SQL buffer Executing Commands In command line SQL Plus you type a command and direct SQL Plus to execute it by pressing the Return key SQL Plus processes the command and re displays the command prompt when ready for another command In iSQL Plus you type a command or a script into the Input area and click the Execute button to execute the contents of the Input area The results of your script are displayed below the Input area by default Use the History screen to access and rerun commands previously executed in the current session iSQL Plus executes a
128. the current line Use the CHANGE command to correct the mistake This command has three parts separated by slashes or any other non alphanumeric character the word CHANGE or the letter C a the sequence of characters you want to change a the replacement sequence of characters The CHANGE command finds the first occurrence in the current line of the character sequence to be changed and changes it to the new sequence You do not need to use the CHANGE command to re enter an entire line Re enter the line by typing the line number followed by a space and the new text and pressing Return 6 6 SQL Plus User s Guide and Reference Editing Scripts in SQL Plus Example 6 4 Correcting the Error To change JO_ID to JOB_ID change the line with the CHANGE command CHANGE JO_ID JOB_ID The corrected line appears on your screen 1 SELECT EMPLOYEE_ID FIRST_NAME JOB_ID SALARY Now that you have corrected the error you can use the RUN command to run the command again RUN SQL Plus correctly displays the query and its result 1 SELECT EMPLOYEE ID LAST NAME JOB ID SALARY 2 FROM EMP DETAILS VIEW 3 WHERE JOB ID SA MAN EMPLOYEE ID LAST NAME JOB ID MONTHLY SALARY 145 Russell SA MAN 14 000 146 Partners SA MAN 13 500 147 Errazuriz SA MAN 12 000 148 Cambrault SA MAN 11 000 149 Zlotkey SA MAN 10 500 Note that the column SALARY retains the format you gave it in Example 5 2 Entering a SQL Plus Command
129. the default file extension that SOL Plus uses in commands that refer to scripts SET TAB ON OFF 13 122 Determines how SQL Plus formats white space in terminal output SET TERMOUT ON OFF 13 122 Controls the display of output generated by commands executed from a script SET TIME ON OFF 13 122 Controls the display of the current time SET TIMING ON OFF 13 122 Controls the display of timing statistics SET TRIMOUT ON OFF 13 122 Determines whether SQL Plus allows trailing blanks at 13 98 SQL Plus User s Guide and Reference the end of each displayed line SET System Variable Page Description SET TRIMSPOOL ON OFF 13 123 Determines whether SQL Plus allows trailing blanks at the end of each spooled line SET UNDERLINE cJONJOFF 13 123 Sets the character used to underline column headings in SQL Plus reports to c SET VERIFY ON OFF 13 123 Controls whether SOL Plus lists the text of a SOL statement or PL SQL command before and after SQL Plus replaces substitution variables with values SET WRAP ON OFF 13 123 Controls whether SQL Plus truncates the display of a SELECTed row if it is too long for the current line width SET command not available in iSQL Plus SET APPI NFO IONIOFF text Sets automatic registering of scripts through the DBMS APPLICATION INFO package This enables the performance and resource usage of each script to be monitored by your DBA The registered name appears in the M
130. the line containing the error Type the following SQL script SELECT CITY COUNTRY_NAME FROM EMP_DETAILS_VIEW WHERE SALARY 12000 Enter a slash at the command prompt to re execute the command in the buffer CITY COUNTRY_NAME Seattle United States of America Oxford United Kingdom Seattle United States of America SQL Plus Command Reference 13 9 ACCEPT ACCEPT Syntax Terms ACCEPT is not available in iSQL Plus ACC EPT variable NUM BER CHAR DATE FOR MAT format DEF AULT default PROMPT text NOP R OMPT HIDE Reads a line of input and stores it in a given user variable Refer to the following list for a description of each term or clause variable NUM BER CHAR DATE FOR MAT Represents the name of the variable in which you wish to store a value If variable does not exist SOL Plus creates it Makes the datatype of variable the datatype NUMBER If the reply does not match the datatype ACCEPT gives an error message and prompts again Makes the datatype of variable the datatype CHAR The maximum CHAR length limit is 240 bytes If a multi byte character set is used one CHAR may be more than one byte in size Makes reply a valid DATE format If the reply is not a valid DATE for mat ACCEPT gives an error message and prompts again The datatype is CHAR Specifies the input format for the reply If the reply does not match the specified format ACCEPT gives an error message a
131. the proper BREAK command and suppress the bottom title from the last example Formatting SQL Plus Reports 7 29 Defining Page and Report Titles and Dimensions E TTITLE LEFT Manager MGRVAR SKIP 2 BREAK ON MANAGER ID SKIP PAGE BTITLE OFF Finally enter and run the following query SELECT MANAGER ID DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE MANAGER ID IN 101 201 ORDER BY MANAGER ID DEPARTMENT ID Manager 10 DEPARTMENT ID LAST NAME SALARY 10 Whalen 4400 40 Mavris 6500 70 Baer 10000 100 Greenberg 12000 110 Higgins 12000 Manager 201 DEPARTMENT ID LAST NAME SALARY 20 Fay 6000 6 rows selected If you want to print the value of a column at the bottom of the page you can use the COLUMN command in the following form COLUMN column name OLD VALUE variable name SQL Plus prints the bottom title as part of the process of breaking to a new page after finding the new value for the master column Therefore if you simply referenced the NEW VALUE of the master column you would get the value for the next set of details OLD VALUE remembers the value of the master column that was in effect before the page break began Displaying the Current Date in Titles You can of course date your reports by simply typing a value in the title This is satisfactory for ad hoc reports but if you want to run the same report repeatedly 7 30 SQL Plus User s Guide and Reference Defining Pa
132. to connect to an operating system or software application such as the Oracle database Whereas the username or ID is public the secret password ensures that only the owner of the username can use that name or access that data PL SQL The 3GL Oracle procedural language extension of SQL PL SQL combines the ease and flexibility of SQL with the procedural functionality of a structured programming language such as IF THEN WHILE and LOOP Even when PL SQL is not stored in the database applications can send blocks of PL SQL to the database rather than individual SQL statements thereby reducing network traffic PL SQL is interpreted and parsed at runtime it does not need to be compiled procedure A set of SQL and PL SQL statements grouped together as an executable unit to perform a very specific task Procedures and functions are nearly identical the only difference between the two is that functions always return a single value to the caller while procedures do not return a value to the caller process 1 A thread of control in an operating system that is a mechanism in an operating system that can execute a series of steps Some operating systems use the terms job or task A process normally has its own private memory area in which it runs prompt 1 A message from a computer program that instructs you to enter data or take some other action 2 Word s used by the system as a cue to assist a user s response Such mess
133. to your operating system environment arg Data items you wish to pass to parameters in the script If you enter one or more arguments SQL Plus substitutes the values into the parame ters amp 1 amp 2 and so forth in the script The first argument replaces each occurrence of amp 1 the second replaces each occurrence of amp 2 and so on The START command DEFINEs the parameters with the values of the arguments if you START the script again in this session you can enter new arguments or omit the arguments to use the old values 13 132 SQL Plus User s Guide and Reference START Usage Examples For more information on using parameters refer to the subsection Sub stitution Variables in isQL Plus under Writing Interactive Com mands on page 9 2 All previous settings like COLUMN command settings stay in effect when the script starts If the script changes any setting then this new value stays in effect after the script has finished The at sign and double at sign commands function similarly to START Disabling the START command in the Product User Profile see Disabling SQL Plus SQL and PL SQL Commands on page 10 4 also disables the and commands See the at sign and double at sign commands in this chapter for further information on these commands The EXIT or QUIT command in a script terminates SQL Plus A file named PROMOTE with the extension SQL used to promot
134. user logs in to SQL Plus and maintains those restrictions for the duration of the session Changes to the PUP table will only take effect the next time the affected users log in to SQL Plus When SYSTEM SYS or a user authenticating with SYSDBA or SYSOPER privileges connects or logs in SQL Plus does not read the PUP table Therefore no restrictions apply to these users The PUP table applies only to the local database If accessing objects on a remote database via a database link the PUP table for the remote database does not apply The remote database cannot extract the username and password from the database link in order to determine that user s profile and privileges Creating the PUP Table You can create the PUP table by running the script named PUPBLD with the extension SOL as SYSTEM The exact format of the file extension and the location of the file are system dependent See the Oracle installation and user s manuals provided for your operating system or your DBA for more information Note If the table is created incorrectly all users other than privileged users will see a warning when connecting to Oracle that the PUP table information is not loaded SQL Plus User s Guide and Reference PRODUCT_USER_PROFILE Table PUP Table Structure The PUP table has the following columns PRODUCT USERID ATTRIBUTE SCOPE UMERIC_VALUE CHAR_VALUE DATE_VALUE LONG_VALUE NOT NULL CHAR 30 CHAR 30 CHAR 240
135. web tables PAGESIZE is the number of rows in an HTML table not the number of lines Each row may contain multiple lines The TTITLE BTITLE and column headings are repeated every PAGESIZE rows LINESIZE may have an effect on data if wrapping is on or for very long data Depending on data size they may be generated on separate lines which a browser may interpret as a space character TTITLE and BTITLE content is output to three line positions left center and right and the maximum line width is preset to 90 of the browser window These elements may not align with the main output as expected due to the way they are handled for web output Entity mapping in TTITLE and BTITLE is the same as the general ENTMAP setting specified in the MARKUP command If you use a title in your output then SQL Plus starts a new HTML table for output rows that appear after the title Your browser may format column widths of each table differently depending on the width of data in each column SET COLSEP and RECSEP only produce output in HTML reports when PREFORMAT is ON RESTRICT Option R ESTRICT 1 23 Allows you to disable certain commands that interact with the operat ing system This is similar to disabling the same commands in the Prod uct User Profile PUP table However commands disabled with the RESTRICT option are disabled even if there is no connection to a server and remain disabled until SQL Plus terminates If no RESTRICT optio
136. while inserting or appending to tables with the COPY command This is to facilitate copying to DB2 which requires that a CHAR be copied to a DB2 DATE SET DEF INE amp c ON OFF Sets the character used to prefix substitution variables to c ON or OFF controls whether SQL Plus will scan commands for substitution variables and replace them with their values ON changes the value of c back to the default amp not the most recently used character The setting of DEFINE to OFF overrides the setting of the SQL Plus Command Reference 13 105 SET SCAN variable For more information on the SCAN variable see the SET SCAN command on page C 6 SET DESCRIBE DEPTH 1 n ALL LINENUM ON OFF INDENT ON OFF Example Sets the depth of the level to which you can recursively describe an object The valid range of the DEPTH clause is from 1 to 50 If you SET DESCRIBE DEPTH ALL then the depth will be set to 50 which is the maximum level allowed You can also display the line number and indentation of the attribute or column name when an object contains multiple object types Use the SET LINESIZE command to control the width of the data displayed For more information about describing objects see DESCRIBE earlier in this chapter To describe the view EMP_DETAILS_VIEW to a depth of two levels and indent the output while also displaying line numbers first describe the view as follows DESCRIBE EMP_DETAILS_VIEW
137. width in bytes for displaying CLOB LONG NCLOB and XMLIType values and for copying LONG values The maximum value of n is 2 gigabytes To set the maximum number of bytes to fetch for displaying and copying LONG values to 500 enter SET LONG 500 The LONG data will wrap on your screen SQL Plus will not truncate until the 501st byte The default for LONG is 80 bytes SET LONGC HUNKSIZE 80 n Example amp Sets the size in bytes of the increments SQL Plus uses to retrieve a CLOB LONG NCLOB or XMLType value To set the size of the increments in which SQL Plus retrieves LONG values to 100 bytes enter SET LONGCHUNKSIZE 100 The LONG data will be retrieved in increments of 100 bytes until the entire value is retrieved or the value of SET LONG is reached whichever is the smaller SET MARK UP HTML ON OFF HEAD text BODY text TABLE text ENTMAP ON OFF SPOOL ON OFF PRE FORMAT ON OFF Outputs HTML marked up text which is the output used by iSQL Plus Beware of using options which generate invalid HTML output in iSQL Plus as it may corrupt the browser screen The HEAD and BODY options may be useful for dynamic reports and for reports saved to local files SET MARKUP only specifies that SOL Plus output will be HTML encoded You must use SET MARKUP HTML ON SPOOL ON and the SQL Plus SPOOL command to create and name a spool file and to begin writing HMTL output to it SET MARKUP has the same options a
138. will always be at least the value of SET NUMWIDTH SQL Plus normally displays numbers with as many digits as are required for accuracy up to a standard display width determined by the value of the NUMWIDTH variable of the SET command normally 10 If a number is larger than the value of SET NUMWIDTH SQL Plus rounds the number up or down to the maximum number of characters allowed You can choose a different format for any NUMBER column by using a format model in a COLUMN command A format model is a representation of the way you want the numbers in the column to appear using 9s to represent digits 7 4 SQL Plus User s Guide and Reference Formatting Columns Changing the Default Display The COLUMN command identifies the column you want to format and the model you want to use as shown below COLUMN column_name FORMAT model Use format models to add commas dollar signs angle brackets around negative values and or leading zeros to numbers in a given column You can also round the values to a given number of decimal places display minus signs to the right of negative values instead of to the left and display values in exponential notation To use more than one format model for a single column combine the desired models in one COLUMN command see Example 7 4 For a complete list of format models and further details see the COLUMN command on page 13 29 Example 7 4 Formatting a NUMBER Column To display SALARY
139. with a dollar sign a comma and the numeral zero instead of a blank for any zero values enter the following command COLUMN SALARY FORMAT 99 990 Now rerun the current query LAST MONTHLY AME SALARY COMMISSION Russell 14 000 4 Partners 13 500 23 Errazuriz 12 000 23 Cambrault 11 000 3 Zlotkey 10 500 2 Use a zero in your format model as shown above when you use other formats such as a dollar sign and wish to display a zero in place of a blank for zero values Formatting Datatypes When displaying datatypes you can either accept the SQL Plus default display width or you can change it using the COLUMN command The format model will stay in effect until you enter a new one reset the column s format with COLUMN column name CLEAR Formatting SQL Plus Reports 7 5 Formatting Columns or exit from SQL Plus Datatypes in this manual include the following types a CHAR a NCHAR a VARCHAR2 VARCHAR a NVARCHAR2 NCHAR VARYING a DATE a LONG a CLOB a NCLOB a XMLIType Default Display The default width of datatype columns is the width of the column in the database The column width of a LONG CLOB NCLOB or XMLType defaults to the value of SET LONGCHUNKSIZE or SET LONG whichever is the smaller The default width and format of unformatted DATE columns in SQL Plus is derived from the NLS parameters in effect Otherwise the default format width is A9 For more information on formatting DATE columns see
140. you to set up scripts that allow end user input defining user variables a substituting values in commands using the START command to provide values prompting for values Defining User Variables You can define variables called user variables for repeated use in a single script by using the SOL Plus DEFINE command Note that you can also define user variables to use in titles and to save your keystrokes by defining a long string as the value for a variable with a short name Example 6 10 Defining a User Variable To define a user variable LL NAME and give it the value SMITH enter the following command DEFINE L NAME SMITH To confirm the variable definition enter DEFINE followed by the variable name Using Scripts in SQL Plus 6 17 Writing Interactive Commands DEFINE L_NAME DEFINE L_NAME SMITH CHAR To list all user variable definitions enter DEFINE by itself at the command prompt Note that any user variable you define explicitly through DEFINE takes only CHAR values that is the value you assign to the variable is always treated as a CHAR datatype You can define a user variable of datatype NUMBER implicitly through the ACCEPT command You will learn more about the ACCEPT command later in this chapter To delete a user variable use the SQL Plus command UNDEFINE followed by the variable name Using Substitution Variables Suppose you want to write a query like the one in SALES
141. your system Use these operating system specific guides in conjunction with this SQL Plus User s Guide and Reference Throughout this guide examples showing how to enter commands use a common command syntax and a common set of sample tables The tables are described in Oracle9i Sample Tables and SQL Plus on page 1 6 You will find the Conventions in Code Examples on page xxiv particularly useful when referring to commands in this guide Oracle9i Sample Tables and SQL Plus Included with Oracle9i are a number of sample schemas The tutorial and examples in this guide use the EMP DETAILS VIEW view of the Human Resources HR sample schema In using the HR sample schema you will come to understand the concepts and operations of this guide This schema contains personnel records for a 1 6 SQL Plus User s Guide and Reference Oracle9i Sample Tables and SQL P lus fictitious company As you complete the exercises in this guide imagine that you are the personnel director for this company Dates in the sample tables use four digit years As the default date format in SQL Plus is DD MM YY dates displayed show only a two digit year Use the SOL TO CHAR function in your SELECT statements to control the way dates are displayed For further information about the sample schemas included with Oracle9i see the Oracle9i Sample Schemas guide Figure 1 1 shows a description of the view EMP_ DETAILS VIEW Figure 1 1 EMP DETAILS VIEW
142. 0 transitional Use SOLPLUS MARKUP HTML ON or SET MARKUP HTML ON SPOOL ON to produce standalone web pages SQL Plus will generate complete HTML pages automatically encapsulated with HTML and 4 4 SQL Plus User s Guide and Reference The SQLPLUS Command lt BODY gt tags The HTML tags in a spool file are closed when SPOOL OFF is executed or SQL Plus exits The SILENT and RESTRICT command line options may be useful when used in conjunction with MARKUP You can use SET MARKUP HTML ON SPOOL OFF to generate HTML output suitable for embedding in an existing web page Output gener ated this way has no lt HTML gt or lt BODY gt tags You can use MARKUP HTML ON to produce HTML output in either the lt PRE gt tag or in an HTML table Output to a table uses standard HTML lt TABLE gt lt TR gt and lt TD gt tags to automatically encode the rows and columns resulting from a query Output to an HTML table is now the default behavior when the HTML option is set ON You can generate output using HTML lt PRE gt tags by setting PREFORMAT ON Use the SHOW MARKUP command to view the status of MARKUP options The SQLPLUS MARKUP command has the same options and func tionality as the SET MARKUP command These options are described in this section For other information on the SET MARKUP command see the SET command in Chapter 13 SQL Plus Command Reference Note Depending on your operating system the complete markup_ op
143. 000 148 11000 149 10500 The procedure can be executed multiple times using the same or a different REFCURSOR bind variable VARIABLE pcv REFCURSOR EXECUTE EmpInfo_rpt pcv PL SQL procedure successfully completed PRINT pcv EMPLOYEE_ID SALARY 145 14000 146 13500 147 12000 148 11000 149 10500 Example 6 18 Using REFCURSOR Variables in Stored Functions Create a stored function containing an OPEN FOR SELECT statement CREATE OR REPLACE FUNCTION EmpInfo_fn RETURN cv types EmpInfo IS resultset cv types EmpInfoTyp BEGIN OPEN resultset FOR SELECT EMPLOYEE ID SALARY FROM EMP DETAILS VIEW WHERE JOB ID 2 SA MAN RETURN resultset END 6 34 SQL Plus User s Guide and Reference Using Bind Variables n Function created Execute the function VARIABLE rc REFCURSOR EXECUTE rc EmpInfo fn PL SQL procedure successfully completed Now print the bind variable PRINT rc EMPLOYEE ID SALARY 145 14000 146 13500 147 12000 148 11000 149 10500 The function can be executed multiple times using the same or a different REFCURSOR bind variable EXECUTE rc EmpInfo fn PL SQL procedure successfully completed PRINT rc EMPLOYEE ID SALARY 145 14000 146 13500 147 12000 148 11000 149 10500 Using Scripts in SQL Plus 6 35 Using Bind Variables 6 36 SQL Plus User s Guide and Reference T Formatting SQL Plus Report
144. 09 HEADING variable 13 109 HEADSEP variable 7 3 13 97 13 110 INSTANCE variable 13 97 13 110 Index 18 LINESIZE variable 7 25 7 32 13 97 13 111 LOBOFFSET variable 13 97 13 111 LOGSOURCE variable 13 97 13 111 LONG variable 13 97 13 112 B 8 LONGCHUNKSIZE variable 13 97 13 112 MARKUP clause 13 112 MAXDATA variable C 2 C 6 NEWPAGE variable 7 32 13 97 13 114 NULL variable 13 97 13 114 NUMFORMAT clause 3 3 NUMFORMAT variable 13 97 13 114 NUMWIDTH variable 7 4 13 33 13 97 13 114 PAGESIZE clause 3 3 PAGESIZE variable 5 4 7 32 13 97 13 115 PAUSEclause 3 3 PAUSE variable 5 15 13 97 13 115 RECSEP variable 7 10 13 98 13 115 RECSEPCHAR variable 7 10 13 98 13 115 SCAN variable C 2 C 6 SERVEROUTPUT variable 13 116 SHIFTINOUT variable 13 98 13 117 SPACE variable C 2 C 6 SOLBLANKLINES variable 13 118 SOLCASE variable 13 98 13 119 SOLCONTINUE variable 13 98 13 119 SQLNUMBER variable 13 98 13 120 SOLPLUSCOMPATIBILITY variable 13 98 13 120 SOLPREFIX variable 13 98 13 120 SOLPROMPT variable 13 98 13 120 SOLTERMINATOR variable 13 98 13 121 SUFFIX variable 13 98 13 121 TAB variable 13 98 13 122 TERMOUT variable 13 98 13 122 TIME clause 3 3 TIME variable 13 98 13 122 TIMING variable 13 98 13 122 TRIMOUT variable 13 98 13 122 TRIMSPOOL variable 13 99 13 123 TRUNCATE variable C 2 C 7 UNDERLINE variable 13 99 13 123 used to form
145. 1 000 147 Errazuriz SA MAN 12 000 146 Partners SA MAN 13 500 145 Russell SA MAN 14 000 Appending Text to a Line To add text to the end of a line in the buffer use the APPEND command 1 Usethe LIST command or just the line number to list the line you want to change 2 Enter APPEND followed by the text you want to add If the text you want to add begins with a blank separate the word APPEND from the first character of the text by two blanks one to separate APPEND from the text and one to go into the buffer with the text 6 8 SQL Plus User s Guide and Reference Editing Scripts in SQL Plus E Example 6 6 Appending Text to a Line To append a space and the clause DESC to line 4 of the current query first list line 4 LIST 4 4 ORDER BY SALARY Next enter the following command be sure to type two spaces between APPEND and DESC APPEND DESC 4 ORDER BY SALARY DESC Type RUN to verify the query 1 SELECT EMPLOYEE_ID LAST_NAME JOB_ID SALARY 2 FROM EMP_DETAILS_VIEW 3 WHERE JOB ID SA MAN 4 ORDER BY SALARY DESC EMPLOYEE ID LAST NAME JOB ID MONTHLY SALARY 145 Russell SA MAN 14 000 146 Partners SA MAN 13 500 147 Errazuriz SA MAN 12 000 148 Cambrault SA MAN 11 000 149 Zlotkey SA MAN 10 500 Deleting Lines To delete lines in the buffer use the DEL command 1 Usethe LIST command or just the line numbers to list the lines you want to delete 2 Enter DEL with
146. 13 123 SHOW SHOW Syntax Terms SHO W option where option represents one of the following terms or clauses system variable ALL BTI TLE ERR ORS FUNCTION PROCEDURE PACKAGE PACKAGE BODY TRIGGER VIEW TYPE TYPE BODY DIMENSION J AVA CLASS schema name LNO PARAMETERS parameter name PNO REL EASE REPF OOTER REPH EADER SGA SPOO L SQLCODE TTI TLE USER Shows the value of a SQL Plus system variable or the current SOL Plus environment SHOW SGA requires a DBA privileged login Refer to the following list for a description of each term or clause system variable Represents any system variable set by the SET command ALL Lists the settings of all SHOW options except ERRORS and 564 in alphabetical order BTI TLE Shows the current BTITLE definition ERR ORS FUNCTION PROCEDURE PACKAGE PACKAGE BODY TRIGGER VIEW TYPE TYPE BODY DIMENSION J AVA CLASS schema name 13 124 SQL Plus User s Guide and Reference SHOW E LNO Shows the compilation errors of a stored procedure includes stored functions procedures and packages After you use the CREATE com mand to create a stored procedure a message is displayed if the stored procedure has any compilation errors To see the errors you use SHOW ERRORS When you specify SHOW ERRORS with no arguments SQL Plus shows compilation errors for the most recently created or altered stored procedure When you
147. 15 RECOVER command continued LOGFILE clause 13 80 STANDBY DATABASE clause 13 81 STANDBY DATAFILE clause 13 82 STANDBY TABLESPACE clause 13 82 UNTIL CANCEL clause 13 81 UNTIL CONTROLFILE clause 13 82 UNTIL TIME clause 13 81 USING BACKUP CONTROL FILE clause 13 81 recovery RECOVER command 13 79 RECSEP variable 7 10 13 98 13 115 RECSEPCHAR variable 7 10 13 98 13 115 redo Log Files ARCHIVE LOG command 13 13 REFCURSOR bind variables in a stored function 6 32 REFCURSOR clause VARIABLE command 13 147 RELEASE clause 13 126 REMARK command 6 10 13 86 remote database connect identifier 2 5 2 11 4 21 removing sample tables 1 8 RENAME command disabling 10 5 REPFOOTER clause 13 126 REPFOOTER command 7 23 13 87 aligning footer elements 13 90 BOLD clause 13 90 CENTER clause 13 90 COL clause 13 90 FORMAT clause 13 90 indenting report footers 13 90 LEFT clause 13 90 OFF clause 13 90 RIGHT clause 13 90 SKIP clause 13 90 suppressing current definition 13 90 TAB clause 13 90 REPHEADER clause 13 126 REPHEADER command 7 23 13 89 aligning header elements 7 25 aligning heading elements 13 90 BOLD clause 13 90 CENTER clause 13 90 Index 16 COL clause 13 90 FORMAT clause 13 90 indenting headings 13 90 LEFT clause 13 90 OFF clause 13 90 PAGE clause 13 89 RIGHT clause 13 90 SKIP clause 13 90 suppressing current definition 13 90 TAB clause 13 90 REPLACE cla
148. 2 0110 Cannot create save file file name Cause An attempt was made to save the content of the SOL buffer to a file and the file could not be written Possible causes a Anerror was encountered when creating the destination file a A directory name specified in the SAVE statement was not found A system error made it impossible to open the file Action Take the following actions Check that the destination is valid and that there is sufficient space on the destination device Check the statement for a typing mistake in the directory name Then issue the statement again after correcting the directory name SP2 0111 Cannot close save file file name Cause The file was in use Action Release the file from the other process SP2 0116 Illegal SAVE command Cause An invalid option was used in the SAVE command Action Check the syntax of the SAVE command for the correct options 14 8 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0134 No symbols currently defined Cause No DEFINE symbols were defined Action No action required SP2 0135 Symbol symbol_name is UNDEFINED Cause The specified symbol was undefined Action Re enter the DEFINE command with an assignment clause or a valid symbol or variable name SP2 0136 DEFINE requires an equal sign Cause Expecting an equal sign after a symbol or variable name in the DEFINE command Action Specify an equal sign after the symbol or var
149. 23 CHANGE actae tue dt nes aie accio i DE ot Ree iL Siri 13 24 CLEAR iu men enea ee dtu MIC UN mt M near ak ett 13 27 COLUMN ett 13 29 COMPTUTE onere dieti i ene e t e ehh Eee oed de a e e ee tue 13 40 CONNEGTY 7e t ose E eE EE c atti LS ed seit sem 13 46 CORY em ALME DN NUN UIN RR MIND S 13 48 DEFINE 21 dote te rt ote eee ete ettet se eese d c E 260s e uel 13 49 DEL enenatis 13 51 DESCRIBE ueste a bete edid tt eben bn eie m fede es 13 53 DISCONNECT iioa pa Boone iet eh cibo E EE brat 13 60 EDIT oine PEE 13 61 EXECUTE e520 sett cenae ne E S eu TA catu E E R 13 63 dup 13 64 SC M M 13 66 HELP honin mananan eto teieene ait dede aene ton ee TR PED Ge dne etie orn 13 68 HOST e nian ie iaai aaie oispas 13 69 INPBUT e e E TEE ERE E E E E E E 13 71 IS T E mead ceca ita estate E E ec te ctn p EE EE 13 73 PASSWORD inet ette Pate tea a see e E d dh Eod iere 13 75 PAUSE aiei iienaa eidem n m bi n dese nen i EE rne peres del 13 76 PRINT tete retenti etre duode eee bli deed cete ter reb re iei rrt Gusts He 13 77 PROMPT nei senila eoa ot aea neat nadie bii nitent b ete n PC Hp rU eed 13 78 RECOVER psio ioe eme Gee astu teilte iia ioo ettet one B ee 13 79 REMARXK itas eet cuet Ae aca BRIG i ete teles et ree e ge eT a Mantes 13 86 idudelouuuird EET 13 87 REPHEXADER eei a e EROR AA S Re e ENTE a eee te e Sete Bie 13 89 dU 13 92 P MU S 13 93 Joe RED EE EEEE EN AAE 13 95 SET APPI NFO ON OF
150. 29 displaying values together in output 7 12 OUT clause 7 35 13 131 output formatting white space in 13 122 pausing during display 5 15 13 115 output options file 2 9 new window 2 9 work screen 2 9 P PAGEclause 13 89 page number including in titles 7 15 7 27 pages changing length 7 31 13 97 13 115 default dimensions 7 31 matching to screen or paper size 7 31 setting dimensions 7 31 PAGESIZE clause in LOGIN SQL 3 3 PAGESIZE variable 5 4 7 32 13 97 13 115 parameter files INIT ORA files specifying alternate 13 134 parameters 6 26 13 5 13 132 idle timeout 9 14 iSQL Plus server 2 14 isQLPlusHashTableSize 9 13 isQLPlusNumberOfThreads 9 13 iSQLPlusTimeOutInterval 9 14 PARAMETERS clause 13 125 parsing httpd conf file 3 15 password 4 17 changing iniSQL Plus 2 8 4 19 password continued changing with the PASSWORD command 13 75 field 2 4 2 11 HTTP Server authentication 2 10 in CONNECT command 4 18 4 22 13 46 in COPY command B 5 B 8 B 9 in SQLPLUS command 4 2 4 10 4 21 viewable warning 4 10 PASSWORD command 13 46 13 75 disabling 10 5 PAUSE command 6 30 13 76 in LOGIN SQL 3 3 PAUSE variable 5 15 13 97 13 115 performance of SQL statements 9 2 over dial up lines 13 122 period terminating PL SQL blocks 5 7 13 96 13 102 PLAN_TABLE table 9 2 PLAN_TABLE creating 9 2 PL SQL 5 7 blocks PL SQL 5 7 executing 13 63 formatting output in SQL Plus 13 147
151. 3 131 Stores query results in an operating system file and optionally sends the file to a printer START 13 132 Runs the SQL Plus statements in the specified script The script can only be called from a url in iSQL Plus It can be called from the local file system or from a web server in command line SQL Plus STARTUP 13 134 Starts an Oracle instance and optionally mounts and opens a database STORE 13 138 Saves attributes of the current SQL Plus environment in a host operating system file a script TIMING 13 139 Records timing data for an elapsed period of time lists the current timer s title and timing data or lists the number of active timers TTITLE 13 141 Places and formats a specified title at the top of each report page or lists the current TTITLE definition UNDEFINE 13 144 Deletes one or more user variables that you defined either explicitly with the DEFINE command or implicitly with an argument to the START command VARIABLE 13 145 Declares a bind variable that can be referenced in PL SQL WHENEVER 13 152 Exits SOL Plus if an operating system command generates an OSERROR error Performs the specified action if an operating system command generates an error WHENEVER 13 154 Exits SOL Plus if a SQL command or PL SQL block generates an SQLERROR error Performs the specified action if a SOL command or PL SQL block generates an error 13 4 SQL Plus User s Guide and Reference at sign at sign
152. 3 141 formatting in titles 7 28 T TAB clause 13 90 13 142 TAB variable 13 98 13 122 TABLE clause 4 6 TABLE option 4 6 tables access to sample 1 8 controlling destination when copying B 3 B 7 copying values between B 2 B 5 B 9 listing column definitions 5 13 13 53 referring to another user s when copying B 9 TABLESPACE clause 13 81 tablespaces recovering 13 79 tag HTML 8 2 TERMOUT variable 13 98 13 122 using with SPOOL command 13 131 text 46 adding to current line with APPEND 6 8 13 12 changing old to new with CHANGE 6 6 13 24 clearing from buffer 6 4 13 27 text editor host operating system 6 2 13 61 three tier model 1 4 TIME clause in LOGIN SQL 3 3 TIME variable 13 98 13 122 TIMING clause 13 28 TIMING command 9 7 13 139 deleting all areas created by 13 28 deleting current area 13 139 SHOW clause 13 139 START clause 13 139 STOP clause 13 139 TIMING variable 13 98 13 122 titles aligning elements 7 25 13 142 displaying at bottom of page 7 23 13 23 C 2 displaying at top of page 7 23 13 141 C 2 displaying column values 7 29 13 34 13 35 displaying current date 7 30 13 35 13 37 displaying page number 7 27 13 143 displaying system maintained values 7 27 13 141 formatting elements 13 142 formatting system maintained values in 7 28 indenting 7 26 13 142 Index 21 titles continued listing current definition 7 29 13 23 13 143 restoring definition 7 29
153. AGGER OFF ENTRY INTERMED IATE FULL eee 13 108 SEL TLU SH ON ORE rere teret te tr deter ee te a c eanit 13 109 SET HEA DING ION lOEE 5 eiecit re s eeeeeesee ciere ert e aceon ette nne 13 109 SELIEADS EP TH eT OINTGRBE crees toten t ee Fert tte tre tn eerte 13 110 SET INSTANCE instance path LOCAL sees 13 110 SET JBIN ESIZE 80 mp usi ott E etie tt P beet HERR d 13 111 SET ROBOE BSET ills eie t eh t ee rte eee eit erede 13 111 SET LOGSOURGE pathname tt etre eet teme 13 111 Xi SEI LONG SUI i eeann aan Aa a Rute fette ie SE OMM d 13 112 SET LONGC HUNKSIZE 80 11 onni 13 112 SET MARK UP HTML ON OFF HEAD text BODY text TABLE text ENTMAP ON OFF SPOOL ON OFF PRE FORMAT ONI OFF 13 112 SET NEWP AGE 1 n NONE ect erectione e o ettet addidi 13 114 TO NUD et Gosh th Secs CRECEN 13 114 SET NUMF ORMAT format sen scsciricn sige tice tons ato ikea net Meum c 13 114 SET NUM WIDTH 10 aah se thst teh etiim datae o 13 114 SET PAGESIDZE 24 AE oosiisaki on t cele o RE aco shaves E MS ER Tn dodi 13 115 SET PAU SE ON OFF text ttt ttt 13 115 SET RECSEP WR APPED EA CH OFF tenen 13 115 GET RECSEPCHAR T 6 EEEE enden mt oe nice 13 115 SET SERVEROUT PUT ON OFF SIZE n FOR MAT WRA PPED WOR D WRAPPED TRU NCATED 13 115 SET SHIFT INOUT VIS IBLE INV ISIBLE nnn 13 117 SET SHOW MO
154. AL 6 rows selected 7 24 SQL Plus User s Guide and Reference Defining Page and Report Titles and Dimensions To suppress the report header without changing its definition enter REPHEADER OFF Positioning Title Elements The report in the preceding exercises might look more attractive if you give the company name more emphasis and place the type of report and the department name on either end of a separate line It may also help to reduce the linesize and thus center the titles more closely around the data You can accomplish these changes by adding some clauses to the TTITLE command and by resetting the system variable LINESIZE as the following example shows You can format report headers and footers in the same way as BTITLE and TTITLE using the REPHEADER and REPFOOTER commands Example 7 20 Positioning Title Elements To redisplay the personnel report with a repositioned top title enter the following commands TTITLE CENTER ACME WIDGET SKIP 1 CENTER SKIP 1 LEFT PERSONNEL REPORT RIGHT SALES DEPARTMENT SKIP 2 SET LINESIZE 60 ACME WIDGET PERSONNEL REPORT SALES DEPARTMENT DEPARTMENT_ID LAST_NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTIAL 6 rows selected Formatting SQL Plus Reports 7 25 Defining Page and Report Titles and Dimensions E The LEFT RIGHT a
155. ARCHAR2 40 REGION NAME MARCHAR2 25 To select the associated data from the database enter COLUMN FIRST_NAME HEADING COLUMN LAST_NAME HEADING First Name Family Name SELECT FIRST_NAME LAST_NAME FROM EMP_DETAILS_VIEW WHERE LAST NAME LIKE K which produces the following output with renamed column headings Payam mI Steven King Neena Kochhar Alexander Khoo anette King Sundita Kumar SQL Plus Overview 1 3 What is SQL Plus SQL Plus Command line Architecture SQL Plus uses a two tier model comprising Client Tier Command line user interface a Database Tier Oracle9 The two tiers may or may not be on the same machine Command line User Interface The command line user interface is the character based terminal implementation Oracle9i Oracle Net components provide communication between the SOL PIus Client and Oracle9i iSQL Plus Architecture iSQL Plus is a fast browser based interface which uses the SQL Plus processing engine in a three tier model comprising a Client Tier SOL Plus user interface typically a web browser a Middle Tier jSOL Plus Server Oracle Net and Oracle HTTP Server a Database Tier Oracle HTTP Oracle Net Web Browser TCP IP SQL Plus Server Oracle9f Client tier Middle tier Database tier The iSQL Plus Server must be on the same machine as the Oracle HTTP Server The client tier may or may not also be on this machine The m
156. ARY using the default file extension enter SPOOL DIARY To stop spooling and print the file on your default printer enter SPOOL OUT SQL Plus Command Reference 13 131 START START Syntax STA RT uri file_name ext arg Runs the SQL Plus statements in the specified script The script can be called from a web server in iSQL Plus or from the local file system or a web server in SQL Plus command line You can pass values to script variables in the usual way Terms Refer to the following list for a description of each term or clause url Specifies the Uniform Resource Locator of a script to run on the speci fied web server SQL Plus supports HTTP FIP and gopher protocols file name ext The script you wish to execute The file can contain any command that you can run interactively If you do not specify an extension SQL Plus assumes the default com mand file extension normally SQL For information on changing this default extension see the SUFFIX variable of the SET command in this chapter When you enter START file name ext SQL Plus searches for a file with the filename and extension you specify in the current default directory If SQL Plus does not find such a file SQL Plus will search a sys tem dependent path to find the file Some operating systems may not support the path search Consult the Oracle installation and user s manual s provided for your operating system for specific information related
157. BER COL MINIMUM 4i SUM amp amp NUMBER COL TOTAL 5i AVG amp amp NUMBER COL AVERAGE 6i 1 SELECT amp GROUP COL CHANGE amp amp amp 1 SELECT amp amp GROUP_COL 7 7 GROUP BY amp GROUP COL CHANGE amp amp amp 7 GROUP BY amp amp GROUP COL SAVE STATS2 Created file STATS2 Finally run the script STATS2 and respond to the prompts as follows START STATS2 Enter value for group col JOB ID Enter value for number col SALARY Enter value for table EMP DETAILS VIEW SQL Plus displays the following output JOB_ID MAXIMUM MINIMU TOTAL AVERAGE AC ACCOUNT 8300 8300 8300 8300 AC MGR 12000 12000 12000 12000 AD ASST 4400 4400 4400 4400 AD PRES 24000 24000 24000 24000 AD VP 17000 17000 34000 7000 FI ACCOUNT 9000 6900 39600 7920 FI MGR 12000 12000 2000 2000 HR REP 6500 6500 6500 6500 IT PROG 9000 4200 28800 5760 MK MAN 13000 13000 3000 3000 MK REP 6000 6000 6000 6000 JOB ID MAXIMUM MINIMU OTAL AVERAGE PR_REP 10000 10000 0000 10000 PU_CLERK 3100 2500 3900 2780 PU_MAN 11000 11000 1000 11000 SA_MAN 14000 10500 61000 12200 SA_REP 11500 6100 250500 8350 SH_CLERK 4200 2500 64300 3215 6 22 SQL Plus User s Guide and Reference Writing Interactive Commands ST_CLERK 3600 2100 55700 2785 ST_MAN 8200 5800 36400 7280 19 rows selected Note that you were prompted for the values of NUMBER_COL and GROUP_COL only once If you were to run STATS2 again
158. BREAK ON expr action action When you include action s specifies action s for SOL Plus to take when the value of the expression changes When you omit action s BREAK ON expr suppresses printing of dupli cate values of expr and marks a place in the report where SQL Plus will perform the computation you specify in a corresponding COMPUTE command You can use an expression involving one or more table columns or an alias assigned to a report column in a SQL SELECT or SQL Plus COL UMN command If you use an expression in a BREAK command you must enter expr exactly as it appears in the SELECT command If the expression in the SELECT command is a b for example you cannot use b a or a b in a BREAK command to refer to the expression in the SELECT command The information given above for ON column also applies to ON expr ON ROW action action When you include action s specifies action s for SOL Plus to take when a SQL SELECT command returns a row The ROW break becomes the innermost break regardless of where you specify it in the BREAK command You should always specify an action when you BREAK ona row ON REPORT action Marks a place in the report where SQL Plus will perform the computa tion you specify in a corresponding COMPUTE command Use BREAK ON REPORT in conjunction with COMPUTE to print grand totals or other grand computed values The REPORT break becomes the outermost break regardless of where you s
159. CREATE UNIQUE INDEX D2 I UNIQUE1 ON D2 T1 UNIQUE1 Index created SET LONG 500 LONGCHUNKSIZE 500 SET AUTOTRACE ON EXPLAIN 9 8 SQL Plus User s Guide and Reference Tracing Parallel and Distributed Queries SELECT INDEX B D2_I_UNIQUE1 USE NL B ORDERED COUNT A UNIQUE1 FROM D2 T2 A D2 T1 B WHERE A UNIQUEl B UNIQUE1 Execution Plan 0 SELECT STATEMENT Optimizer CHOOSE Cost 1 Card 1 Bytes 26 1 0 SORT AGGREGATE 2 1 SORT AGGREGATE 02000 3 2 NESTED LOOPS Cost 1 Card 41 Bytes 1066 02000 4 3 TABLE ACCESS FULL OF D2 12 Cost 1 Card 41 Byte Q2000 s 533 5 3 INDEX UNIQUE SCAN OF D2 I UNIQUE1 UNIQUE 02000 2 PARALLEL TO SERIAL SELECT PIV SSF SYS OP MSR COUNT A1 CO0 FROM SELECT ORDERED NO EXPAND USE NL A3 INDEX A3 D2 I UNIQUE1 A2 CO CO0 A3 ROWID C1 A3 UNIQUE1 C2 FROM SELECT N O EXPAND ROWID A4 A4 UNIQUE1 CO FROM D2 T2 PX GRANULE 0 BLOCK RANGE DYNAMIC A4 A2 D2 T1 A3 WHERE A2 CO A3 UNIQUE1 Al 3 PARALLEL COMBINED WITH PARENT 4 PARALLEL COMBINED WITH PARENT 5 PARALLEL COMBINED WITH PARENT Line 0 of the Execution Plan shows the cost based optimizer estimates the number of rows at 1 taking 26 bytes The total cost of the statement is 1 Lines 2 3 4 and 5 are marked with asterisks denoting parallel operations For example the NESTED LOOPS step line 3 is a PARALLEL TO SERIAL operation PARALLEL TO SERIAL operations execute a
160. CS option is set to OFF or you log out of SOL Plus The formatting of your AUTOTRACE report may vary depending on the version of the server to which you are connected and the configuration of the server AUTOTRACE is not available when FIPS flagging is enabled See Tracing Statements on page 9 2 for more information on AUTOTRACE SET BLO CKTERMINATOR c ON OFF Sets the character used to end PL SQL blocks to c It cannot be an alphanumeric character or a whitespace To execute the block you must issue a RUN or slash command 13 102 SQL Plus User s Guide and Reference SET OFF means that SQL Plus recognizes no PL SQL block terminator ON changes the value of c back to the default period not the most recently used character SET CMDS EP c ON OFF Sets the non alphanumeric character used to separate multiple SOL Plus commands entered on one line to c ON or OFF controls whether you can enter multiple commands on a line ON automatically sets the command separator character to a semicolon Example To specify a title with TTITLE and format a column with COLUMN both on the same line enter SET CMDSEP TTITLE LEFT SALARIES COLUMN SALARY FORMAT 99 999 SELECT LAST NAME SALARY FROM EMP DETAILS VIEW WHERE JOB ID SH CLERK SALARIES LAST_NAME SALARY Taylor 3 200 Fleaur 3 100 Sullivan 2 500 Geoni 2 800 Sarchand 4 200 Bull 4 100 Dellinger 3 400 Cabrio 3 000 Chun
161. DB REPLACE EMPCOPY2 USING SELECT LAST NAME SALARY FROM EMP DETAILS VIEW WHERE DEPARTMENT ID 30 You may find it easier to enter and edit long COPY commands in scripts rather than trying to enter them directly at the command prompt B 6 SQL Plus User s Guide and Reference Copying Data from One Database to Another Controlling Treatment of the Destination Table You control the treatment of the destination table by entering one of four control clauses REPLACE CREATE INSERT or APPEND The REPLACE clause names the table to be created in the destination database and specifies the following actions a Ifthe destination table already exists COPY drops the existing table and replaces it with a table containing the copied data a If the destination table does not already exist COPY creates it using the copied data You can use the CREATE clause to avoid accidentally writing over an existing table CREATE specifies the following actions a Ifthe destination table already exists COPY reports an error and stops a If the destination table does not already exist COPY creates the table using the copied data Use INSERT to insert data into an existing table INSERT specifies the following actions a Ifthe destination table already exists COPY inserts the copied data in the destination table Ifthe destination table does not already exist COPY reports an error and stops Use APPEND when you want to insert da
162. DE ON OFF o n ninina 13 118 SET SOLBL ANKLINES ON OFF ttt 13 118 SET SOLC ASE MIX ED LO WER UP PER 13 119 SET SOLCOPN TINUE gt Hestliuecetune cct desee i cede i edge 13 119 SET SQLN UMBER ON OFF 13 120 SET SQLPLUSCOMPAT IBILITY x y z nnns 13 120 SET SQLPRE FIX C x ttt petis Ed a Ret ronde Rd e RE 13 120 SET SOLP ROMPT SQL gt text ttt 13 120 SET SOLT ERMINATOR cl ON OFF 13 121 SET SUFFI GOL deus cs orte cele or edo iau e Retos d tac atraer aate 13 121 SET TOMER COIN OME LA sit ost ae tha dete uet ctiam d ede toD en 13 122 SET TERM OUT ON OFF nsan knik SBUNRIR SUR ct ia 13 122 SNIV KONDO 2 a E E toa esl ecco 13 122 SET TIMI NG ON OFF ace cene teat thee dette agen i E Rc 13 122 SET TRIM OUT ON HOBE aetate exe urtsoh ca lee bro eed lb eccles 13 122 SET TRIMS POOL ON OFF ttt ttt 13 123 SET UND ERLINE c CN OFF n n 13 123 SET VER IFY ON OFF andere eat Qut ie cd Dci 13 123 SETAVICATPIERONUTOREPE dirae idit sta asada tan T tet EN aet 13 123 SHOW QE c ats aM LM MI M ME E 13 124 SHUTDOWN z tnm acte ceto et vietato acte B e e b lta adr 13 129 Xii SPOOL aea Rte Ue ae aa MU site e adem 13 131 STAR n I n etii aite rtt Rt ibt tube De OEE DAE Re REED HU cn 13 132 STARTUP inu Pepe Ue ete dep breed hue ae ens 13 134 STORE o oe Os Sain tas hee Sa ates ees teal tet ed e e UE ede AN 13 138 TIMING ned RED PRU HH eu etr Reload esse Ue Dada
163. Database Error Messages SQL Plus Error Messages 14 1 SQL Plus Error Messages SQL Plus Error Messages SP2 0002 ACCEPT statement must specify a variable name Cause Required variable name was missing after the ACCEPT command Action Re enter the ACCEPT command with a variable argument to store the input value SP2 0003 Ill formed ACCEPT command starting as command string Cause An invalid option was used in the ACCEPT command Action Check the syntax of the ACCEPT command for the correct option SP2 0004 Nothing to append Cause There was no specified text entered after the APPEND command Action Re enter the APPEND command with the specified text SP2 0006 Not enough room to format computations Cause Unable to allocate memory to format computations Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0015 No break s defined Cause There was no break defined Action Define a break Check the syntax of the BREAK command for the correct options SP2 0016 Break specification must start with ON BY or ACROSS keyword Cause An invalid option was used in the BREAK command Action Check the syntax of the BREAK command for the correct options SP2 0017 Missing column name after keyword name keyword Cause There was no column name after the specified keyword Action Enter a column name after the
164. De Re RR 32305 10 5 1 lA m sum 27 500 90 King 24 000 Kochhar 17 000 De Haan 17 000 ad kk dk4QxdXdko 005 0 lO fae hs Si et a a rd n sum 58 000 sum 98 500 COMPANY CONFIDENTIAL 6 rows selected 7 36 SQL Plus User s Guide and Reference 8 Generating HTML Reports from SQL Plus This chapter explains how to generate a HTML report containing your query results This chapter covers the following topics a Creating Reports using Command line SQL Plus Creating Reports using iSQL Plus Read this chapter while sitting at your computer and try out the examples shown Before beginning make sure you have access to the HR sample schema described in Chapter 1 SQL Plus Overview Generating HTML Reports from SQL Plus 8 1 Creating Reports using Command line SQL P lus Creating Reports using Command line SQL Plus In addition to plain text output the SQL Plus command line interface enables you to generate either a complete web page or HTML output which can be embedded in a web page You can use SOLPLUS MARKUP HTML ON or SET MARKUP HTML ON SPOOL ON to produce complete HTML pages automatically encapsulated with lt HTML gt and lt BODY gt tags By default data retrieved with MARKUP HTML ON is output in HTML though you can optionally direct output to the HTML lt PRE gt tag so that it displays ina web browser exactly as it appears in SQL Plus See the SQLPLUS MARKUP command in the SOL
165. E left justifies the text SOL Plus interprets TTITLE in the new form if a valid printspec clause LEFI SKIP COL and so on immediately follows the command name See COLUMN NEW VALUE for information on printing column and DATE values in the top title You can use any number of constants and variables in a printspec SQL Plus displays them in the order you specify them positioning and formatting each constant or variable as specified by the printspec clauses that precede it The length of the title you specify with TTITLE cannot exceed 2400 characters The continuation character a hyphen will not be recognized inside a single quoted title text string To be recognized the continuation character must appear outside the quotes as follows TTITLE CENTER Summary Report for the Month of May To define Monthly Analysis as the top title and to left align it to center the date to right align the page number with a three digit format and to display Data in Thousands in the center of the next line enter TTITLE LEFT Monthly Analysis CENTER 01 Jan 2001 RIGHT Page FORMAT 999 SQL PNO SKIP CENTER Data in Thousands Monthly Analysis 01 Jan 2001 Page 1 Data in Thousands To suppress the top title display without changing its definition enter TTITLE OFF SQL Plus Command Reference 13 143 UNDEFINE UNDEFINE Syntax UNDEF INE variable Deletes one or more user variables that you defined either ex
166. EPCHAR c 13 115 Display or print record separators SET SERVEROUTPUT 4ONJOFF HSIZE n 13 115 Controls whether to display the output that is DBMS_ FORMAT WRAPPED WORD_ OUTPUT PUT LINE of stored procedures or PL SOL WRAPPED TRUNCATED blocks in SQL PIus SET SHIFTINOUT VISIBLE INVISIBLE 13 117 Allows correct alignment for terminals that display shift characters SET SHOWMODE ON OFF 13 118 Controls whether SQL Plus lists the old and new settings of a SOL Plus system variable when you change the setting with SET SET SQLBLANKLINES ON OFF 13 118 Controls whether SQL Plus allows blank lines within a SOL command or script SET SQLCASE MIXED LOWER UPPER 13 119 Converts the case of SOL commands and PL SQL blocks just prior to execution SET SQLCONTINUE gt text 13 119 Sets the character sequence SOL Plus displays as a prompt after you continue a SOL Plus command on an additional line using a hyphen SET SQLNUMBER ON OFF 13 120 Sets the prompt for the second and subsequent lines of a SOL command or PL SQL block SET SQLPLUSCOMPATIBILITY x y z 13 120 Sets the behavior or output format of VARIABLE to that of the release or version specified by x y z SET SQLPREFIX c 13 120 Sets the SQL Plus prefix character SET SQLPROMPT SQL text 13 120 Sets the SOL Plus command prompt SET SQLTERMINATOR clON OFF 13 121 Sets the character used to end and execute SOL commands to c SET SUFFIX QL text 13 121 Sets
167. ERROR Syntax Terms WHENEVER OSERROR EXIT SUCCESS FAILURE n variable Bind Variable COMMIT ROLLBACK CONTINUE COMMIT ROLLBACK NONE Performs the specified action exits SQL Plus by default if an operating system error occurs such as a file writing error In iSQL Plus performs the specified action stops the current script by default and returns focus to the Input area if an operating system error occurs Refer to the following list for a description of each term or clause SUCCESS FAILUR E n variable Bind Variable Directs SQL Plus to perform the specified action as soon as an operat ing system error is detected You can also specify that SQL Plus return a success or failure code the operating system failure code or a number or variable of your choice EXIT SUCCESS FAILURE n variable Bina Variable CONTINUE COMMIT ROLLBACK Directs SQL Plus to exit as soon as an operating system error is detected You can also specify that SOL Plus return a success or failure code the operating system failure code or a number or variable of your choice See EXIT in this chapter for details Turns off the EXIT option Directs SQL Plus to execute a COMMIT before exiting or continuing and save pending changes to the database Directs SQL Plus to execute a ROLLBACK before exiting or continuing and abandon pending changes to the database 13 152 SQL Plus User s Guide and Reference WHENEVER OSERROR Usage
168. EXIT was invalid in SOL Plus Action Specify a valid option SP2 0584 EXIT variable variable name was non numeric Cause The specified EXIT variable is non numeric Action Check the syntax of the EXIT command for the correct usage SP2 0590 A COMPUTE function must appear before each LABEL keyword Cause The function COMPUTE must appear before each LABEL keyword Action Check the syntax of the COMPUTE command for the correct usage 14 24 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0591 Unable to allocate dynamic space needed number_of_bytes bytes Try reducing ARRAYSIZE or the number of columns selected Cause Unable to allocate memory to process the command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0593 Label text must follow the LABEL keyword Cause Missing label text about the LABEL keyword in the COMPUTE command Action Check the syntax of the COMPUTE command for the correct options SP2 0594 Usage SET COLSEP text Cause An invalid option was used in the SET COLSEP command Action Specify a valid option SP2 0596 Usage SET AUTO COMMIT OFF ON IMM EDIATE nj Cause An invalid option was used in the SET AUTO COMMIT command Action Check the syntax of the SET AUTOCOMMIT command for the correct options SP2 0597 datatype name is not a valid
169. Error in disabling roles in product user profile Cause These error messages are warnings that the PRODUCT_USER_ PROFILE table has not been built in the SYSTEM account Action The exact format of the file extension and location of the file are system dependent See the SQL Plus installation guide provided for your operating system The script must be run as user SYSTEM SP2 0625 Error printing variable variable_name Cause Error encountered while printing the specified variable Action Check that the specified variable is correct and try again SP2 0626 Error accessing package DBMS_APPLICATION_INFO Cause This message is followed by a successful login to the Oracle Server The DBMS_APPLICATION package is used to maintain on line information about a particular application logged onto Oracle SET APPINFO could not be initialized Action This package is created during the running of the CATPROC SQL and should be available on all databases from Oracle 7 2 Check that your database is correctly installed SP2 0631 String beginning string_name is too long Maximum size is string_length characters Cause The string specified was too long Action Reduce the size of the specified string and re try the operation 14 28 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0640 Not connected PASSW ORD username Cause The PASSWORD command was issued when there was no connection to the Oracle instance Action Connect t
170. F text oo ceseesesscsseeceseesececescesecescescesceneesceeeceeeecesceaeeaseeeeeesaeaeeess 13 99 SET ARRAY SIGE 15m uii eet ree be Re t e RR aana 13 100 SET AUTO COMMIT ON OFF IMM EDIA TE 11 ener 13 101 SET AUTOP RINT ON T OFE ccc ste tects decet tee nete n tere ee ee aes 13 101 SET AUTORECOVERY ON OFF sesssessesseseeeeee nennen netten netten treten 13 101 SET AUTOT RACE ON OFF TRACE ONLY EXP LAIN STAT ISTICS 13 102 SET BLO CKTERMINATOR cl ON OFF 13 102 SEI CMDS EP ple ON ORBE Leiter tito ceret t etre rer renes 13 103 SET COESBP text te teat ere eet bee re Hoe fand 13 104 SET COM PATIBILITY V7 V8 INATIVE essere eene ennt 13 104 SEDXCON GAT A Le ON TORBE iiiter ten rette Pere treten tnter 13 105 SEIECOPYC OMMIT 1O 31 iecit e ea t ote eee e eee tee e regne 13 105 SBI COPXTYPECHECRK ON OREJ iere iei eeteesee create rect tete rere tret 13 105 SET DEE INETASSUGUON I ORBE iit rere Remo eren 13 105 SET DESCRIBE DEPTH 1l nl ALL LINENUM ON OQFF INDENT ONI OFF 13 106 SET ECHO ON OFE etico cett sete eter Nene Ue ta tee SHEER E IHRE 13 107 SEF EDIIPIBE Tie name ext trie rre E a 13 107 SET EMB EDDED ON OFF oeeaaeaii a hade tentent 13 107 SELBSC DAPEL XLbCIONTGOEBE d tret petrus eee eo co eere ee Rech e teet ha une 13 108 SET FEED BACK 615 ON OFF eese eene enne 13 108 SET FL
171. FF IPRE FORMATI ON OFF MIARKUP HTML ON OFF HEAD text BODY text Cause SET option was missing in the command Action Check the syntax of the command you used for the correct options SP2 0306 Invalid option Cause Invalid option was specified for the command Action Check the syntax of the command you used for the correct options 14 14 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0308 Cannot close spool file Cause The file is currently being used Action Release the file from the other process SP2 0309 SOL Plus command procedures may only be nested to a depth of number_of_nested_procedures Cause Maximum number of nested procedures or scripts was reached Action Reduce the number of nested procedures or scripts SP2 0310 Unable to open file file_name Cause Unable to open the specified file Action Check and make sure the file name is valid SP2 0311 String expected but not found Cause SQL Plus was expecting a string at the end of the command but could not find it Action Retry the command with a valid string Check the syntax of the command you used for the correct options SP2 0312 Missing terminating quote quote_type Cause The DESCRIBE command schema or object did not have a terminating quote Action Close the opening quotation mark with the corresponding closing quotation mark SP2 0317 Expected symbol name is missing Cause SQL Plus was expecting a sym
172. HR tables with the script HR_MAIN SQL which is located in the following subdirectory on UNIX SORACLE HOME DEMO SCHEMA HUMAN RESOURCES HR MAIN SQL And on the following subdirectory on Windows SORACLE_HOME DEMO SCHEMA HUMAN_RESOURCES HR_MAIN SQL To create the HR tables from command line SQL Plus do the following 1 Ask your DBA for your Oracle9i account username and password 2 Login to SQL Plus 3 On UNIX enter the following command at the SQL Plus prompt SQL gt DEMO SCHEMA HUMAN_RESOURCES HR_MAIN SQL On Windows enter the following command at the SOL Plus prompt SQL gt DEMO SCHEMA HUMAN_RESOURCES HR_MAIN SQL To remove the sample tables perform the same steps but substitute HR DROPSOL for HR_MAIN SQL For more information about the sample schemas see the Oracle9i Sample Schemas guide 1 8 SQL Plus User s Guide and Reference 2 SQL Plus User Interface This chapter describes the SQL Plus command line and iSQL Plus user interfaces and the iSQL Plus Extension for Windows This chapter contains the following topics a SOL Plus Command line User Interface a iSOL Plus User Interface a iSQL Plus Extension for Windows SQL Plus User Interface 2 1 SQL Plus Command line User Interface SQL Plus Command line User Interface You can use the command line interface to SOL Plus to write SOL Plus SOL and PL SQL commands to a Enter edit run store retrieve and save SOL commands and PL SQL
173. HTML 13 30 SQL Plus User s Guide and Reference COLUMN Entities in the column heading and any COMPUTE labels or output appearing in the column are mapped or not mapped according to the value of ENTMAP for the column The default setting for COLUMN ENTMAP is the current setting of the MARKUP HTML ENTMAP option For more information about the MARKUP HTML ENTMAP option see SET MARKUP Options on page 4 4 and SET later this Chapter FOLD A FTER Inserts a carriage return after the column heading and after each row in the column SQL Plus does not insert an extra carriage return after the last column in the SELECT list FOLD B EFORE Inserts a carriage return before the column heading and before each row of the column SQL Plus does not insert an extra carriage return before the first column in the SELECT list FOR MAT format Specifies the display format of the column The format specification must be a text constant such as A10 or 9 999 not a variable Character Columns The default width of CHAR NCHAR VARCHAR2 VARCHAR and NVARCHAR2 NCHAR VARYING col umns is the width of the column in the database SOL PIus formats these datatypes left justified If a value does not fit within the column width SQL Plus wraps or truncates the character string depending on the setting of SET WRAP A LONG CLOB NCLOB or XMLIype column s width defaults to the value of SET LONGCHUNKSIZE or SET LONG whichever one is smaller To c
174. If you have installed Oracle9i Server there are two iSQL Plus Servers configured one for the standard URL and one for the DBA URL Configure a About iSQL Plus Extension 3 Click Configure The Configure iSQL Plus Servers dialog is displayed 4 Enter an iSQL Plus Server definition in the iSOL Plus Servers area When you first open the dialog the following syntax model is displayed to show you the expected field contents URL http host domain isqlplus Name lt lt host gt gt Connect String lt lt username password connect identifier gt gt You must enter a URL for your iSQL Plus Server the other fields are optional This may be different if iSOL Plus Servers have been configured during an Oracle9i Server installation 5 Click OK to save your new server definition The new iSQL Plus Server Name appears in the context menu When you select a server from the context menu the full iSQL Plus Server URL is shown in the status bar 3 18 SQL Plus User s Guide and Reference iSQL P lus Extension for Windows Configuration Modifying a Server To modify an iSQL Plus Server perform the following steps 1 9 PF Ye DN 6 Right click on a SQL file in Windows Explorer Select iSQL Plus Servers to display the context menu options Click Configure The Configure iSQL Plus Servers dialog is displayed Select the server you wish to modify from the list of available servers Edit the server definition
175. Interval iSQLPlusHashTableSize iSQLPlusConnectIdList ms idle timeout Configuring SQL Plus 3 7 iSQL Plus Configuration On Windows the isglplus conf file is located in SORACLE_HOME sqlplus admin isqlplus conf On UNIX the isqlplus conf file is located in SORACLE_HOME sqlplus admin isqlplus conf To change the value of an iSQL Plus initialization parameter edit the line associated with the parameter The syntax of the line to be edited is shown in the following sections Setting the jSQL Plus Threads Parameter The isQLPlusNumberOfThreads parameter sets the number of threads enabled in the iSQL Plus Server Because each thread enables an HTTP request to be handled this value sets the maximum number of simultaneous HTTP requests that can be handled by the iSQL Plus Server When many users are executing long running queries increasing the iSOLPlusNumberOfThreads value may help performance You can edit the iSQL Plus configuration file isglplus conf to change the number of threads The syntax of the line to change in the configuration file is FastCgiServer initial env iSQLPlusNumberOfThreads n Where n can have a minimum value of 1 and a maximum determined by machine resources When no value is set iSOLPlusNumberOfThreads defaults to 20 Setting the jSQL Plus Log Level There should be no need to set iSOLPlusLogLevel to warn or debug unless instructed to by Oracle Support
176. K command Then enter one COMPUTE command for the break column and another to compute ON REPORT BREAK ON break column ON REPORT COMPUTE function LABEL label name OF column ON break column COMPUTE function LABEL label name OF column ON REPORT Computing Multiple Summary Values and Lines You can compute and print the same type of summary value on different columns To do so enter a separate COMPUTE command for each column 7 20 SQL Plus User s Guide and Reference Clarifying Your Report with Spacing and Summary Lines E Example 7 15 Computing the Same Type of Summary Value on Different Columns To print the total of salaries and commissions for all sales people first enter the following COMPUTE command COMPUTE SUM OF SALARY COMMISSION_PCT ON REPORT You do not have to enter a BREAK command the BREAK you entered in Example 7 14 is still in effect Now change the first line of the select query to include COMMISSION_PCT 1 1 SELECT LAST_NAME SALARY APPEND COMMISSION_PCT Finally run the revised query to see the results LAST NAME SALARY COMMISSION PCT Russell 14000 4 Partners 13500 3 Errazuriz 12000 3 Cambrault 11000 3 Zlotkey 10500 2 sum 61000 1 5 You can also print multiple summary lines on the same break column To do so include the function for each summary line in the COMPUTE command as follows COMPUTE function LABEL label name function LABEL label name func
177. L PNO is the current page number SOL CODE is the current error code SOL RELEASE is the cur rent Oracle release number and SOL USER is the current username To print one of these values reference the appropriate variable in the report header or footer You can format variable with the FORMAT clause SQL Plus Command Reference 13 89 REPHEADER OFF Turns the report header or footer off suppresses its display without affecting its definition COLn Indents to column n of the current line backward if column n has been passed Column in this context means print position not table column S KIP n Skips to the start of a new line n times if you omit n one time if you enter zero for n backward to the start of the current line TAB n Skips forward n columns backward if you enter a negative value for n Column in this context means print position not table column LE FT CE NTER R IGHT Left align center and right align data on the current line respectively SQL Plus aligns following data items as a group up to the end of the printspec or the next LEFT CENTER RIGHT or COL command CEN TER and RIGHT use the SET LINESIZE value to calculate the position of the data item that follows BOLD Prints data in bold print SOL Plus represents bold print on your termi nal by repeating the data on three consecutive lines On some operat ing systems SQL Plus may instruct your printer to print bold text on three consecuti
178. L Plus session You can also use the SET command in the Work screen if you prefer See Also Saving Changes to the Database Automatically on page 5 11 History Screen There is a new iSQL Plus History screen This screen allows you to reload one or more scripts that you have previously executed in the same session A History entry is created each time you execute a script The number of entries listed is definable through the Preferences screen Each iSQL Plus session has its own history list which is cleared when that session ends See Also iSQL Plus History Screen on page 2 6 New Session There is a new icon called New Session in the iSQL Plus user interface The New Session icon starts a new iSQL Plus session in a separate web browser window You can log in to the new session as the same user or as any other valid user See Also iSQL Plus Navigation on page 2 3 Cancel Script There is a new Cancel button on the iSQL Plus Work screen The Cancel button interrupts the script currently running in your iSQL Plus session See Also iSQL Plus Work Screen on page 2 5 iSQL Plus DBA Login The iSQL Plus DBA Login screen contains a Privilege dropdown list to select either SYSDBA or SYSOPER privileged login to perform system administration tasks This field is not available through the standard iSQL Plus Login screen Use the iSQL Plus DBA URL to access the DBA Login screen Once logged in with DBA privileges the iSQL Plus sc
179. L Plus Commands 1 O eene eee eene 5 8 Understanding SQL Plus Command Syntax sese 5 9 System Variables that Affect How Commands Run 2 eee 5 10 Saving Changes to the Database Automatically esses 5 11 Stopping a Command while it is Running 1e eene enne 5 12 Running Host Operating System Commands sse 5 12 Gethin Help 3th oben nS ase aav E eee er td 5 13 Listing Table Definitio onere nece e e e nd 5 13 Listing PL SQL Definitions ee tetdee eee donde eei n re i eee i ederet 5 14 Controlling the Display esses eee eee nene 5 15 Interpreting Error Messages neironi nonii eea ae E eene nenne nen nennen nenne 5 15 Using Scripts in SQL Plus Editing Scripts teinte etaed cede i pen bann Eo aha de iR d 6 2 Writing Scripts with a System Editor sese eee eee eene 6 2 Modifying Scripts uias diee edere Beer e ERU ane Pe e Dale cor irae ev Pe hee TES 6 3 Editing Scripts in SOL Plus pana ranae oean oae nennt nE entente tentent tet tinae AES 6 4 Placing Comments in Scripts enceinte he need i rediere a ee rnc 6 10 Using the REMARK Command sse eene eene nennen 6 10 Using 5s n ioa ente tu stie etii ee inea rectae eiat te ope Me HR Ire a e 6 10 USNE A ice recede Eee Elbe ede de t ve ee Icd e ine verre ee n etie tvi n Dh 6 11 Notes on Placing Comments seen nennen tenente nnne ne
180. L Plus Extension for Windows cecccseesceseeseesesceecaeessesecaecacccsaecaesacueceaeaeeseenscaeeaeeeeeaeeas 2 16 3 Configuring SQL Plus SOL PIus Configuration 5 ouiedmeedee arent aiii de diet i Pee Pe as tn vise 3 2 Site Profile te e et ER Iam ORE 3 2 User Protile ERES Rene eR e e en E cn ns 3 2 Storing and Restoring SQL Plus System Variables sees eee 3 3 19OL Plus Configuration cn ies de URS SUR ite dai ees 3 5 Contiguring the Client Tier iaa e ee rdi ree letters eE Eo tetas 3 5 Configuring the Middle Tier iSQL Plus Server sees eee eene 3 7 Configuring the Middle Tier Oracle HTTP Server sess eee eee 3 12 Configuring the Middle Tier Oracle Net sse eene 3 15 Configuring the Database Tier sese eene enne 3 15 iSQL Plus Extension for Windows Configuration sese 3 15 Configuration Dialog isnt e OB He n tee b ipee Hedge b e eee Le a seed 3 16 4 Starting SQL Plus Starting Command line SOL Plus 1 1 v k eee eene nnne atiae tiai 4 2 The SOLPEUS Command 3 hie eei aoa tte Hi e ec bee Rey 4 3 OPHONS vi ost debido on tentat hatetaina bd tied rash ase nta io Deeds 4 4 POROUS desea Roo d oo eee mitate E e o b pie te EA E n ER 4 10 PAR ss ics E Gretas 4 12 Getting Command line Help sees eene nee E 4 12 Installing Command line Help esses eee e eee en
181. LARY COMMISSION Russell 14 000 0 40 Partners 13 500 0 30 Errazuriz 12 000 0 30 Cambrault 11 000 0 30 Zlotkey 10 500 0 20 You can use any number of parameters in a script Within a script you can refer to each parameter any number of times and can include the parameters in any order Note You cannot use parameters when you run a command with RUN or slash You must store the command in a script and run it with START or Before continuing return the columns to their original heading by entering the following command CLEAR COLUMN Communicating with the User Three SOL Plus commands PROMPT ACCEPT and PAUSE help you communicate with the end user These commands enable you to send messages to the screen and receive input from the user including a simple Return You can also use PROMPT and ACCEPT to customize the prompts for values SQL Plus automatically generates for substitution variables Prompting for and Accepting User Variable Through PROMPT and ACCEPT you can send messages to the end user and accept values as end user input PROMPT displays a message you specify on screen use it to give directions or information to the user ACCEPT prompts the user for a value and stores it in the user variable you specify Use PROMPT in conjunction with ACCEPT when your prompt for the value spans more than one line Using Scripts in SQL Plus 6 27 Writing Interactive Commands
182. LO 6 END d of Procedure created Do not put comments after statement terminators period semicolon or slash For example if you enter SELECT Y FROM DUAL TESTING You get the following error SELECT Y FROM DUAL TESTING ERROR at line 1 ORA 00911 invalid character SQL Plus expects no text after statement terminators on the same line and is unable to recognize the comment Do not put statement termination characters at the end of a comment line or after comments in a SQL statement or a PL SQL block For example if you enter SELECT 6 12 SQL Plus User s Guide and Reference Placing Comments in Scripts COMMENT You get the following error COMMENT ERROR at line 2 ORA 00923 FROM keyword not found where expected The semicolon is interpreted as a statement terminator and SOL Plus submits the partially formed SOL command to the server for processing resulting in an error 4 Donot use ampersand characters amp in comments in a SOL statement or PL SQL block For example if you enter a script such as SELECT REGION NAME CITY THIS amp THAT FROM EMP DETAILS VIEW WHERE SALARY gt 12000 It prompts for the value of amp that Enter value for that old 2 THIS amp THAT new 2 THIS REGION NAME CITY Americas Seattle Americas Seattle Americas Seattle Europe Oxford Europe Oxford Americas Toronto 6 rows selected SQL Plu
183. MATIC FROM location full database recovery partial database recovery LOGFILE filename TEST ALLOW integer CORRUPTION TEST ALLOW integer CORRUPTION ICONTINUE DEFAULT CANCEL where the full database recovery clause has the following syntax STANDBY DATABASE UNTIL CANCEL TIME date CHANGE integer USING BACKUP CONTROLFILE UNTIL CANCEL TIME date CHANGE integer USING BACKUP CONTROLFILE where the partial database recovery clause has the following syntax TABLESPACE tablespace tablespace DATAFILE datafilename datafilename STANDBY TABLESPACE tablespace tablespace DATAFILE datafilename datafilenamel UNTIL CONSISTENT WITH CONTROLFILE where the managed clause has the following syntax MANAGED STANDBY DATABASE NODELAY TIMEOUT integer CANCEL IMMEDIATE NOWAIT DISCONNECT FROM SESSION FINISH NOWAIT Performs media recovery on one or more tablespaces one or more datafiles or the entire database For more information on the RECOVER command see the Oracle9i Database Administrator s Guide the ALTER DATABASE RECOVER command in the Oracle9i SQL Reference the Oracle9i Backup and Recovery ConceptsOracle9i Backup and Recovery Concepts guide and the Oracle9i User Managed Backup and Recovery Guide Because of possible network timeouts it is recommended that you use SQL Plus command line for long running DBA operations such as RECOVER You
184. MN command on page 13 29 for more information on these clauses You will use the WORD_ WRAPPED clause of COLUMN later in this chapter Formatting SQL Plus Reports 7 7 Formatting Columns Note The column heading is truncated regardless of the setting of WRAP or any COLUMN command clauses Now return the column to its previous format COLUMN LAST NAME FORMAT A10 Example 7 6 Formatting an XMLType Column Before illustrating how to format an XMLIype column you must create a table with an XMLType column definition and insert some data into the table You can create an XMLType column like any other user defined column To create a table containing an XMLType column enter CREATE TABLE warehouses warehouse id NUMBER 3 warehouse spec SYS XMLTYPE warehouse name VARCHAR2 35 location id NUMBER 4 To insert a new record containing warehouse id and warehouse spec values into the new warehouses table enter INSERT into warehouses warehouse id warehouse spec VALUES 100 sys XMLTYPE createXML Warehouse whNo 100 gt lt Building gt Owned lt Building gt lt Warehouse gt To set the XMLType column width to 20 characters and then select the XMLType column enter COLUMN Building FORMAT A20 SELECT w warehouse_spec extract Warehouse Building text getStringVal Building FROM warehouses w Building 7 8 SQL Plus User s Guide and Reference Formatting Columns
185. NT ID 10 SALARY 0 DEPARTMENT 10 SUM DECODE DEPARTMENT ID 20 SALARY 0 DEPARTMENT 20 SUM DECODE DEPARTMENT ID 30 SALARY 0 DEPARTMENT 30 SUM SALARY TOTAL BY JOB ID FROM EMP DETAILS VIEW GROUP BY JOB ID 13 86 SQL Plus User s Guide and Reference REPFOOTER REPFOOTER Syntax Terms Usage REPF OOTER PAGE printspec text variable ON OFF where printspec represents one or more of the following clauses used to place and format the text COL n S KIP n TAB n LE FT CE NTER RIGHT BOLD FORMAT text Places and formats a specified report footer at the bottom of each report or lists the current REPFOOTER definition Refer to the REPHEADER command for additional information on terms and clauses in the REPFOOTER command syntax Enter REPFOOTER with no clauses to list the current REPFOOTER definition If you do not enter a printspec clause before the text or variables REPFOOTER left justifies the text or variables You can use any number of constants and variables in a printspec SQL Plus displays the constants and variables in the order you specify them positioning and formatting each constant or variable as specified by the printspec clauses that precede it Note If SET EMBEDDED is ON the report footer is suppressed SQL Plus Command Reference 13 87 REPFOOTER Examples C To define END EMPLOYEE LISTING REPORT as a
186. NT ID CITY 2 FROM EMP DETAILS VIEW 3 WHERE SALARY 12000 If entities are not mapped web browsers may treat data as invalid HTML and all subsequent output may display incorrectly ENTMAP OFF allows users to write their own HTML tags to customize output As entities in the lt HEAD gt and lt BODY gt tags are not mapped you must ensure that valid entities are used in the MARKUP HEAD and BODY options Note ENTMAP only has affect when either the HTML option is set ON or the SPOOL option is set ON For more information about using entities in your output see the COLUMN command on page 13 29 SPOOL ONOFF SPOOL ON or OFF specifies whether or not SQL Plus writes the HTML opening tags lt HTML gt and lt BODY gt and the closing tags lt BODY gt and lt HTML gt to the start and end of each file created by the SQL Plus SPOOL filename command The default is OFF You can turn SPOOL ON and OFF as required during a session Starting SQL Plus 4 7 The SQLPLUS Command Note It is important to distinguish between the SET MARKUP HTML SPOOL option and the SOLPLUS SPOOL filename command The SET MARKUP HTML SPOOL ON option enables the writing of the lt HTML gt tag to the spool file The spool file is not created and the header and footer tags enabled by the SET MARKUP HTML SPOOL ON option are not written to the spool file until you issue the SQLPLUS SPOOL filename command SQL Plus writes severa
187. NTMAP ON OFF SPOOL ON OFF PRE FORMAT ON OFF Logon on page 4 10 has the following syntax username password connect_identifier AS SYSOPER SYSDBA NOLOG Start on page 4 12 has the following syntax url file_name ext arg Starting SQL Plus 4 3 The SQLPLUS Command You have the option of entering logon If you do not specify logon but do specify start SQL Plus assumes that the first line of the script contains a valid logon If neither start nor logon are specified SQL Plus prompts for logon information The following sections contain descriptions of SOLPLUS command terms Options HELP Option H ELP Displays the usage and syntax for the SOLPLUS command and then returns control to the operating system VERSION Option V ERSION Displays the current version and level number for SOL Plus and then returns control to the operating system LOGON Option L OGON Specifies not to reprompt for username or password if the initial con nection does not succeed This can be useful in operating system scripts that must either succeed or fail and you don t want to be reprompted for connection details if the database server is not running This option is not available with the Windows graphical user interface SOL Plus executable MARKUP Options M ARKUP You can use the MARKUP option to generate a complete stand alone web page from your query or script MARKUP currently supports HTML 4
188. ODULE column of the V SESSION and V SOLAREA virtual tables You can also read the registered name using the DBMS APPLICATION INFO READ MODULE procedure ON registers scripts invoked by the or START commands OFF disables registering of scripts Instead the current value of text is registered Text specifies the text to register when no script is being run or when APPINFO is OFF which is the default The default for text is SOL Plus If you enter multiple words for text you must enclose them in quotes The maximum length for text is limited by the DBMS APPLICATION INFO package The registered name has the format nn xfilename where nn is the depth level of script x is lt when the script name is truncated otherwise it is blank and filename is the script name possibly truncated to the length allowed by the DBMS APPLICATION INFO package interface Note To use this feature you must have access to the DBMS_ APPLICATION INFO package Run DBMSUTIL SQL this name may vary depending on your operating system as SYS to create the DBMS APPLICATION INFO package DBMSUTIL SQL is part of the Oracle9i database server product SQL Plus Command Reference 13 99 SET Example For more information on the DBMS_APPLICATION_INFO package see the Oracle9i Database Performance Tuning Guide and Reference manual To display the setting of APPINFO as it is SET OFF by default enter SET AP
189. OF 13 41 referencing a SELECT expression in ON 13 42 removing definitions 7 22 13 27 STD function 7 17 SUM function 7 17 used to format a REFCURSOR variable 13 147 VARIANCE function 7 17 COMPUTES clause 13 27 CONCAT variable 6 23 13 96 13 105 configuration client tier 3 5 database tier 3 15 file associations 3 5 globalization support iSQL Plus Server 3 7 middle tier 3 7 MIME types 3 5 Oracle HTTP Server 3 7 Oracle9i 3 15 testing HTTP Server configuration file 3 12 configuring cookies for iSQL Plus 3 5 globalization support 12 1 HTTP Server 3 12 configuring continued httpd conf 3 12 iSQL Plus 3 5 iSQL Plus extension for windows 3 15 javascript for iSOL Plus 3 5 Oracle Net 3 15 oracle apache conf 3 12 proxy server exceptions 3 6 SQL Plus 3 1 CONNECT command 4 18 4 22 13 46 and at sign 13 46 changing password 13 46 13 47 13 75 service name 4 22 SYSDBA clause 4 11 13 47 SYSOPER clause 4 11 13 47 username password 4 21 13 46 CONNECT command SQL disabling 10 5 connect identifier 2 5 2 11 4 21 13 46 field 2 5 2 11 in CONNECT command 13 46 in COPY command B 2 in DESCRIBE command 13 53 in SOLPLUS command 4 11 connection identifier 4 20 context menu iSQL Plus extension for windows 2 16 CONTINUE clause WHENEVER OSERROR 13 152 WHENEVER SQLERROR 13 154 continuing a long SQL Plus command 5 9 13 1 cookies configuring for iSQL Plus 3 5 COPY command 13 48 B 2
190. OFF SOL Plus does not check for DBMS output and does not display output after applicable SOL or PL SQL statements Suppressing this output checking and display may result in performance gains SET TRIMOUT ON SET TRIMOUT is not supported in iSQL Plus Determines whether SQL Plus allows trailing blanks at the end of each displayed line ON removes blanks at the end of each line which may improve performance especially when you access SQL Plus from a slow communications device TRIMOUT ON does not affect spooled output SET TRIMSPOOL ON SET TRIMSPOOL is not supported in iSQL Plus Determines whether SQL Plus allows trailing blanks at the end of each spooled line ON removes blanks at the end of each line which may improve performance especially when you access SQL Plus from a slow communications device TRIMSPOOL ON does not affect terminal output Tuning SQL Plus 9 11 iSQL P lus Server Statistics isQL Plus Server Statistics The active statistics from the iSQL Plus Server Statistics report provide useful feedback for tuning the iSQL PIus Server To run the report you must have Oracle HTTP Server authentication to access the iSQL Plus DBA URL but as there is no connection to a database no Oracle9i login is required The syntax of the URL to run the iSQL Plus Server Statistics report is http machine_name domain port isqlplusdba statistics active full amp refresh number To maximize resource availability it is recomme
191. OMPT SET SQLPLUSCOMPATIIBILITY x y z Sets the behavior or output format of VARIABLE to that of the release or version specified by x y z Where x is the version number y is the release number and z is the update number For example 8 1 8 1 7 or 9 0 0 In later releases SOLPLUSCOMPATIBILITY may affect features other than VARIABLE Setting the value of SOLPLUSCOMPATIBILITY to a version less than 9 0 0 will result in VARIABLE definition of NCHAR or NVARCHAR datatypes to revert to Oracle8i behavior whereby the size of the variable is in bytes or characters depending on the chosen national character set The default glogin sql file contains SET SOLPLUSCOMPAT 8 1 7 It is recommended that you add SET SQLPLUSCOMPAT 9 0 0 to your scripts to maximize their compatibility with future versions of SOL Plus SET SQLPRE FIX itc SET SOLPREFIX is not supported in iSQL Plus Sets the SOL Plus prefix character While you are entering a SOL command or PL SQL block you can enter a SOL Plus command on a separate line prefixed by the SQL Plus prefix character SQL Plus will execute the command immediately without affecting the SOL command or PL SQL block that you are entering The prefix character must be a non alphanumeric character SET SQLP ROMPT SQL text SET SOLPROMPT is not supported in iSQL Plus Sets the SOL Plus command prompt Example You need the Select Any Table privilege to successfully run the following example scripts
192. OW command C 2 C 7 labels in COMPUTE command 7 17 13 41 language support in iSQL Plus 4 14 LEFT clause 7 26 13 90 13 142 LIKE clause 7 9 13 17 13 34 limits SOL Plus A 1 line numbers for SOL commands 5 4 lines adding at beginning of buffer 13 71 adding at end of buffer 13 71 adding new after current 6 7 13 71 appending text to 6 8 13 12 changing width 7 32 13 97 13 111 deleting allin buffer 13 51 deleting from buffer 6 9 13 51 determining which is current 6 6 editing current 6 6 listing allin buffer 6 4 13 73 removing blanks at end 13 122 LINESIZE variable 7 25 7 32 13 97 13 111 LIST clause 13 13 13 66 LIST command 6 4 13 73 determining currentline 6 6 13 73 making last line current 6 6 13 73 using an asterisk 6 4 13 73 LNO clause 13 125 load script button 2 6 LOBOFFSET variable 13 97 13 111 LOCK TABLE command disabling 10 5 log in button 2 5 2 12 LOG ARCHIVE DEST parameter 13 13 LOGFILE clause 13 80 logging off conditionally 13 152 13 154 Oracle 4 18 13 60 SOL Plus 4 13 13 64 logging on default users created at installation 4 17 Oracle 4 22 13 46 SQL Plus 4 2 Index 12 Login screen 2 4 2 10 4 14 10 10 LOGIN SQL 3 2 including SET commands 3 3 sample commands to include 3 3 See also GLOGIN SQL storing current date in variable for titles 7 31 login sql See glogin sql Logout 4 15 LONG column definition from DESCRIBE 13 53 LONG columns changin
193. Oracle database server itself and for all users of Oracle The tables are automatically maintained by Oracle It is sometimes referred to as the catalog Data Manipulation Language DML The category of SOL statements that query and update the database data Common DML statements are SELECT INSERT UPDATE and DELETE Occasionally DCL statements are grouped with DML statements data security The mechanisms that control the access and use of the database at the object level For example data security includes access to a specific schema object and the specific types of actions allowed for each user on the object for example user HR can issue SELECT and INSERT statements but not DELETE statements using the EMP table It also includes the actions if any that are audited for each schema object datatype 1 A standard form of data The Oracle datatypes are CHAR NCHAR VARCHAR2 NVARCHAR2 DATE NUMBER LONG CLOB NCLOB RAW LONG RAW and XMLIType however the Oracle database server recognizes and converts other standard datatypes 2 A named set of fixed attributes that can be associated with an item as a property Data typing provides a way to define the behavior of data DATE datatype A standard Oracle datatype used to store date and time data Standard date format is DD MMM YY as in 23 NOV 98 A DATE column may contain a date and time between January 1 4712 BC to December 31 9999 AD DBA See database administrator DBA
194. P AGE 1 n NONE Cause An invalid option was specified for the given command Action Check the syntax of the command you used for the correct options SP2 0160 Unable to open file name Cause Possible causes a The file was not found under the specified name in the specified location File lacked the necessary privileges to open the file A system error made it impossible to open the file Action Take the following actions Make sure the file name specified is stored in the appropriate directory a Make sure that the file has the privileges necessary for access If it does not then change privileges accordingly Consult operating system documentation or contact the System Administrator SP2 0161 Line line number truncated Cause The line in the file was too long Action No action required or reduce the length of the line SP2 0162 Unable to close file name Cause Unable to close the specified file as it was being used Action Release the file from the other process 14 10 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0171 HELP not accessible Cause On line SQL Plus help is not installed in this Oracle instance Action Contact the Database Administrator to install the on line help SP2 0172 No HELP available Cause There is no help information available for the specified command Action Enter HELP INDEX for a list of topics SP2 0176 Option Is invalid Cause The op
195. PINFO ON SHOW APPINFO APPINFO is ON and set to SQL Plus To change the default text enter SET APPINFO This is SQL Plus To make sure that registration has taken place enter VARIABLE MOD VARCHAR2 50 VARIABLE ACT VARCHAR2 40 EXECUTE DBMS APPLICATION INFO READ MODULE MOD ACT PL SQL procedure successfully completed PRINT MOD zm MOD This is SQbPlus 00000 To change APPINFO back to its default setting enter SET APPI OFF SET ARRAY SIZE 15 Sets the number of rows called a batch that SQL Plus will fetch from the database at one time Valid values are 1 to 5000 A large value increases the efficiency of queries and subqueries that fetch many rows but requires more memory Values over approximately 100 provide little added performance ARRAYSIZE has no effect on the results of SQL Plus operations other than increasing efficiency 13 100 SQL Plus User s Guide and Reference SET SET AUTO COMMIT ON OFF IMM EDIATE n Controls when Oracle commits pending changes to the database ON commits pending changes to the database after Oracle executes each successful INSERT UPDATE or DELETE command or PL SQL block OFF suppresses automatic committing so that you must commit changes manually for example with the SQL command COMMIT IMMEDIATE functions in the same manner as the ON option n commits pending changes to the database after Oracle executes n successful SQL INSERT UPDATE or DELETE commands or PL SQL
196. PLICATION_INFO package Setting APPINFO OFF disables the registering and monitoring of performance and resource usage of scripts This reduction in overheads may improve performance SET ARRAYSIZE Sets the number of rows called a batch that SQL Plus will fetch from the database at one time Valid values are 1 to 5000 A large value increases the efficiency of 9 10 SQL Plus User s Guide and Reference System Variables Influencing SQL Plus Performance queries and subqueries that fetch many rows but requires more memory Values over approximately 100 provide little added performance ARRAYSIZE has no effect on the results of SOL Plus operations other than increasing efficiency SET DEFINE OFF Controls whether SQL Plus parses scripts for substitution variables If DEFINE is OFF SQL Plus does not parse scripts for substitution variables If a script does not use substitution variables setting DEFINE OFF may give some performance gains SET FLUSH OFF SET FLUSH is not supported in iSQL Plus Controls when output is sent to the user s display device OFF allows the host operating system to buffer output which may improve performance by reducing the amount of program input and output Use OFF only when you run a script that does not require user interaction and whose output you do not need to see until the script finishes running SET SERVEROUTPUT Controls whether SQL Plus checks for and displays DBMS output If SERVEROUTPUT is
197. Plus Architecture nie Ue ee eee odi f peste p ehe Ho ee bere d 1 4 SOL Thie Installation 5e zoe th tee e dre Set ERIS 1 5 Who Can Use SOL PIus tete eet ete E ced REGES EUR e Lee REEL ee OSEE daar 1 5 How Can Learn SOL Plus eere oen tei eee tere eed Ree ee 1 6 How to Use the SOL PIus Guide 1 essent ethernet trennen nnne enn 1 6 Oracle9 Sample Tables and SOL Plus eese ee eee ee ene nnne 1 6 Unlocking th Sample Tables ait tine et reri torte aea 1 7 2 SQL Plus User Interface SQL Plus Command line User Interface esses enne ennt enn 2 2 The Command line Screen nue deed Ee Ei eee aee de EM odere ba Ce decida 2 2 iSOL Plus User Interface uet nte n e He Webs e di ele ieee 2 3 POOLAP lus Navigatioriz is sac eraat emer eti e e te te ran 2 3 ISOL Plus Lopin Sor e ire a emeret eden I n pe He PR 2 4 SOL Plus Work Screen nee AERA e e PE e eai 2 5 IDOL Plus History Screen unten o eme e ner UI Pt EAT n 2 6 SOL Plus Preferences Screen diio eei eate t e Ee HERE 2 8 iSQL Plus User Interface Options sssseeeeeeeeen nennen n nnne nennen 2 9 ISOL Plus DBA Login Screens etie een diee e e et dr bei t fe d e ura 2 10 ISOLF Plus DBA Wotzk Screen ede teet e ie HR REESE EUER ER ERA 2 12 IDOL Plus Server Statistics 4 e a ie a tee bh eer ER De CU Rene baee diane 2 12 Setting System Variables in iSQL PIUS sees eee een e enne 2 14 iSQ
198. Plus User s Guide and Reference iSQL Plus Extension for Windows Configuration On Windows include ORACLE_HOME sqlplus admin isqlplus conf On UNIX include ORACLE_HOME sqlplus admin isqlplus conf Where ORACLE HOME is the path of your Oracle home directory 5 Save your oracle apache conf file 6 Check your edits by parsing the edited configuration file See Testing the Oracle HTTP Server Configuration File 7 When you next start the Oracle HTTP Server iSQL Plus is disabled To re enable iSQL Plus reverse the edit to uncomment the include line in oracle apache conf and restart the Oracle HTTP Server Configuring the Middle Tier Oracle Net If you plan to connect to a remote database you need to ensure that you install and configure Oracle Net on the middle tier middle tier where the iSQL Plus server is running For further information about installing and configuring Oracle Net see the Oracle9i documentation Configuring the Database Tier Oracle9i is installed on the database tier The database tier may be physically separate from the middle tier and accessed using Oracle Net or it may be the same physical machine as used by the middle tier If you are using Oracle Net to access the database then make sure the database listener is configured and running For further information about installing and configuring Oracle9i see the Oracle9 documentation iSQL Plus Extension for Windows Configuration The i
199. Proxy Server Exceptions Some configurations of proxy servers may affect the ability of the SQL Plus user interface to connect with the iSQL Plus Server If you cannot connect with the iSQL Plus Server a browser alert Document contains no data or Server Interrupt Error is displayed when you try to load the iSQL Plus Login screen If the Oracle HTTP Server has been started and this situation occurs you should reconfigure your proxy server or create a proxy exception in your browser for the Oracle HTTP Server running iSQL Plus There are two examples of setting proxy exceptions following To configure the proxy exceptions setting in Netscape Navigator 4 7 for Windows 1 Select Preferences from the Edit menu 2 Select Proxies from the Advanced category 3 Select the Manual proxy configuration radio button 4 Click View The Manual proxy configuration dialog is displayed 5 Enter the Oracle HTTP Server domain for which you do not want to use a proxy in the Exceptions pane To configure the proxy exceptions setting in Microsoft Internet Explorer 5 0 1 Select Internet Options from the Tools menu 2 Click Lan Settings in the Lan Settings pane on the Connections tab 3 Click Advanced in the Proxy Server pane This is only available if Use a proxy server is selected 4 Enter followed by the Oracle HTTP Server domain for which you do not want to use a proxy in the Exceptions pane For example to enter an exception for the Oracle
200. QL Plus that you can access from your workstation Some web browsers may require you to create a MIME type or application association for files with a SQL extension in order to load them into iSQL Plus See Adding MIME Types on page 3 5 for information on how to create a MIME or application association Writing Scripts with a System Editor Your operating system may have one or more text editors that you can use to write scripts You can run your host operating system s default text editor without leaving SQL Plus by entering the EDIT command You can use the SOL Plus DEFINE command to define the variable EDITOR to hold the name of your preferred text editor For example to define the editor used by EDIT to be vi enter the following command DEFINE EDITOR vi You can include an editor definition in your user or site profile so that it is always enabled when you start SQL Plus See SQL Plus Configuration on page 3 2 and the DEFINE and EDIT commands in Chapter 13 SQL Plus Command Reference for more information To create a script with a text editor enter EDIT followed by the name of the file to edit or create for example EDIT SALES EDIT adds the filename extension SQL to the name unless you specify the file extension When you save the script with the text editor it is saved back into the same file You must include a semicolon at the end of each SOL command and a period on a line by itself after each PL SQL block in
201. R ON OFF Usage Notes On or OFF sets whether or not the cursor will close and reopen after each SOL statement This feature may be useful in some circumstances to release resources in the database server SET DOCUMENT Purpose Displays or suppresses blocks of documentation created by the DOCUMENT command Syntax SET DOC UMENT ON OFF Usage Notes SET DOCUMENT ON causes blocks of documentation to be echoed to the screen Set DOCUMENT OFF suppresses the display of blocks of documentation See DOCUMENT in this appendix for information on the DOCUMENT command Obsolete SQL Plus Commands C 5 SET MAXDATA SET MAXDATA SET SCAN SET SPACE Purpose Sets the maximum total row width that SQL Plus can process Syntax SET MAXD ATA n Usage Notes In SQL Plus the maximum row width is now unlimited Any values you set using SET MAXDATA are ignored by SQL Plus Purpose Controls scanning for the presence of substitution variables and parameters OFF suppresses processing of substitution variables and parameters ON allows normal processing Syntax SET SCAN ON OFF Usage Notes ON functions in the same manner as SET DEFINE ON Purpose Sets the number of spaces between columns in output The maximum value of n is 10 Syntax SET SPACE I n C 6 SQL Plus User s Guide and Reference TTITLE old form Usage Notes The SET SPACE 0 and SET COLSEP commands have the same effect This command is
202. R COL in Example 6 11 and that each GROUP COL or NUMBER COL had a single ampersand in front of it If you were to add three more functions using a single ampersand before each to the script SQL Plus would prompt you a total of four times for the value of the number column You can avoid being re prompted for the group and number columns by adding a second ampersand in front of each GROUP COL and NUMBER COL in STATS SQL Plus automatically DEFINEs any substitution variable preceded by two ampersands but does not DEFINE those preceded by only one ampersand When you have DEFINEd a variable SQL Plus substitutes the value of variable for each substitution variable referencing variable in the form amp variable or amp amp variable SQL Plus will not prompt you for the value of variable in this session until you UNDEFINE variable Example 6 12 Using Double Ampersands To expand the script STATS using double ampersands and then run the file first suppress the display of each line before and after substitution SET VERIFY OFF Now retrieve and edit STATS by entering the following commands GET STATS SELECT amp GROUP_COL MAX amp NUMBER COL MAXIMUM FROM amp TABLE GROUP BY amp GROUP COL 2 2 MAX amp NUMBER COL MAXIMUM APPEND 2 MAX amp NUMBER COL MAXIMUM CHANGE amp amp amp 2 MAX amp amp NUMBER COL MAXIMUM Using Scripts in SQL Plus 6 21 Writing Interactive Commands 3i MIN amp amp NUM
203. RE command syntax This command creates a script which can be executed with the START or commands If you want to store a file under a name identical to a STORE command clause that is CREATE REPLACE or APPEND you must put the name in single quotes or specify a file extension To store the current SQL Plus system variables in a file named DEFAULTENV with the default command file extension enter STORE SET DEFAULTENV To append the current SQL Plus system variables to an existing file called DEFAULTENYV with the extension OLD enter STORE SET DEFAULTENV OLD APPEND 13 138 SQL Plus User s Guide and Reference TIMING TIMING Syntax Terms Usage TIMING START text S HOW STOP Records timing data for an elapsed period of time lists the current timer s name and timing data or lists the number of active timers Refer to the following list for a description of each term or clause START text Sets up a timer and makes text the name of the timer You can have more than one active timer by STARTing additional timers before STOPping the first SQL Plus nests each new timer within the preced ing one The timer most recently STARTed becomes the current timer SHOW Lists the current timer s name and timing data STOP Lists the current timer s name and timing data then deletes the timer If any other timers are active the next most recently STARTed timer becomes the current timer Enter TIMING with no
204. ROUTPUT OFF 9 11 SET TRIMOUT ON 9 11 SET TRIMSPOOL ON 9 11 SQL Plus 9 2 system variables 9 10 U G U U U U U U NDEFINE command 6 18 13 144 and DEFINE command 13 49 UNDERLINE variable 13 99 13 123 u nicode 12 2 12 3 unlocking sample tables 1 7 NTIL CANCEL clause 13 81 NTIL CHANGE clause 13 81 NTIL CONTROLFILE clause 13 82 NTIL TIME clause 13 81 PDATE command disabling 10 5 RL 1 5 running dynamic reports 8 13 starting iSOL Plus 4 15 USER clause 13 126 user interfaces 2 3 command line 2 2 user profile 3 2 GLOGIN SQL 3 2 LOGIN SQL 3 2 See also site profile user variables 6 17 defining 6 17 13 49 deleting 6 18 13 144 displaying in headers and footers 13 89 displaying in titles 13 141 in ACCEPT command 6 27 13 10 listing definition of one 6 17 13 49 listing definitions of all 6 18 13 49 username 4 17 connecting under different 4 18 13 46 created at installation 4 17 field 2 4 2 11 3 16 4 19 in CONNECT command 4 18 13 46 in COPY command B 5 B 8 B 9 in SOLPLUS command 4 2 4 10 4 21 username password adding authentication file entries 10 12 USING BACKUP CONTROL FILE clause 13 81 USING clause B 3 B 6 UTF 8 12 2 12 3 V V SESSION virtual table 13 99 V SOLAREA virtual table 13 99 VARCHAR columns changing format 7 6 default format 7 6 13 31 VARCHAR2 column definition from DESCRIBE 13 53 VARCHAR c
205. RRORS SHOW ERRORS PROCEDURE HR PROC1 Errors for PROCEDURE HR PROC1 LINE COL ERROR 3 3 PLS 00049 bad bind variable P1 To show whether AUTORECOVERY is enabled enter SHOW AUTORECOVERY AUTORECOVERY ON To display the connect identifier for the default instance enter SHOW INSTANCE INSTANCE LOCAL To display the location for archive logs enter SHOW LOGSOURCE LOGSOURCE usr oracle90 dbs arch SQL Plus Command Reference 13 127 SHOW To display information about the SGA enter SHOW SGA Total System Global Area 7629732 bytes Fixed Size 60324 bytes Variable Size 6627328 bytes Database Buffers 409600 bytes Redo Buffers 532480 bytes 13 128 SQL Plus User s Guide and Reference SHUTDOWN SHUTDOWN Syntax Terms SHUTDOWN ABORT IMMEDIATE NORMAL TRANSACTIONAL LOCAL Shuts down a currently running Oracle instance optionally closing and dismounting a database Refer to the following list for a description of each term or clause ABORT IMMEDIATE NORMAL Proceeds with the fastest possible shutdown of the database without waiting for calls to complete or users to disconnect Uncommitted transactions are not rolled back Client SOL statements currently being processed are terminated All users currently con nected to the database are implicitly disconnected and the next data base startup will require instance recovery You must use this option if a background process
206. RTMENT_ NAME html amp quot amp gt DEPARTMENT NAME amp lt A amp gt DEPARTMENT NAME CITY lt br gt 2 FROM EMP DETAILS VIEW lt br gt 3 WHERE SALARY amp gt 12000 lt br gt lt p gt lt table WIDTH 90 BORDER 5 gt lt tr gt lt th gt DEPARTMENT lt th gt lt th gt CITY lt th gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Executive html gt Executive lt A gt lt td gt lt td gt Seattle lt td gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Executive html gt Executive lt A gt lt td gt lt td gt Seattle lt td gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Executive html gt Executive lt A gt lt td gt lt td gt Seattle lt td gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Sales html gt Sales lt A gt lt td gt lt td gt Oxford lt td gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Sales html gt Sales lt A gt lt td gt lt td gt Oxford lt td gt lt tr gt lt tr gt lt td gt lt A HREF http oracle com Marketing html gt Marketing lt A gt lt td gt lt td gt Toronto lt td gt lt tr gt lt table gt lt p gt c 6 rows selected lt br gt SQL amp gt spool off lt br gt lt body gt lt html gt Generating HTML Reports from SQL Plus 8 5 Creating Reports using Command line SQL P lus Example 8 2 Creating a Report using the SQLPLUS Command Enter the followi
207. Report with Spacing and Summary Lines When you use an ORDER BY clause in your SQL SELECT command rows with the same value in the ordered column or expression are displayed together in your output You can make this output more useful to the user by using the SQL Plus BREAK and COMPUTE commands to create subsets of records and add space and or summary lines after each subset The column you specify in a BREAK command is called a break column By including the break column in your ORDER BY clause you create meaningful subsets of records in your output You can then add formatting to the subsets within the same BREAK command and add a summary line containing totals averages and so on by specifying the break column in a COMPUTE command SELECT DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY 12000 ORDER BY DEPARTMENT ID DEPARTMENT ID LAST NAME SALARY 20 Hartstein 13000 80 Russell 14000 80 Partners 13500 90 King 24000 90 Kochhar 17000 90 De Haan 17000 6 rows selected To make this report more useful you would use BREAK to establish DEPARTMENT ID as the break column Through BREAK you could suppress duplicate values in DEPARTMENT ID and place blank lines or begin a new page between departments You could use BREAK in conjunction with COMPUTE to calculate and print summary lines containing the total and or average maximum minimum standard deviation variance or count of rows of salary for
208. SQL Plus User s Guide and Reference Release 9 2 March 2002 Part No A90842 01 ORACLE SQL Plus User s Guide and Reference Release 9 2 Part No A90842 01 Copyright 1996 2002 Oracle Corporation All rights reserved Primary Author Simon Watt Contributors Andrew Code Alison Goggin Alison Holloway Christopher Jones Luan Nim Marcus Pecher Andrei Souleimanian Christopher Tan Ian Wu The Programs which include both the software and documentation contain proprietary information of Oracle Corporation they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright patent and other intellectual and industrial property laws Reverse engineering disassembly or decompilation of the Programs except to the extent required to obtain interoperability with other independently created software or as specified by law is prohibited The information contained in this document is subject to change without notice If you find any problems in the documentation please report them to us in writing Oracle Corporation does not warrant that this document is error free Except as may be expressly permitted in your license agreement for these Programs no part of these Programs may be reproduced or transmitted in any form or by any means electronic or mechanical for any purpose without the express written permission of Oracle Corporation If the Programs are delivered to the U
209. SQL Plus Basics 5 13 Listing PL SQL Definitions JOB_ID NOT NULL VARCHAR2 10 MANAGER ID NUMBER 6 DEPARTMENT ID NUMBER 4 LOCATION ID NUMBER 4 COUNTRY ID CHAR 2 FIRST NAME VARCHAR2 20 LAST_NAME NOT NULL VARCHAR2 25 SALARY NUMBER 8 2 COMMISSION_PCT NUMBER 2 2 DEPARTMENT_NAME NOT NULL VARCHAR2 30 JOB TITLE NOT NULL VARCHAR2 35 CITY NOT NULL VARCHAR2 30 STATE PROVINCE VARCHAR2 25 COUNTRY NAME VARCHAR2 40 REGION NAME VARCHAR2 25 Note DESCRIBE accesses information in the Oracle data dictionary You can also use SOL SELECT commands to access this and other information in the database See your Oracle9i SQL Reference for details Listing PL SQL Definitions 5 14 To see the definition of a function or procedure use the SOL Plus DESCRIBE command Example 5 5 Using the DESCRIBE Command To list the definition of a function called AFUNC enter DESCRIBE afunc as FUNCTION afunc RETURNS NUMBER Argument Name Type In Out Default Fl CHAR IN F2 NUMBER IN SQL Plus User s Guide and Reference Interpreting Error Messages Controlling the Display Suppose that you wish to stop and examine the contents of the screen while displaying a long report or the definition of a table with many columns The display will pause while you examine it To continue press Resume If you wish you can use the PAUSE variable of the SQL Plus SET command to have SQL Plus pause af
210. SQL Plus Extension for Windows is accessed through extended menus in Windows platforms The iSQL Plus Extension for Windows extended menu is accessed by right clicking files with the SQL file extension If you have installed the Oracle9i Server iSQL Plus Server entries for your Oracle HTTP Server are created by default If you have installed the Oracle9i Client no Configuring SQL Plus 3 15 iSQL Plus Extension for Windows Configuration iSQL Plus Server entries are created You can use the Configuration dialog to configure the available iSQL Plus Servers that you want Configuration Dialog You can open the Configuration dialog by right clicking a SQL file in Windows Explorer then select iSQL Plus Servers and then Configure The Configure iSQL Plus Servers dialog is displayed When the column is narrower than the field it contains tool tips show the full text in the field but to edit or copy a field make sure that the column width is wide enough to display the full field You can widen the column by selecting and dragging the heading column separator You can sort the list of SQL Plus Servers in ascending or descending field name order by clicking the field name column heading You can also manually sort the server definitions by using the up and down arrow buttons on the right side of the list of iSQL Plus Servers Configure iSQL Plus Servers iSQL Plus Servers URL Name Connect String Execut lt lt http jhost doma
211. SQL Plus commands to configure the SQL Plus environment enter edit store retrieve and run SOL commands and PL SQL blocks format perform calculations on store and print from query results interact with an end user startup and shutdown a database connect to a database define variables capture errors a list column definitions for any table perform database administration You can use SQL Plus to generate reports interactively to generate reports as batch processes and to output the results to text file to screen or to HTML file for browsing on the Internet You can generate reports dynamically using the HTML output facility of SOL Plus in combination with server side CGI scripts or using the dynamic reporting capability of SQL Plus to run a script from a web page For example to describe a database object using iSQL Plus enter DESCRIBE EMP_DETAILS_VIEW which produces the following output 1 2 SQL Plus User s Guide and Reference What is SQL Plus EMPLOYEE ID NOT NULL NUMBER lJOB ID NOT NULL MARCHAR2 10 MANAGER ID NUMBER 6 DEPARTMENT ID NUMBER 4 LOCATION ID NUMBER 4 COUNTRY ID CHAR 2 FIRST NAME WARCHAR2 20 LAST NAME NOT NULL MARCHAR2 25 SALARY NUMBER 2 COMMISSION PCT NUMBER Q 2 DEPARTMENT NAME NOT NULL MARCHAR2 30 JOB_TITLE NOT NULL MARCHAR2 35 city NOT NULL MARCHAR2 30 STATE PROVINCE MARCHAR2 25 COUNTRY_NAME W
212. SQL Plus commands to one or a few letters Abbreviations for some SQL Plus commands are described along with the commands in Chapter 3 Configuring SOL Plus Chapter 5 SOL Plus Basics and Chapter 6 Using Scripts in SQL Plus For abbreviations of all SQL Plus commands see Chapter 13 SQL Plus Command Reference 5 8 SQL Plus User s Guide and Reference Running SQL Plus Commands E Example 5 2 Entering a SQL Plus Command This example shows how you might enter a SQL Plus command to change the format used to display the column SALARY of the sample view EMP_DETAILS_ VIEW 1 On the command line enter this SQL Plus command COLUMN SALARY FORMAT 99 999 HEADING MONTHLY SALARY If you make a mistake use Backspace to erase it and re enter When you have entered the line press Return SOL Plus notes the new format and displays the SQL Plus command prompt again ready for a new command 2 Enter the RUN command to re run the most recent query from Example 2 3 RUN EMPLOYEE ID LAST NAME JOB ID MONTHLY SALARY 100 King AD PRES 24 000 101 Kochhar AD VP 17 000 102 De Haan AD VP 17 000 145 Russell SA MAN 14 000 146 Partners SA MAN 13 500 201 Hartstein MK MAN 13 000 6 rows selected The COLUMN command formatted the column SALARY with a dollar sign and a comma and gave it a new heading The RUN command then re ran the query of Example 5 1 Entering a SOL Command which was stored in the buf
213. SUM OF SALARY ON DUMMY BREAK ON DUMMY SKIP 1 SELECT DEPARTMENT ID DUMMY DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE DEPARTMENT ID 20 ORDER BY DEPARTMENT ID DEPARTMENT_ID LAST_NAME SALARY 10 Whalen 4400 4400 20 Hartstein 13000 20 Fay 6000 19000 To total the salary at the end of the report without printing the compute label enter COLUMN DUMMY NOPRINT COMPUTE SUM OF SALARY ON DUMMY BREAK ON DUMMY SELECT NULL DUMMY DEPARTMENT_ID LAST_NAME SALARY FROM EMP_DETAILS_VIEW WHERE DEPARTMENT_ID lt 30 ORDER BY DEPARTMENT_ID 13 44 SQL Plus User s Guide and Reference COMPUTE DEPARTMENT_ID LAST NAME SALARY Whalen 4400 Hartstein 13000 Fay 6000 Raphaely 11000 Khoo 3100 Baida 2900 Tobias 2800 Himuro 2600 Colmenares 2500 48300 9 rows selected SQL Plus Command Reference 13 45 CONNECT CONNECT Syntax Terms CONNECT logon AS SYSOPER SYSDBA where logon requires the following syntax username passwora connect_identifier Connects a given username to Oracle In iSQL Plus you must always include your username and password in a CONNECT command as iSQL Plus does not prompt for a missing password CONNECT does not reprompt for username or password if the initial connection does not succeed Refer to the following list for a description of each term or clause usernamelpassword The username and password with which you w
214. Sample CGI program to run SQL Plus employee sql Sample SQL script to generate a report from the HR sample schema These scripts need to be customized for your site INSTALLATION INSTRUCTIONS 1 Put plus pl this file in the cgi bin directory of your web server and edit the environment variable section at the top of the file Make the program executable for example on UNIX chmod x plus pl You may need to customize the top line of this script to point to the Perl installation on your machine and in the syntax required for your operating system 2 Put employee sgl in the cgi bin directory too 3 Put plus html in a directory you can access from the web Edit plus html to change the form URL to that of your web server 4 Open plus html in your browser and enter the fields As this demonstation uses the view EMP DETAILS VIEW from the HR sample schema enter the associated username HR and password If your database is not the default or is on another machine enter a valid network alias or full connection identifier in the Connect Identifier field otherwise leave it blank If employee sql is in your cgi bin directory you will probably not need to specify a path otherwise specify a machine path and filename Sdebug 0 Set this to 1 to see the form fields values entered Generating HTML Reports from SQL Plus 8 9 Creating Reports using Command line SQL P lus Customize these environment variables and the exec
215. Specifies the names of the columns in destination_table You must enclose a name in double quotes if it contains lowercase letters or blanks If you specify columns the number of columns must equal the number of columns selected by the query If you do not specify any columns the copied columns will have the same names in the destination table as they had in the source if COPY creates destination_table Specifies a SOL query SELECT command determining which rows and columns COPY copies SQL Plus COPY Command B 3 COPY Command Syntax Usage Examples To enable the copying of data between Oracle and non Oracle databases NUMBER columns are changed to DECIMAL columns in the destination table Hence if you are copying between Oracle databases a NUMBER column with no precision will be changed to a DECIMAL 38 column When copying between Oracle databases you should use SQL commands CREATE TABLE AS and INSERT or you should ensure that your columns have a precision specified The SQL Plus SET LONG variable limits the length of LONG columns that you copy If any LONG columns contain data longer than the value of LONG COPY truncates the data SQL Plus performs a commit at the end of each successful COPY If you set the SQL Plus SET COPYCOMMIT variable to a positive value n SQL Plus performs a commit after copying every n batches of records The SOL Plus SET ARRAYSIZE variable determines the size of a batch Some operating enviro
216. TART commands The syntax is url file_name ext arg file_name ext STA RT url file name ext arg url specifies a script to run on the specified web server SOL Plus supports HTTP FIP and gopher protocols Pass variable values to the script in the usual way for example http machine name domain port script sqgl valuel value2 Note This feature is only available on Microsoft Windows SET APPINFO The default for SET APPINFO is now OFF This allows some privileged DBA operations to be executed when the database is not fully configured Add SET APPINFO ON to glogin sgl to get the previous behavior SET SQLPLUSCOMPATIBILITY There is a new SET command SET SOLPLUSCOMPATTIBILITY x y z It sets the behavior of the VARIABLE command to that of the version specified by SOLPLUSCOMPATIBILITY In later releases of SQL Plus SQLPLUSCOMPATIBILITY may support features other than VARIABLE The SQLPLUSCOMPATIBILITY command can be used to help keep the expected behavior of a release HR Sample Schema The SQL Plus documentation uses a new set of sample schemas for all examples See the Oracle9i Sample Schemas guide for details on access implementation and use of the sample schemas xxxvii xxxviii SQL Plus Quick Start This chapter contains single pages of instructions to get you up and running after you have installed SOL Plus a iSQL Plus Quick Start a SQL Plus Command line Quick Start for Windows
217. TARTUP command for the correct usage SP2 0715 Invalid combination of SHUTDOWN options Cause The specified options of the SHUTDOWN command cannot be used simultaneously Action Check the syntax of the SHUTDOWN command for the correct usage SP2 0716 Invalid combination of ARCHIVE LOG options Cause The specified options of the ARCHIVE LOG command cannot be used simultaneously Action Check the syntax of the ARCHIVE LOG command for the correct usage SQL Plus Error Messages 14 31 SQL Plus Error Messages SP2 0717 Illegal SHUTDOWN option Cause An invalid option was used in the SHUTDOWN command Action Check the syntax of the SHUTDOWN command for the correct options SP2 0718 Illegal ARCHIVE LOG option Cause An invalid option was used in the ARCHIVE LOG command Action Check the syntax of the ARCHIVE LOG command for the correct options SP2 0728 Specify log lt RET gt suggested filename AUTO CANCEL Cause This isa RECOVER DATABASE command prompt prompting for the redo log files to be applied Action Enter one of the redo log file options SP2 0729 Cannot SET INSTANCE while connected to a database Cause There was a problem with the connection instance while issuing the SET INSTANCE command Action Disconnect from the instance before re issuing the command SP2 0733 Invalid connect string Cause An invalid connect string was specified Action Check that the connect string is correct SP2 0734
218. TER EMPLOYEE LISTING REPORT TTITLE RIGHT Page FORMAT 999 SOL PNO SELECT LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY 12000 Page 1 EMPLOYEE LISTING REPORT Page 2 LAST NAME SALARY King 24000 Kochhar 17000 De Haan 17000 Russell 14000 Partners 13500 Hartstein 13000 sum 98500 6 rows selected To suppress the report header without changing its definition enter REPHEADER OFF SQL Plus Command Reference 13 91 RUN Syntax Usage Examples n R UN Lists and executes the SOL command or PL SQL block currently stored in the SOL buffer RUN causes the last line of the SOL buffer to become the current line The slash command functions similarly to RUN but does not list the command in the SOL buffer on your screen The SOL buffer always contains the last SOL statement or PL SQL block entered Assume the SQL buffer contains the following script SELECT DEPARTMENT ID FROM EMP DETAILS VIEW WHERE SALARY gt 12000 To RUN the script enter RUN 1 SELECT DEPARTMENT ID 2 FROM EMP DETAILS VIEW 3 WHERE SALARY gt 12000 DEPARTMENT ID 6 rows selected 13 92 SQL Plus User s Guide and Reference SAVE SAVE Syntax Terms Usage SAVE is not available in iSQL Plus In iSQL Plus use Save Script SAVE FILE file name ext CRE ATE REP LACE APP END Saves the contents of the SOL buffer in a host operating system script Refer to the following li
219. TOMER DATE QUANTITY REMARKS 123 25 AUG 2001 144 This order must be s hipped by air freigh t to ORD If you replace WRAP with WORD WRAP REMARKS looks like this CUSTOMER DATE QUANTITY REMARKS 123 25 AUG 2001 144 This order must be shipped by air freight to ORD If you specify TRUNCATE REMARKS looks like this CUSTOMER DATE QUANTITY REMARKS 123 25 AUG 2001 144 This order must be s In order to print the current date and the name of each job in the top title enter the following Use the EMPLOYEES table of the HR schema in this case instead of EMP DETAILS VIEW as you have used up to now For details on creating a date variable see Displaying the Current Date in Titles under Defining Page and Report Titles and Dimensions on page 7 30 COLUMN JOB ID NOPRINT NEW VALUE JOBVAR COLUMN TODAY NOPRINT NEW VALUE DATEVAR BREAK ON JOB ID SKIP PAGE ON TODAY TTITLE CENTER Job Report RIGHT DATEVAR SKIP 2 LEFT Job JOBVAR SKIP 2 SELECT TO CHAR SYSDATE MM DD YYYY TODAY LAST NAME JOB ID MANAGER ID HIRE DATE SALARY DEPARTMENT ID SQL Plus Command Reference 13 37 COLUMN E FROM EMPLOYEES WHERE JOB ID IN ORDER BY JOB ID LAST NAME Your two page report would look similar to the following report with Job Report MK MAN centered within your current linesize 04 19 01 Job MK MAN LAST NAME MANAGER ID SA MAN SALARY DEPARTMENT_ID Hartstein Job SA_MAN MANAGER ID
220. TTP server handling your request has timed out and your session has expired or the web server has halted In either case session information for example current database connection values of SET variables is not available Action Restart the web server if necessary and re login to iSQL Plus SP2 0858 Usage SET MARKUP HTML HEAD text BODY text TABLE text ENTMAP ON OFF PRE FORMAT ON OFF Cause An invalid option to SET MARKUP was entered in iSQL Plus Action Remove the invalid option SP2 0860 For a list of known commands enter HELP Cause An invalid command sequence was entered Action Use the HELP command to show the syntax of SQL Plus commands SP2 0863 iSQL Plus processing completed Cause All commands in the iSQL Plus input script have been executed with no explicit output Action No action required 14 36 SQL Plus User s Guide and Reference iSQL Plus Error Messages SP2 0864 Session has expired Please log in again Cause The iSQL Plus session was idle for too long and the context has been removed to free resources for other connections Action Reconnect to iSQL Plus The System Administrator configures the time out period SP2 0865 Session is blocked Please log in again Cause An attempt was made to execute a query from iSQL Plus when a previous query was still processing This condition occurs when the browser back button or stop button is pressed during query processing Actio
221. The escape character in a command prompt is the caret Your prompt reflects the subdirectory in which you are working Referred to as the command prompt in this manual Convention Meaning Example HOME_NAME ORACLE_HOME and ORACLE_ BASE The backslash special character is sometimes required as an escape character for the double quotation mark special character at the Windows command prompt Parentheses and the single quotation mark do not require an escape character Refer to your Windows operating system documentation for more information on escape and special characters Represents the Oracle home name The home name can be up to 16 alphanumeric characters The only special character allowed in the home name is the underscore In releases prior to Oracle8i release 8 1 3 when you installed Oracle components all subdirectories were located under a top level ORACLE HOME directory that by default used one of the following names a C orant for Windows NT a C Vorawin98 for Windows 98 This release complies with Optimal Flexible Architecture OFA guidelines All subdirectories are not under a top level ORACLE HOME directory There is a top level directory called ORACLE BASE that by default is C oracle If you install Oracle9i release 1 9 0 1 on a computer with no other Oracle software installed then the default setting for the first Oracle home directory is C NoracleNora90 The Oracle
222. Tuning Guide and Reference and Oracle9i Database Performance Planning Tuning SQL Plus 9 1 Tracing Statements Tracing Statements You can automatically get a report on the execution path used by the SQL optimizer and the statement execution statistics The report is generated after successful SQL DML that is SELECT DELETE UPDATE and INSERT statements It is useful for monitoring and tuning the performance of these statements Controlling the Report You can control the report by setting the AUTOTRACE system variable SET AUTOTRACE OFF No AUTOTRACE report is generated This is the default SET AUTOTRACE ON EXPLAIN The AUTOTRACE report shows only the optimizer execution path SET AUTOTRACE ON The AUTOTRACE report shows only the SQL STATISTICS statement execution statistics SET AUTOTRACE ON The AUTOTRACE report includes both the optimizer execution path and the SQL statement execution statistics SET AUTOTRACE TRACEONLY Like SET AUTOTRACE ON but suppresses the printing of the user s query output if any If STATISTICS is enabled query data is still fetched but not printed To use this feature you must create a PLAN_TABLE table in your schema and then have the PLUSTRACE role granted to you DBA privileges are required to grant the PLUSTRACE role For information on how to grant a role and how to create the PLAN_TABLE table see the Oracle9i SQL Reference For more information about the roles and the PLAN_TABLE se
223. Unknown command beginning command name rest of line ignored Cause The command entered was invalid Action Check the syntax of the command you used for the correct options SP2 0735 Unknown command_name option beginning option_name Cause An invalid option was specified for a given command Action Check the syntax of the command you used for the correct options SP2 0736 Command line overflow while substituting into line beginning string_ name Cause The maximum length of the command line was exceeded Action Reduce the length of the data in the substitution variables used in the command 14 32 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0737 Usage SET DESCRIBE DEPTH 1l nl ALL LINENUM ON OFF INDENT ON OFF Cause An invalid option was used in the SET DESCRIBE command Action Check the syntax of the SET DESCRIBE command for the correct options SP2 0738 Restricted command command_name not available Cause For security reasons the command was restricted by the RESTRICT command line option Action Ask your Database Administrator why SQL Plus should be run with a RESTRICT option SP2 0745 Usage SET SOLPLUSCOMPATTIBILITY version release update Cause An invalid option was used in the SET SOLPLUSCOMPATTIBLITY command Action Check the syntax of the SET SOLPLUSCOMPATIBLITY command for the correct options SP2 0746 command option option out of range lower through upper
224. a SQL Plus command not a SQL command even though it contains a query Since most COPY commands are longer than one line you must use a line continuation hyphen optionally preceded by a space at the end of each line except the last Interpreting the Messages that COPY Displays The first three messages displayed by COPY show the values of SET command variables that affect the COPY operation The most important one is LONG which limits the length of a LONG column s value LONG is a datatype similar to CHAR If the source table contains a LONG column COPY truncates values in that column to the length specified by the system variable LONG The variable ARRAYSIZE limits the number of rows that SOL Plus fetches from the database at one time This number of rows makes up a batch The variable COPYCOMMIIT sets the number of batches after which COPY commits changes to the database If you set COPYCOMMIIT to zero COPY commits changes only after B 8 SQL Plus User s Guide and Reference Copying Data between Tables on One Database all batches are copied For more information on SET variables including how to change their settings see the SET command on page 13 95 After listing the three system variables and their values COPY tells you if a table was dropped created or updated during the copy Then COPY lists the number of rows selected inserted and committed Specifying Another User s Table You can refer to another user
225. a bind variable created with VARIABLE use the PRINT command For more information see the PRINT command in this chapter To automatically display the value of a bind variable created with VARIABLE use the SET AUTOPRINT command For more information see the SET AUTOPRINT command in this chapter Bind variables cannot be used in the COPY command or SQL statements except in PL SQL blocks Instead use substitution variables When you execute a VARIABLE CLOB or NCLOB command SQL Plus associates a LOB locator with the bind variable The LOB locator is automatically populated when you execute a SELECT clob_column INTO cv statement in a PL SQL block SQL Plus closes the LOB locator after completing a PRINT statement for that bind variable or when you exit SQL Plus SOL PlIus SET commands such as SET LONG and SET LONGCHUNKSIZE and SET LOBOFFSET may be used to control the size of the buffer while PRINTing CLOB or NCLOB bind variables SQL Plus REFCURSOR bind variables may be used to reference PL SQL 2 3 or higher Cursor Variables allowing PL SQL output to be formatted by SOL Plus For more information on PL SQL Cursor Variables see your PL SQL User s Guide and Reference When you execute a VARIABLE REFCURSOR command SQL Plus creates a cursor bind variable The cursor is automatically opened by an OPEN FOR SELECT statement referencing the bind variable in a PL SQL block SQL Plus closes the cursor after completing a PRINT stateme
226. a web browser with programs running on the server CGI scripts enable this user interaction to create dynamic web pages or web page elements or to take user input and respond accordingly A very common use is to provide an interactive form which a user completes online and then submits Some common languages in use for CGI scripts are Perl JavaScript and Java computation Used to perform runtime calculations on data fetched from the database These calculations are a superset of the kinds of calculations that can be done directly with a SELECT statement See also formula column computed column See computation configuration In Oracle Net the set of instructions for preparing network communications as outlined in the Oracle Net documentation configuration files Files that are used to identify and characterize the components of a network Configuration is largely a process of naming network components and identifying relationships among those components connect To identify yourself to Oracle by entering your username and password in order to gain access to the database In SQL Plus the CONNECT command allows you to log off Oracle and then log back on with a specified username connect identifier The set of parameters including a protocol that Oracle Net uses to connect to a specific Oracle instance on the network current line In an editor such as the SQL Plus editor the line in the current buffer that editing comma
227. able at the prompt SP2 0241 No room for symbol symbol name not defined Cause Unable to allocate memory for the symbol Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0244 Cannot issue a PRINT command within a PAGE break Cause The PRINT command is not allowed within a PAGE break Action Check the syntax of the PRINT command for the correct options SP2 0245 Unable to allocate temporary storage for printing Cause Unable to allocate temporary storage for printing Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0246 Illegal FORMAT string column format name Cause An invalid format was specified for the column Action Specify a valid format for the column SP2 0249 variable name not a valid variable type for printing Cause The specified variable is not valid for printing Action Check the variable type before re typing the command SP2 0253 Data item line number data item name will not fit on line Cause The current line size setting is too small to fit the specified data item on a line Action Increase the line size so that the item can be displayed 14 12 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0258 Could not create variable varia
228. abling 10 5 DESCRIBE command SQL Plus 5 13 13 53 connect identifier 13 53 PL SQL properties listed by 13 54 table properties listed by 13 53 DISABLED keyword disabling commands 10 4 disabling iSQL Plus 3 14 PL SQL commands 10 5 SQL commands 10 4 SQL Plus commands 10 4 DISCONNECT command 4 18 13 60 DOCUMENT command C 2 C 3 REMARK as newer version of C 4 DOCUMENT variable C 2 C 5 DROP command disabling 10 5 DUPLICATES clause 13 21 dynamic reports creating 8 13 E ECHO variable 6 14 13 96 13 107 EDIT command 6 2 13 61 creating scripts with 6 2 defining EDITOR 13 61 disabling 10 5 modifying scripts 6 3 13 61 setting default file name 13 96 13 107 EDITFILE variable 13 96 13 107 editing external editor 5 2 inputarea 5 2 scripts 5 2 editor 5 2 EMBEDDED variable 13 96 13 107 EMP table 1 7 enabling HTTP Server authentication 3 11 10 10 enabling iSOL Plus 3 14 Enter statements field 2 6 2 7 entities HTML 8 12 ENTMAP 4 6 ENTMAP clause 4 6 8 12 13 30 error messages copy command 14 45 iSQL Plus 14 35 sqlplus 14 2 error messages interpreting 5 15 errors making line containing current 6 6 escape characters definition of 13 96 13 108 ESCAPE variable 6 23 13 96 13 108 example embedded CGI report 8 7 interactive HTML report 8 3 8 6 execute button 2 6 EXECUTE command 13 63 disabling 10 5 executing a CREATE command 5 6 statements 5 3 executing scripts S
229. ach page depends on the current page dimensions The default page dimensions used by SQL Plus are shown below number of lines before the top title 1 number of lines per page from the top title to the bottom of the page 24 number of characters per line 80 You can change these settings to match the size of your computer screen or for printing the size of a sheet of paper You can change the page length with the system variable PAGESIZE For example you may wish to do so when you print a report Formatting SQL Plus Reports 7 31 Defining Page and Report Titles and Dimensions To set the number of lines between the beginning of each page and the top title use the NEWPAGE variable of the SET command SET NEWPAGE number_of_lines If you set NEWPAGE to zero SQL Plus skips zero lines and displays and prints a formfeed character to begin a new page On most types of computer screens the formfeed character clears the screen and moves the cursor to the beginning of the first line When you print a report the formfeed character makes the printer move to the top of a new sheet of paper even if the overall page length is less than that of the paper If you set NEWPAGE to NONE SQL Plus does not print a blank line or formfeed between report pages To set the number of lines on a page use the PAGESIZE variable of the SET command SET PAGESIZE number_of_lines You may wish to reduce the linesize to center a title properly
230. acing and Summary Lines Example 7 12 Combining Spacing Techniques Type the following SELECT DEPARTMENT_ID JOB_ID LAST_NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 ORDER BY DEPARTMENT ID JOB ID Now to skip a page when the value of DEPARIMENT ID changes and one line when the value of JOB 1D changes enter the following command BREAK ON DEPARTMENT ID SKIP PAGE ON JOB ID SKIP 1 To show that SKIP PAGE has taken effect create a TTITLE with a page number TTITLE COL 35 FORMAT 9 Page SQL PNO Run the new query to see the results Page 1 DEPARTMENT ID JOB ID LAST NAME SALARY 20 MK MA Hartstein 13000 Page 2 DEPARTMENT ID JOB ID LAST NAME SALARY 80 SA MAJ Russell 14000 Partners 13500 Page 3 DEPARTMENT ID JOB ID LAST NAME SALARY 90 AD PRES King 24000 AD VP Kochhar 17000 De Haan 17000 6 rows selected Formatting SQL Plus Reports 7 15 Clarifying Your Report with Spacing and Summary Lines Listing and Removing Break Definitions Before continuing turn off the top title display without changing its definition TTITLE OFF You can list your current break definition by entering the BREAK command with no clauses BREAK You can remove the current break definition by entering the CLEAR command with the BREAKS clause CLEAR BREAKS You may wish to place the command CLEAR BREAKS at the beginning of every script to ensure that previously entered BREAK commands wi
231. acle datatype A NUMBER column can contain a number with or without a decimal point and a sign and can have from 1 to 105 decimal digits only 38 digits are significant NVARCHAR2 datatype Beginning with Oracle9i the NVARCHAR2 datatype is redefined to be a Unicode only datatype The NVARCHAR2 datatype specifies a variable width national character set character string with width specifications referring to the number of characters and can have a maximum column size up to 4000 bytes For more information about the NVARCHAR2 datatype refer to the Oracle9i SQL Reference Glossary 15 Glossary 16 object An object is an instance of an object type In Oracle9i objects can be persistent i e stored in the database or transient i e PL SQL or Oracle Call Interface OCT variables See also object type object relational model A database model that combines the key aspects of the relational and object data models into a single system Oracle9i is an object relational database system object type A user defined type that models a structure and behavior of an object Equivalent to the concept of a class in different programming languages In Oracle9i object types have public interfaces with attributes and methods Object types are also known as abstract data types online redo log 1 Redo log files that have not been archived but are either available to the instance for recording database activity or are filled and waiti
232. acter printed in each line You can set RECSEPCHAR to any character You may wish to wrap whole words to additional lines when a column value wraps to additional lines To do so use the WORD WRAPPED clause of the COLUMN command as shown below COLUMN column name WORD WRAPPED 7 10 SQL Plus User s Guide and Reference Formatting Columns Example 7 9 Printing a Line of Characters after Wrapped Column Values To print a line of dashes after each wrapped column value enter the commands SET RECSEP WRAPPED SET RECSEPCHAR Finally enter the following query SELECT LAST NAME JOB TITLE CITY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 Now restrict the width of the column JOB TITLE and tell SOL Plus to wrap whole words to additional lines when necessary COLUMN JOB TITLE FORMAT A20 WORD WRAPPED Run the query LAST NAME JOB TITLE CITT King President Seattle Kochhar Administration Vice Seattle President De Haan Administration Vice Seattle President Russell Sales Manager Oxford Partners Sales Manager Oxford Hartstein Marketing Manager Toronto 6 rows selected If you set RECSEP to EACH SQL Plus prints a line of characters after every row after every department for the above example Before continuing set RECSEP to OFF to suppress the printing of record separators SET RECSEP OFF Formatting SQL Plus Reports 7 11 Clarifying Your Report with Spacing and Summary Lines Clarifying Your
233. after every successful execution of a SQL command or PL SQL block Setting the AUTOCOMMIT variable of the SET command to ON enables this feature Setting the AUTOCOMMIT variable to n enables this feature after every n successful INSERT UPDATE or DELETE commands or PL SQL blocks background process A non interactive process that runs in an operating system environment and performs some service or action Certain Oracle database server products use background processes for different tasks such as performing and coordinating tasks on behalf of concurrent users of the database processing and delivering electronic messages and managing printing services bind reference A reference to a parameter used to replace a single literal value for example a character string number or date appearing anywhere in a PL SQL construct or a SQL SELECT statement For a bind reference you must precede the parameter name with a colon bind variable A variable in a SQL statement that must be replaced with a valid value or the address of a value in order for the statement to successfully execute bit The smallest unit of data A bit only has two possible values 0 or 1 Bits can be combined into groups of eight called bytes each byte represents a single character of data See also byte block In PL SQL a group of SQL and PL SQL commands related to each other through procedural logic body A report region that contains the bulk of the repor
234. age 13 9 Symbols pound sign 13 34 number format 7 5 amp ampersand disabling substitution variables 6 23 substitution variables 6 18 amp amp 6 21 asterisk in DEL command 6 4 13 51 in LIST command 6 4 13 73 comment delimiters 6 10 colon bind variables 6 31 BindVariable clause EXIT command 13 65 semicolon 5 4 at sign command 3 4 6 14 13 5 command arguments 13 6 Index in CONNECT command 13 46 in COPY command B 2 B 5 in SOLPLUS command 4 3 4 21 6 15 passing parameters to a script 13 5 script 6 14 13 5 similar to START 6 14 13 6 13 133 double at sign command 3 4 13 7 script 13 7 similar to START 13 8 13 133 Cancel key 5 12 EDITOR in EDIT command 6 2 13 61 infinity sign 13 34 negative infinity sign 13 34 Numerics 0 number format 7 5 9 number format 7 5 A ABORT mode 13 129 abort query 5 12 ACCEPT command 6 27 13 10 and DEFINE command 13 49 CHAR clause 13 10 customizing prompts for value 6 29 DATEclause 13 10 DEFAULT clause 13 11 FORMAT clause 13 10 HIDE clause 13 11 NOPROMPT clause 13 11 NUMBER clause 6 30 PROMPT clause 6 28 13 11 Index 1 access denying and granting 10 2 adding authentication entries 10 12 administrator Oracle HTTP Server 10 12 ALIAS clause 13 30 in ATTRIBUTE command 13 16 ALL clause 13 124 ALTER command disabling 10 5 ampersands amp in parameters 6 26
235. aged recovery CANCEL terminates the managed standby recov ery operation after applying the current archived redo file Session con trol returns when the recovery process terminates CANCEL IMMEDIATE Terminates the managed recovery operation after applying the current archived redo file or after the next redo log file read whichever comes first Session control returns when the recovery process terminates CANCEL IMMEDIATE cannot be issued from the same session that issued the RECOVER MANAGED STANDBY DATABASE statement CANCEL NOWAIT Terminates the managed recovery operation after the next redo log file read and returns session control immediately DISCONNECT FROM SESSION FINISH NOWAIT Indicates that the managed redo process MRP should apply archived redo files as a detached background process Doing so leaves the cur rent session available Recovers the current log standby logfiles of the standby database It is useful in the event of the primary database failure This clause over rides any delays specified for archivelogs so that Oracle logs are applied immediately Returns control immediately rather than after completion of the recov ery process SQL Plus Command Reference 13 83 RECOVER Usage Examples You must have the OSDBA role enabled You cannot use the RECOVER command when connected via the multi threaded server To perform media recovery on an entire database all tablespaces the database
236. ages generally ask the user to respond by typing some information in the adjacent field See also command line query A SQL SELECT statement that retrieves data in any combination expression or order Queries are read only operations they do not change any data they only retrieve data Queries are often considered to be DML statements query results The data retrieved by a query RAW datatype A standard Oracle datatype a RAW data column may contain data in any form including binary You can use RAW columns for storing binary non character data RDBMS Relational Database Management System An Oracle7 and earlier term Refers to the software used to create and maintain the system as well as the actual data stored in the database See also Relational Database Management System RDBMS Server and Oracle Server record A synonym for row one row of data in a database table having values for one or more columns recover The Oracle process of restoring all or part of a database from specified redo log files redo log A sequential log of all changes made to the data The redo log is written and used in the event of a failure that prevents changes from being written to disk The redo log consists of two or more redo log files redo log file A file containing records of all changes made to the database These files are used for recovery purposes See also redo log Relational Database Management System RDBMS An Oracle
237. al parameter used by the SOL Plus client application to enable you to create CHAR and VARCHAR2 columns and variables using either byte or character length semantics NCHAR NVARCHAR2 CLOB and NCLOB columns are always character based and hence are not affected by this variable If this variable has not been explicitly set at session startup a default value of BYTE is used Byte length semantics The value of NL5 LENGTH SEMANTICS is then applied as the length semantics of any CHAR or VARCHAR2 declarations which DO NOT explicitly state the length qualifier NL5 LENGTH SEMANTICS is also used when displaying variables or describing tables views synonyms or other objects On the server side NL5 LENGTH SEMANTICS can be set as an initialization parameter and can be dynamically altered via the ALTER SESSION and ALTER SYSTEM SOL commands For more information about setting NL5 LENGTH SEMANTICS on the server side refer to the Oracle9i Database Globalization Support Guide Note that NL5 LENGTH SEMANTICS may differ between the client and server but the issuing of an ALTER SESSION SET NLS LENGTH SEMANTICS value command to alter the session scope will be reflected in the SQL Plus session null A value that means a value is not applicable or the value is unknown Nulls are not equal to any specific value even to each other Comparisons with nulls are always false NULL value The absence of a value NUMBER datatype A standard Or
238. ame See also SYSTEM username SYSDBA Privilege that contains all system privileges with the ADMIN OPTION and the SYSOPER system privilege See also SYSOPER SYSOPER Privilege that allows a DBA to perform operations such as STARTUP SHUTDOWN ARCHIVE LOG and RECOVER See also SYSDBA Glossary 23 Glossary 24 system administrator A person responsible for operation and maintenance of the operating system of a computer system editor The text editor provided by the operating system System Global Area SGA A shared storage area that contains information required by user processes and background processes such as data and control information for one Oracle instance The SGA is allocated when an Oracle instance is started and is deallocated when the instance shuts down SYSTEM username One of two standard DBA usernames automatically created with each database the other is SYS The Oracle user SYSTEM is created with the password MANAGER The SYSTEM username is the preferred username for DBAs to use when performing database maintenance system variable A variable that indicates status or environment which is given a default value by Oracle or SQL Plus Examples are LINESIZE and PAGESIZE Use the SQL Plus commands SHOW and SET to see and alter the value of system variables table The basic unit of storage in a relational database management system A table represents entities and relationships and consists of one
239. ame and password entered in the iSQL Plus DBA Login screen and an Oracle HTTP Server authentication username and password entered in a separate dialog Generate the iSQL Plus Server statistics report Requires an Oracle HTTP Server authentication username and password SQL Plus Security 10 9 iSQL Plus Security Enabling Server Authentication for Users By default Oracle HTTP Server authentication is enabled for SYSDBA and SYSOPER privileged users You may also want to limit who can access iSQL Plus by enabling Oracle HTTP Server authentication for normal user logins You can enable Oracle HTTP Server authentication for normal user connections by editing the isglplus conf file and changing the following lines Location isqlplus SetHandler fastcgi script Order deny allow Allow from all Location to Location isqlplus SetHandler fastcgi script Order deny allow AuthType Basic AuthName iSQL Plus The following line for UNIX comment out the Windows line AuthUserFile SORACLE_HOME sqlplus admin iplus pw The following line for Windows comment out the UNIX line AuthUserFile ORACLE_HOME sqlplus admin iplus pw Require valid user lt Location gt For information about editing the isqlplus conf file see Session Integrity on page 3 7 iplus pw is suggested as the file to contain the Oracle HTTP Server authentication usernames and passwords for user connections Now whenever a user connection
240. ame or an invalid file name specified Action Make sure that a file name was specified SP2 0559 EXEC UTE statement Cause Incorrect syntax for the EXECUTE command was entered Action Check the syntax of the EXECUTE command for the correct usage 14 22 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0560 Usage DESCRIBE schema object subobject db_link column Cause Incorrect syntax for the DESCRIBE command was entered Action Check the syntax of the DESCRIBE command for the correct usage SP2 0561 Object does not exist Cause The specified object you tried to DESCRIBE does not exist in the database Action Retry the command with a valid object name SP2 0562 Object does not exist in package Cause The specified object you tried to DESCRIBE does not exist in the package Action Check and make sure that the object name is correct SP2 0564 Object object_name is INVALID it may not be described Cause The specified object you tried to DESCRIBE is invalid Action Re validate the object SP2 0565 Illegal identifier Cause An invalid character was used in the DESCRIBE command Action Correct the character and try again SP2 0566 Illegal sub object specification Cause Invalid sub object specification in the DESCRIBE command Action Correct the subject specification and try again SP2 0567 Illegal column specification for PL SOL object Cause A column was described within an objec
241. amp SORTCOL SALARY FROM amp MYTABLE WHERE SALARY gt 12000 ORDER BY amp SORTCOL iSQL Plus displays L3 im dt View Favorites Tools Help E al Jaa i History ory Preferences Help Work Screen Substitution Variables Substitution Variables Enter values for substitution variables in the script to execute Variable Value sortcol last name mytable emp details view OK Cancel E E l Connected as SYSTEM inst1 fig Local intranet Variable Displays the substitution variable names Value Enter a value for each substitution variable For example enter LAST NAME in the sortcol field and EMP DETAILS VIEW in the mytable field of the example script OK Click the OK button to execute the script in the Input area with the substitution variable values you entered Cancel Click the Cancel button to return to the Work screen without executing the script in the Input area Using Scripts in SQL Plus 6 25 Writing Interactive Commands Passing Parameters through the START Command n You can bypass the prompts for values associated with substitution variables by passing values to parameters in a script through the START command You do this by placing an ampersand amp followed by a numeral in the script in place of a substitution variable Each time you run this script START replaces each amp 1 in the file with the first value called an argument after START fi
242. an error results FORCE is useful while debugging and under abnormal circumstances It should not nor mally be used Only allows Oracle users with the RESTRICTED SESSION system priv ilege to connect to the database Later you can use the ALTER SYSTEM command to disable the restricted session feature PFILE 2filename Causes the specified parameter file to be used while starting up the instance If PFILE is not specified then the default STARTUP parame ter file is used The default file used is platform specific For example the default file is ORACLE HOME dbs init ORACLE SID ora on UNIX and ORACLE_ HOME database initORCL ora on Windows 13 134 SQL Plus User s Guide and Reference STARTUP QUIET Suppresses the display of System Global Area information for the start ing instance MOUNT dbname OPEN NOMOUNT RECOVER MIGRATE Mounts a database but does not open it dbname is the name of the database to mount or open If no database name is specified the database name is taken from the initialization parameter DB NAME Mounts and opens the specified database Causes the database not to be mounted upon instance startup Cannot be used with MOUNT or OPEN Specifies that media recovery should be performed if necessary before starting the instance STARTUP RECOVER has the same effect as issu ing the RECOVER DATABASE command and starting an instance Only complete recovery is possible with the RECOVER o
243. ands Entering and Executing Commands Unless stated otherwise descriptions of command use are generally applicable to both command line and iSQL Plus user interfaces In command line SQL Plus you type commands at the SOL Plus prompt Usually you separate the words in a command from each other by a space or tab You can use additional spaces or tabs between words to make your commands more readable Case sensitivity is operating system specific For the sake of clarity all table names column names and commands in this guide appear in capital letters You can enter three kinds of commands in either the command line or the iSQL Plus user interfaces SQL commands for working with information in the database PL SQL blocks also for working with information in the database a SQL Plus commands for formatting query results setting options and editing and storing SOL commands and PL SQL blocks The manner in which you continue a command on additional lines end a command or execute a command differs depending on the type of command you wish to enter and run Examples of how to run and execute these types of commands are found on the following pages You can use the Backspace and the Delete keys in both command line SQL Plus and iSQL Plus In iSQL Plus you can cut and paste using your web browser s edit keys to edit the statements in the Input area You can also cut or copy scripts or statements from other applications such as
244. apter To print Adjust paper and press RETURN to continue and to have SQL Plus wait for the user to press Return you might include the following PAUSE command in a script SET PAUSE OFF PAUSE Adjust paper and press RETURN to continue SELECT 13 76 SQL Plus User s Guide and Reference PRINT PRINT Syntax Terms Usage Examples E nn PRI NT variable Displays the current values of bind variables For more information on bind variables see your PL SQL User s Guide and Reference Refer to the following for a description of the clause or term variable Represents names of bind variables whose values you wish to display Enter PRINT with no variables to print all bind variables Bind variables are created using the VARIABLE command For more information and examples see the VARIABLE command in this chapter You can control the formatting of the PRINT output just as you would query output For more information see the formatting techniques described in Chapter 7 Formatting SQL Plus Reports To automatically display bind variables referenced in a successful PL SQL block or used in an EXECUTE command use the AUTOPRINT clause of the SET command For more information see the SET command in this chapter The following example illustrates a PRINT command VARIABLE n NUMBER BEGIN in s 1 END PL SQL procedure successfully completed PRINT n SQL Plus Co
245. aracters line ignored Cause The input value specified was too long Action Re enter with fewer characters SP2 0028 Internal SQL Plus Error Invalid mode mode number Cause An internal error occurred Action Note the message and number and contact Oracle Support Services SQL Plus Error Messages 14 3 SQL Plus Error Messages SP2 0029 Command buffer space exhausted Cause A large SOL or PL SQL script is being executed from SQL Plus Action Reduce the size of the SQL statement or PL SQL block by one of the following Remove extra white space and comments Re code to use fewer commands and or shorter variable names Place sections of the block into stored or packaged procedures and then call these procedures from the block SP2 0030 No room for another line Cause The maximum number of lines in a SQL statement or PL SQL block has been exceeded Action Reduce the number of lines and try again SP2 0038 Command too long max_characters characters Cause The specified command entered was too long Action Check the command syntax for the limitation SP2 0039 Command line overflow while substituting into command_name Cause The maximum length of the command line has been exceeded Action Reduce the length of the data in the substitution variables used in the command SP2 0042 Unknown command command_name rest of line ignored Cause The command entered was not valid Action Check the synta
246. arameters This section shows settings for iSQL Plus Server parameters a iSQLPlusNumberOfThreads a iSQLPlusTimeOutInterval minutes a iSOLPlusLogLevel iSOLPlusConnectIdList a iSQLPlusHashTableSize Client Details This section shows the type of web browser used by the iSQL Plus Client HTTP client Active Statistics For information about active statistics see iSOL Plus Server Statistics on page 9 12 Setting System Variables in iSQL Plus You can set system variables for your iSQL Plus session in the System Variables screen You access the System Variables screen from the Preferences screen System variable settings return to their default values every time a new session is started I Fle Edt View Favorites Tools Help EJ ORACLC 3 Pp zm Logout New History Preferences Help iSQL Plus Session Work Screen Preferences System Variables System Variables Quick link Applnfo M Go OK Cancel Appinfo C On iSQL Plus of ArraySize 15 AutoCommit cop C Immediate of a Connected as SYSTEMGOSIR7 fit Local intranet 2 14 SQL Plus User s Guide and Reference iSQL P lus User Interface Quick link Use the dropdown list to select the system variable you want to set Go Click the Go button to navigate to the Quick link choice System variables and options There are checkboxes radio buttons and text entry fields as required for each system variable Syst
247. asing Hash Table Size If users typically have more idle time compared to active time then a higher value of iSQLPlusHashTableSize is needed for a given value of iSOLPlusNumberOfThreads Each user session consumes one entry in the hash table even if the session is idle Tuning SQL Plus 9 13 iSQL P lus Server Statistics Reducing Timeout Interval If large numbers of sessions are being timed out it is an indication that users may not be logging out cleanly and sessions may be remaining idle In this case and if the iSQL Plus Server load is high you may want to consider reducing the iSQLPlusTimeOut Interval to more aggressively time out sessions Idle Timeout The idle timeout is the time the Oracle HTTP Server waits for results from iSQL Plus The parameter value for the FastCGI timeout parameter idle timeout is set to 3600 seconds This value is likely to prevent iSQL Plus timing out before the web browser It is sufficient for many long queries to return results before iSQL Plus times out The idle timeout should not be confused with the iSQLPlusTimeOut Interval which manages the lifetime of the resources used by an idle user s session isQL Plus Tuning Notes If the following iSQL Plus errors appear frequently in your log at ORACLE HOME Apache Apache logs error log Mon Feb 14 17 08 09 2005 error client 148 87 9 44 146 Connection refused FastCGI failed to connect to server oracle sqlplus bin isqlplus co
248. at a REFCURSOR variable 13 147 VERIFY clause 6 19 VERIFY variable 6 23 13 99 13 123 WRAP variable 7 7 13 99 13 123 SET MARKUP BODY clause 4 6 embedded CGI example 8 7 ENTMAP clause 4 6 8 12 HEAD clause 4 6 HTML 4 5 interactive HTML example 8 3 8 6 PREFORMAT clause 4 8 See also SPOOL command SPOOL clause 4 6 TABLE clause 4 6 SET ROLE command disabling 10 5 SET TRANSACTION command disabling 10 5 SET variables 5 10 See system variables SGA clause 13 126 SHIFTINOUT variable 13 98 13 117 SHOW clause 13 139 SHOW command 5 11 13 124 ALL clause 13 124 BTITLE clause 13 124 ERRORS clause 13 125 LABEL variable C 2 C 7 listing current page dimensions 7 33 LNO clause 13 125 PNO clause 13 126 RELEASE clause 13 126 REPFOOTER clause 13 126 REPHEADER clause 13 126 SPOOL clause 13 126 SQLCODE clause 13 126 TTITLE clause 13 126 USER clause 13 126 SHOWMODE variable 13 98 13 118 SHUTDOWN command 13 129 ABORT 13 129 IMMEDIATE 13 129 NORMAL 13 129 TRANSACTIONAL LOCAL 13 130 SILENT option 4 10 8 12 site profile GLOGIN SQL 3 2 LOGIN SQL 3 2 See also user profile SKIP clause in BREAK command 7 13 7 14 13 20 in REPHEADER and REPFOOTER commands 13 90 in TTITLE and BTITLE commands 7 26 13 142 to place blank lines before bottom title 7 26 SKIP PAGE clause 7 13 7 14 13 21 slash command 13 9 files loaded with GET command 13 66 SPACE variable C 2 C 6 SPOOL clause 4 6 4
249. ata base architecture A primary database actively archives its redo log files to the standby site As these archived redo logs arrive at the standby site they become available for use by a managed standby recovery operation Sustained standby recovery is restricted to media recovery For more information on the parameters of this clause see the Oracle9i User Managed Backup and Recovery Guide NODELAY Applies a delayed archivelog immediately to the standby database overriding any DELAY setting in the LOG_ARCHIVE_DEST_n parame ter on the primary database If you omit this clause application of the archivelog is delayed according to the parameter setting If DELAY was not specified in the parameter the archivelog is applied immediately TIMEOUT Specifies in minutes the wait period of the sustained recovery opera tion The recovery process waits for integer minutes for a requested archived log redo to be available for writing to the standby database If the redo log file does not become available within that time the recov 13 82 SQL Plus User s Guide and Reference RECOVER ery process terminates with an error message You can then issue the statement again to return to sustained standby recovery mode If you do not specify this clause the database remains in sustained standby recovery mode until you reissue the statement with the RECOVER CANCEL clause or until instance shutdown or failure CANCEL managed clause In man
250. ble_name for column column_name Cause The specified variable could not be created for column internal error or out of memory Action Check memory usage SP2 0259 Could not create variable variable name for COMPUTE INTO Cause The specified variable could not be created Action Check the syntax of the command you used for the correct options SP2 0260 Computation for column column name not uniquely qualified Could be for table table name or table name Computation ignored Cause The specified column was not uniquely qualified in the statement Action Check the syntax of the command you used for the correct options SP2 0262 No room to allocate CCBDEF pointer array Cause An internal memory error occurred Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0263 No room to allocate COMPUTE block for column name ON pagelreportlcolumn name Cause Insufficient memory allocated to the COMPUTE block Action Allocate more memory by closing other applications SP2 0265 option name must be set ON or OFF Cause An invalid SET option name was specified Action Re enter with either ON or OFF as one of the SET options SP2 0266 Internal error buffer buffer size smaller than 1 buffer limit Cause An internal error occurred Action Free up additional memory by closing applications not required reduc
251. blocks Format Calculate store and print query results Listcolumn definitions for any table a Send messages to and accept responses from an end user Perform database administration The Command line Screen The SQL Plus command line interface is standard on all operating systems The following shows SQL Plus running in an X terminal When SQL Plus starts it displays the date and time the SQL Plus version and copyright information before the SOL Plus prompt appears The default prompt for command line SQL Plus is SQL gt 2 2 SQL Plus User s Guide and Reference iSQL P lus User Interface isQL Plus User Interface iSQL Plus is a browser based interface to Oracle9 It is a component of the SQL Plus product iSQL Plus enables you to use a web browser to connect to Oracle9i and perform the same tasks as you would through the command line version of SQL Plus Different web browsers and the size of the web browser window may affect the appearance and layout of iSQL Plus screens isQL Plus Navigation There are a number of ways to navigate in iSQL Plus Using the global navigation icons Using the breadcrumb links Icons Global navigation icons are displayed on each screen Icons have three states a A white background when that functionality is available a A light brown background when that functionality is unavailable a A blue background when active when you have navigated to that screen T
252. blocks n cannot be less than zero or greater than 2 000 000 000 The statement counter is reset to zero after successful completion of n INSERT UPDATE or DELETE commands or PL SQL blocks a commit a rollback or a SET AUTOCOMMIT command Note For this feature a PL SQL block is considered one transaction regardless of the actual number of SOL commands contained within it SET AUTOP RINT ON OFF Sets the automatic printing of bind variables ON or OFF controls whether SQL Plus automatically displays bind variables referenced in a successful PL SQL block or used in an EXECUTE command For more information about displaying bind variables see the PRINT command in this chapter SET AUTORECOVERY ON OFF ON sets the RECOVER command to automatically apply the default filenames of archived redo log files needed during recovery No interaction is needed when AUTORECOVERY is set to ON provided the necessary files are in the expected locations with the expected names The filenames used when AUTORECOVERY is ON are derived from the values of the initialization parameters LOG ARCHIVE DEST and LOG ARCHIVE FORMAT You must set AUTORECOVERY ON to use the RECOVER command in iSQL Plus Attempting to RECOVER a database with AUTORECOVERY OFF raises the error SP2 0872 SET AUTORECOVERY ON must be used in iSQL Plus OFF the default option requires that you enter the filenames manually or accept the suggested default filename given
253. bol but it was not specified Action Check the syntax of the command you used for the correct options SP2 0318 Symbol name beginning variable_name Is too long max max_name_ length Cause Specified variable name exceeded the maximum name length Action Reduce the size of the symbol name and re enter SQL Plus Error Messages 14 15 SQL Plus Error Messages SP2 0323 No room to add timing element request denied Cause Unable to allocate memory while trying to run the TIMING command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0324 Operating system timing error error_option_number request denied Cause The TIMING command failed to initialize due to a possible operating system error Action Resolve the operating system error and try again SP2 0325 No timing elements to option_name Cause There are no timers recorded to SHOW or STOP Action Check that timers were created with the TIMING command SP2 0328 No room to allocate title buffer Cause Unable to allocate memory while trying to run the TTITLE or BTITLE command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0331 Spool out disabled Cause An attempt was made to use SPOOL OUT where it is not supported
254. browser Now you can start entering and executing SOL PL SQL and SQL Plus statements and commands in the Work screen Input area SQL Plus Command line Quick Start for Windows Do the following steps to start SQL Plus and connect to the default database 1 Open a Windows command prompt 2 At the command line prompt enter the SOL Plus command in the form c V sqlplus 3 When prompted enter your Oracle9i username and password If you do not know your Oracle9i username and password ask your Database Administrator 4 SQL Plus starts and connects to the default database Now you can start entering and executing SOL PL SQL and SQL Plus statements and commands at the SOL prompt Do the following to start SOL Plus and connect to a specified database other than the default 1 Start SOL Plus and connect to the default database 2 Usethe CONNECT command to specify the Oracle Net database alias connect identifier of the database you want to connect to To do this enter the CONNECT command in the form SQL gt connect username password8connect identifier To hide your password enter the CONNECT command in the form SQL gt connect username8connect identifier You will be prompted to enter your password 3 Alternatively to start SOL Plus connected to a database other than the default enter the SOL Plus command in the form c gt sqlplus username password8 connect identifier To hide your password enter the SOL Plus c
255. can also use format models for DATE columns in SOL date conversion functions such as TO_DATE form feed A control character that when executed causes the printer to skip to the top of a new sheet of paper top of form When SQL Plus displays a form feed on most terminals the form feed clears the screen formula column Manually created column that gets its data from a PL SQL procedure function or expression user exit SOL statement or any combination of these function A PL SQL subprogram that executes an operation and returns a value at the completion of the operation A function can be either built in or user named Contrast with procedure heading In SQL Plus text that names an output column appearing above the column See also column heading host computer The computer from which you run SQL Plus HTML HTML HyperText Markup Language is the language used to write most of the documents available on the World Wide Web It provides display and linking Glossary 11 Glossary 12 specifications that are recognized by most web browsers The HTML recommendation is sponsored by the World Wide Web Consortium w3 and further details about the w3 and the HTML recommendation can be found at the w3 web site http www w3 org instance The background processes and memory area required to access an Oracle database A database system requires one instance and one database An Oracle database server consists of an SGA and a s
256. ccess to administrative personnel enter STARTUP OPEN sales PFILE INITSALE ORA EXCLUSIVE RESTRICT where SALES is the database name specified in the DB NAME parameter in the INITSALE ORA parameter file Database Shutdown Shutting down a database involves three steps 1 Closing the database When a database is closed all database and recovery data in the SGA are written to the datafiles and redo log files and closes all online datafiles 2 Dismounting the database Dismounting the database disassociates the database from an instance and closes the control files of the database 3 Shutting down the instance Shutting down an instance reclaims the SGA from memory and terminates the background Oracle processes that constitute an Oracle instance For more information about database shutdown see the Oracle9i Database Concepts guide For information about the SHUTDOWN command see Chapter 13 SOL Plus Command Reference Database Administration with SQL Plus 11 3 Redo Log Files Example 11 4 Shutting Down the Database To shut down the database normally after it has been opened and mounted enter SHUTDOWN Database closed Database dismounted ORACLE instance shut down Redo Log Files Every Oracle database has a set of two or more redo log files The set of redo log files for a database is collectively referred to as the database s redo log The redo log is used to record changes made to data If for
257. char that does not appear in old or new Represents the text you wish to change CHANGE ignores case in searching for old For example CHANGE ag aw will find the first occurrence of aq AQ aQ or Aq and change it to aw SQL Plus inserts the new text exactly as you specify it u n If old is prefixed with it matches everything up to and including the first occurrence of old If it is suffixed with it matches the first occurrence of old and everything that follows on that line If it contains an embedded it matches everything from the preceding part of old through the following part of old Represents the text with which you wish to replace old If you omit new and optionally the second and third sepchars CHANGE deletes old from the current line of the buffer CHANGE changes the first occurrence of the existing specified text on the current line of the buffer to the new specified text The current line is marked with an asterisk in the LIST output 13 24 SQL Plus User s Guide and Reference CHANGE Examples ca ca m ca ca ee You can also use CHANGE to modify a line in the buffer that has generated an Oracle error SQL Plus sets the buffer s current line to the line containing the error so that you can make modifications To reenter an entire line you can type the line number followed by the new contents
258. cifies display characteristics for a given column or lists the current display characteristics for a single column or for all columns COMPUTE 13 40 Calculates and prints summary lines using various standard computations on subsets of selected rows or lists all COMPUTE definitions CONNECT 13 46 Connects a given user to Oracle COPY 13 48 Copies results from a query to a table in a local or remote database DEFINE 13 49 Specifies a user variable and assigns it a CHAR value or lists the value and variable type of a single variable or all variables 13 2 SQL Plus User s Guide and Reference SQL Plus Command Summary Command Page Description DEL 13 51 Deletes one or more lines of the buffer DESCRIBE 13 53 Lists the column definitions for the specified table view or synonym or the specifications for the specified function or procedure DISCONNECT 13 60 Commits pending changes to the database and logs the current user off Oracle but does not exit SOL Plus EDIT 13 61 Invokes a host operating system text editor on the contents of the specified file or on the contents of the buffer EXECUTE 13 63 Executes a single PL SQL statement EXIT 13 64 Terminates SQL Plus and returns control to the operating system GET 13 66 Loads a host operating system file into the buffer HELP 13 68 Accesses the SQL Plus help system HOST 13 69 Executes a host operating system command without leaving SOL Plus INPUT 13 71 Adds one or more ne
259. clause s char value REPHEADER position clause s char value position clause s char value REPFOOTER position clause s char value position clause s char value For descriptions of all TTITLE BTITLE REPHEADER and REPFOOTER clauses see the TTITLE and REPHEADER commands in Chapter 13 SOL Plus Command Reference Example 7 18 Placing a Top and Bottom Title on a Page To put titles at the top and bottom of each page of a report enter TTITLE CENTER ACME SALES DEPARTMENT PERSONNEL REPORT BTITLE CENTER COMPANY CONFIDENTIAL Now run the current query ACME SALES DEPARTMENT PERSONNEL REPORT Formatting SQL Plus Reports 7 23 Defining Page and Report Titles and Dimensions DEPARTMENT_ID LAST_NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTIAL 6 rows selected Example 7 19 Placing a Header on a Report To put a report header on a separate page and to center it enter REPHEADER PAGE CENTER PERFECT WIDGETS Now run the current query which displays the following two pages of output with the new REPHEADER displayed on the first page ACME SALES DEPARTMENT PERSONNEL REPORT PERFECT WIDGETS COMPANY CONFIDENTIAL ACME SALES DEPARTMENT PERSONNEL REPORT DEPARTMENT ID LAST NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTI
260. clauses to list the number of active timers For other information about TIMING see SET AUTOTRACE You can use this data to do a performance analysis on any commands or blocks run during the period For information about the data TIMING displays see the Oracle installation and user s manual s provided for your operating system Refer to the SET TIMING command for information on automatically displaying timing data after each SQL command or PL SQL block you run To delete all timers use the CLEAR TIMING command SQL Plus Command Reference 13 139 TIMING Examples To create a timer named SQL_TIMER enter TIMING START SQL_TIMER To list the current timer s title and accumulated time enter TIMING SHOW To list the current timer s title and accumulated time and to remove the timer enter TIMING STOP 13 140 SQL Plus User s Guide and Reference TTITLE TTITLE Syntax Terms TTI TLE printspec text variable ON OFF where printspec represents one or more of the following clauses used to place and format the text COL n CE NTER SIKIP n R IGHT TAB n BOLD LE FT FORMAT text Places and formats a specified title at the top of each report page or lists the current TTITLE definition The old form of TTITLE is used if only a single word or string in quotes follows the TTITLE command For a description of the old form of TTITLE see TTITLE on page C7 Refer to the following list for a description
261. containing several START commands each followed by the name of a script in the sequence Then run the script containing the START commands For example you could include the following START commands in a script named SALESRPT START Q1SALES START Q2SALES START Q3SALES START Q4SALES START YRENDSLS Note The 9 command may be useful in this example See the double at sign command in Chapter 13 SOL Plus Command Reference for more information Using Scripts in SQL Plus 6 15 Receiving a Return Code Receiving a Return Code C n If you fail to log in successfully to SOL Plus because your username or password is invalid or some other error SQL Plus will return an error status equivalent to an EXIT FAILURE command See the EXIT command in this chapter for further information Example 6 8 Starting SQL Plus To start SQL Plus with username HR and password your password enter SQLPLUS HR your password To start SOL Plus as above and to make POLICY the default database where POLICY is a valid Oracle Net database connect identifier enter SQLPLUS HR your_password POLICY To start SQL Plus with username HR and password your_password and run a script named STARTUP with the extension SQL enter SQLPLUS HR your_password STARTUP Note the space between HR and STARTUP To start SQL Plus with HTML ON so that output can be captured in a file and then viewed on a web browser ente
262. cters The label for the computed value appears in the break column speci fied To suppress the label use the NOPRINT option of the COLUMN command on the break column If you repeat a function in a COMPUTE command SQL Plus issues a warning and uses the first occurrence of the function With ON REPORT and ON ROW computations the label appears in the first column listed in the SELECT statement The label can be sup pressed by using a NOPRINT column first in the SELECT statement When you compute a function of the first column in the SELECT state ment ON REPORT or ON ROW then the computed value appears in the first column and the label is not displayed To see the label select a dummy column first in the SELECT list OF fexpr column alias In the OF clause you can refer to an expression or function reference in the SELECT statement by placing the expression or function reference in double quotes Column names and aliases do not need quotes ON fexpricolumn alias R E P ORT RO W Specifies the event SOL Plus will use as a break column cannot have a table or view appended to it To achieve this you can alias the column in the SOL statement COMPUTE prints the computed value and restarts the computation when the event occurs that is when the value SQL Plus Command Reference 13 41 COMPUTE Usage Examples C n of the expression changes a new ROW is fetched or the end of the report is reached
263. d Reference 13 65 GET GET Syntax Terms Usage GET is not available in iSQL Plus In iSQL Plus use Load Script GET FILE file namel ext LIS T NOL IST Loads a host operating system file into the SOL buffer Refer to the following list for a description of each term or clause FILE Keyword to specify that the following argument is the name of the script you want to load This optional keyword is usually omitted If you want to load a script with the name file because it is a command keyword you need to put the name file in single quotes file name ext Represents the file you wish to load typically a script LIS T Lists the contents of the file after it is loaded This is the default NOL IST Suppresses the listing If you do not specify a file extension SQL Plus assumes the default command file extension normally SQL For information on changing the default extension see the SUFFIX variable of the SET command in this chapter If the filename you specify contains the word list or the word file the name must be in double quotes SQL Plus searches for the file in the current working directory The operating system file should contain a single SOL statement or PL SQL block The statement should not be terminated with a semicolon If a SOL Plus command or more than one SQL statement or PL SQL block is loaded into the SOL buffer from an operating system file an error occurs when the RUN or slash co
264. d is issued A workaround for this is to add another SQL Plus Command Reference 13 69 HOST SOLTERMINATOR See the SOLTERMINATOR variable of the SET command in this chapter for more information on the SOLTERMINATOR Examples To execute a UNIX operating system command ls sql enter HOST ls sql To execute a Windows operating system command dir sql enter HOST dir sql 13 70 SQL Plus User s Guide and Reference INPUT INPUT Syntax Terms Usage Examples x5 INPUT is not available in iSQL Plus I NP UT text Adds one or more new lines of text after the current line in the buffer Refer to the following for a description of the term or clause text Represents the text you wish to add To add a single line enter the text of the line after the command INPUT separating the text from the com mand with a space To begin the line with one or more spaces enter two or more spaces between INPUT and the first non blank character of text To add several lines enter INPUT with no text INPUT prompts you for each line To leave INPUT enter a null empty line or a period If you enter a line number at the command prompt larger than the number of lines in the buffer and follow the number with text SOL Plus adds the text in a new line at the end of the buffer If you specify zero 0 for the line number and follow the zero with text then SQL Plus inserts the line at the beginning of the buf
265. directly in the text fields and press Enter when you have finished editing each field To edit or copy a field when the column is narrower than the field it contains you need to widen the column by selecting and dragging the heading column separator Click OK to save your changes The modified iSQL Plus Server name appears in the context menu Removing a Server Select the server you wish to remove from the list of available servers The server s details will appear in the following text boxes Click the Remove button to remove it from the list of available servers To remove an iSQL Plus Server perform the following steps 1 oa F oN Right click a SQL file in Windows Explorer Select iSQL Plus Servers to display the context menu options Click Configure The Configure iSQL Plus Servers dialog is displayed Select the server you wish to remove from the list of available servers Click Remove Click OK to save your changes The iSQL Plus Server is removed from the context menu Configuring SQL Plus 3 19 iSQL Plus Extension for Windows Configuration 3 20 SQL Plus User s Guide and Reference 4 Starting SQL Plus This chapter describes how to start login and connect to a database how to get help and how to exit SOL Plus Specific topics discussed are a Starting Command line SOL Plus a TheSQLPLUS Command Getting Command line Help a Exiting Command line SOL Plus Starting iSQL Plus Gettin
266. documentation search engine directly please visit xxii http tahiti oracle com Whitepapers sample code frequently asked questions and other useful information are regularly posted to the SQL Plus section on OTN at http otn oracle com tech sql_plus Conventions This section describes the conventions used in the text and code examples of this documentation set It describes a Conventions in Text Conventions in Code Examples Conventions for Windows Operating Systems Conventions in Text We use various conventions in text to help you more quickly identify special terms The following table describes those conventions and provides examples of their use Convention Meaning Example Bold Bold typeface indicates terms that are When you specify this clause you create an defined in the text or terms that appear in index organized table a glossary or both Italics Italic typeface indicates book titles or Oracle9i Database Concepts emphasis Ensure that the recovery catalog and target database do not reside on the same disk UPPERCASE Uppercase monospace typeface indicates You can specify this clause only for a NUMBER monospace elements supplied by the system Such column fixed width fon t elements include parameters privileges datatypes RMAN keywords SQL keywords SQL Plus or utility commands packages and methods as well as Query the TABLE_NAME column in the USER_ system supplied col
267. e is used for commands when no instance is specified Any commands preceding the first use of SET INSTANCE communicate with the default instance To reset the instance to the default value for your operating system you can either enter SET INSTANCE with no instance path or SET INSTANCE LOCAL See your operating system specific Oracle documentation for a description of how to set the initial default instance Note you can only change the instance when you are not currently connected to any instance That is you must first make sure that you have disconnected from the current instance then set or change the instance and reconnect to an instance in order for the new setting to be enabled This command may only be issued when Oracle Net is running You can use any valid Oracle Net connect identifier as the specified instance path See your operating system specific Oracle documentation for a complete description of how your operating system specifies Oracle Net connect identifiers The maximum length of the instance path is 64 characters To set the default instance to PRODI enter DISCONNECT SET INSTANCE PROD1 To set the instance back to the default of local enter SET INSTANCE local You must disconnect from any connected instances to change the instance 13 110 SQL Plus User s Guide and Reference SET SET LIN ESIZE 80 n Sets the total number of characters that SQL Plus displays on one line before beginning a new line
268. e vertical bar Horizontal ellipsis points indicate either a That we have omitted parts of the code that are not directly related to the example a That you can repeat a portion of the code Vertical ellipsis points indicate that we have omitted several lines of code not directly related to the example You must enter symbols other than brackets braces vertical bars and ellipsis points as shown Italicized text indicates placeholders or variables for which you must supply particular values Uppercase typeface indicates elements supplied by the system We show these terms in uppercase in order to distinguish them from terms you define Unless terms appear in brackets enter them in the order and with the spelling shown However because these terms are not case sensitive you can enter them in lowercase DECIMAL ENABL ENABL COMPRE digits precision DISABILI x DISABLI SS 73 NOCOMPRESS TABLE SE ECT coll AS subquery COlZ x p Coln FROM employees CO c UJ acc acc tbal NUMBER 11 2 CONSTANT NUMBER 4 EC NAMI EC LU SYSTEM system password database name last name employee id FROM mployees EC OU o oo RO FROM USER TABLES P TABLE hr employees XXV
269. e Commands Enter value for group_col JOB_ID a old 1 SELECT amp GROUP_COL new 1 SELECT JOB_ID Enter value for number_col SALARY old 2 MAX amp NUMBER_COL MAXIMUM new 2 MAX SALARY MAXIMUM Enter value for table EMP_DETAILS_VIEW old 3 FROM amp TABLE new 3 FROM EMP_DETAILS_VIEW Enter value for group_col JOB_ID old 4 GROUP BY amp GROUP_COL new 4 GROUP BY JOB ID SQL Plus displays the following output m JOB ID MAXIMUM AC ACCOUNT 8300 AC MGR 12000 AD ASST 4400 AD PRES 24000 AD VP 17000 FI ACCOUNT 9000 FI MGR 12000 HR REP 6500 IT PROG 9000 MK MA 13000 MK REP 6000 JOB ID MAXIMUM PR REP 10000 PU CLERK 3100 PU MA 11000 SA MA 14000 SA REP 11500 SH CLERK 4200 ST CLERK 3600 ST MA 8200 19 rows selected If you wish to append characters immediately after a substitution variable use a period to separate the variable from the character For example SELECT SALARY FROM EMP DETAILS VIEW WHERE EMPLOYEE ID amp X 5 6 20 SQL Plus User s Guide and Reference Writing Interactive Commands Enter value for X 20 is interpreted as SELECT SALARY FROM EMP DETAILS VIEW WHERE EMPLOYEE ID 205 Avoiding Unnecessary Prompts for Values Suppose you wanted to expand the file STATS to include the minimum sum and average of the number column You may have noticed that SQL Plus prompted you twice for the value of GROUP COL and once for the value of NUMBE
270. e ECHO variable to OFF suppresses the listing You can also use the at sign command to run a script SALES The command lists and runs the commands in the specified script in the same manner as START SET ECHO affects the command as it affects the START command START and leave the last SOL command or PL SQL block in the script in the buffer 6 14 SQL Plus User s Guide and Reference Nesting Scripts G Running a Script as You Start SQL Plus To run a script as you start SQL Plus use one of the following four options a Follow the SQLPLUS command with your username a slash your password a space and the name of the file SQLPLUS HR your_password SALES SQL Plus starts and runs the script Follow the SOLPLUS command and your username with a space and the name of the file SOLPLUS HR SALES SQL Plus prompts you for your password starts and runs the script Include your username as the first line of the file Follow the SOLPLUS command with and the filename SQL Plus prompts for your password starts and runs the file Include your username a slash and your password as the first line of the file Follow the SOLPLUS command with and the filename SQL Plus starts and runs the file Please consider the security risks of exposing your password in the file before using this technique Nesting Scripts To run a series of scripts in sequence first create a script
271. e and Reference SET SET PAGES IZE 24 n Sets the number of lines in each page You can set PAGESIZE to zero to suppress all headings page breaks titles the initial blank line and other formatting information SET PAU SE ON OFF text SET PAUSE is not supported in iSQL Plus Allows you to control scrolling of your terminal when running reports ON causes SQL Plus to pause at the beginning of each page of report output You must press Return after each pause The text you enter specifies the text to be displayed each time SQL Plus pauses If you enter multiple words you must enclose text in single quotes You can embed terminal dependent escape sequences in the PAUSE command These sequences allow you to create inverse video messages or other effects on terminals that support such characteristics SET RECSEP WR APPED EA CH OFF RECSEP tells SOL Plus where to make the record separation For example if you set RECSEP to WRAPPED SQL Plus prints a record separator only after wrapped lines If you set RECSEP to EACH SQL Plus prints a record separator following every row If you set RECSEP to OFF SQL Plus does not print a record separator SET RECSEPCHAR c Defines the character to display or print to separate records A record separator consists of a single line of the RECSEPCHAR record separating character repeated LINESIZE times The default is a single space SET SERVEROUT PUT ON OFF SIZE n FORMAT WRA
272. e computed value in the COMPUTE command The maximum length of a COMPUTE label is 500 characters LGWR See Log Writer LGWR local database The database that SOL Plus connects to when you start SQL Plus ordinarily a database on your host computer Also called a default database See also remote database log in or log on To perform a sequence of actions at a terminal that establishes a user s communication with the operating system and sets up default characteristics for the user s terminal session log off or log out To terminate interactive communication with the operating system and end a terminal session Log Writer LGWR A background process used by an Oracle instance LGWR writes redo log entries to disk Redo log data is generated in the redo log buffer of the system global area As transactions commit and the log buffer fills LGWR writes redo log entries into an online redo log file logon string A user specified command line used to run an application that is connected to either a local or remote database The logon string either explicitly includes a connect identifier or implicitly uses a default connect identifier Glossary 13 Glossary 14 LONG datatype One of the standard Oracle datatypes A LONG column can contain any printable characters such as A 3 amp or a blank and can have any length from 0 to 2 gigabytes MARKUP Refers to the SET MARKUP clause or the SOLPLUS MARKUP clause that p
273. e een enne 7 29 Displaying the Current Date in Titles sese eee eee eene 7 30 Setting Page Dimensions ios s d re non adeb d a etae td 7 31 Storing and Printing Query Results sese ee eene enne 7 33 Sending Results toa File enge ede dete ane oie tie teretes 7 34 Sending Results to a Printer ect eer he nere e di ee ih res 7 35 8 Generating HTML Reports from SQL Plus Creating Reports using Command line SOL Plus 7 eee 8 2 Creating Reports o cem ee edi apeirian esd eere ei enter ese fe EP ra Cr ERO Berenice 8 2 Creating Reports with CGI Scripts Neissira EE ea a ES 8 7 Suppressing the Display of SQL Plus Commands in Reports sess 8 12 EEDMEErititieS ion oett t hi nete ei bed irt d oci tested 8 12 Creating Reports using iSOL Plus eese eene e eene eene 8 13 9 Tuning SQL Plus Tracing Statements secos re Det ie deett nite Sess ested leds a ee Gaskets 9 2 Controlling the Reporta issa peera fc ente I nete e ese esas tease Scents Gall 9 2 Execution Plan tenete eie ete tnde Mee eene s en de OAT 9 3 eiim M M 9 4 Collecting Timing Statistics eee tienes dneenmedebiie ie ei herren 9 7 Tracing Parallel and Distributed Queries sss eee eee nennen 9 7 System Variables Influencing SOL Plus Performance esee 9 10 iSQL Plus Server Statistics neii a oran eaa ien aa aaa aie ne
274. e employees might contain the following command SELECT FIRST_NAME LAST_NAME JOB_ID SALARY FROM EMP_DETAILS_VIEW WHERE JOB ID amp 1 AND SALARY gt amp 2 To run this script enter START PROMOTE ST MAN 7000 or if it is located on a web server enter a command in the form START HTTP machine name domain port PROMOTE SQL ST MAN 7000 Where machine name domain must be replaced by the host domain name and port by the port number used by the web server where the script is located The following command is executed SELECT LAST NAME LAST NAME FROM EMP DETAILS VIEW WHERE JOB ID ST MAN AND SALARY gt 7000 and the results displayed SQL Plus Command Reference 13 133 STARTUP STARTUP Syntax Terms STARTUP options migrate_options where options has the following syntax FORCE RESTRICT PFILE filename QUIET MOUNT dbname OPEN open options dbname NOMOUNT where open options has the following syntax READ ONLY WRITE RECOVER RECOVER and where migrate options has the following syntax P FILE filename MIGRATE QUIET Starts an Oracle instance with several options including mounting and opening a database Refer to the following list for a description of each term and clause FORCE RESTRICT Shuts down the current Oracle instance if it is running with SHUT DOWN mode ABORT before restarting it If the current instance is run ning and FORCE is not specified
275. e examples in this guide Understanding SQL Command Syntax Just as spoken language has syntax rules that govern the way we assemble words into sentences SQL Plus has syntax rules that govern how you assemble words into commands You must follow these rules if you want SQL Plus to accept and execute your commands 5 4 SQL Plus User s Guide and Reference Running SQL Commands Dividing a SQL Command into Separate Lines You can divide your SOL command into separate lines at any points you wish as long as individual words are not split between lines Thus you can enter the query you entered in Example 5 1 Entering a SOL Command on three lines SELECT EMPLOYEE ID LAST NAME JOB ID FROM EMP DETAILS VIEW WHERE SALARY gt 12000 In this guide you will find most SOL commands divided into clauses one clause on each line In Example 5 1 Entering a SOL Command for instance the SELECT and FROM clauses were placed on separate lines Many people find this clearly visible structure helpful but you may choose whatever line division makes commands most readable to you Ending a SQL Command You can end a SOL command in one of three ways a witha semicolon a witha slash ona line by itself a witha blank line A semicolon tells SOL Plus that you want to run the command Type the semicolon at the end of the last line of the command as shown in Example 5 1 Entering a SOL Command and press Return SQL Plus will process the c
276. e listing SET EDITF ILE file name ext SET EDITFILE is not supported in iSQL Plus Sets the default filename for the EDIT command For more information about the EDIT command see EDIT in this chapter You can include a path and or file extension For information on changing the default extension see the SUFFIX variable of the SET command The default filename and maximum filename length are operating system specific SET EMB EDDED ON OFF Controls where on a page each report begins OFF forces each report to start at the top of a new page ON allows a report to begin anywhere on a page Set SQL Plus Command Reference 13 107 SET EMBEDDED to ON when you want a report to begin printing immediately following the end of the previously run report SET ESC APE c ON OFF Example nn ca Defines the character used as the escape character OFF undefines the escape character ON enables the escape character ON changes the value of c back to the default You can use the escape character before the substitution character set through SET DEFINE to indicate that SQL Plus should treat the substitution character as an ordinary character rather than as a request for variable substitution If you define the escape character as an exclamation point then SET ESCAPE ACCEPT vl PROMPT Enter amp 1 displays this prompt Enter amp 1 To set the escape character back to the default value
277. e script with your host operating system text editor PT Next enter the following commands into the file using your text editor SPOOL TEMP CLEAR COLUMNS CLEAR BREAKS CLEAR COMPUTES COLUMN DEPARTMENT_ID HEADING DEPARTMENT COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 BREAK ON DEPARTMENT ID SKIP 1 ON REPORT COMPUTE SUM OF SALARY ON DEPARTMENT ID COMPUTE SUM OF SALARY ON REPORT SET PAGESIZE 24 SET NEWPAGE 0 SET LINESIZE 70 TTITLE CENTER ACME WIDGET SKIP 2 LEFT EMP FORMAT 99 BTITLE CE SELECT DE FROM EMP LOYEE REPORT RIGHT PAGE 9 SQL PNO SKIP 2 TER COMPANY CONFIDENTIAL PARTMENT ID LAST NAME SALARY DETAILS VIEW Formatting SQL Plus Reports 7 35 Storing and Printing Query Results WHERE SALARY gt 12000 ORDER BY DEPARTMENT_ID SPOOL OFF If you do not want to see the output on your screen you can also add SET TERMOUT OFF to the beginning of the file and SET TERMOUT ON to the end of the file Save and close the file in your text editor you will automatically return to SQL Plus Now run the script EMPRPT EMPRPT SQL Plus displays the output on your screen unless you set TERMOUT to OFF and spools it to the file TEMP ACME WIDGET EMPLOYEE REPORT PAGE 1 DEPARTMENT LAST NAME MONTHLY SALARY 20 Hartstein 13 000 dd RTS Rot Pe i fil tes SG el a eal a as Lj sum 13 000 80 Russell 14 000 Partners 13 500
278. e the Oracle9i SQL Reference and the AUTOTRACE variable of the SET command on page 13 95 Example 9 1 Creating a PLAN TABLE Run the following commands from your SQL Plus session to create the PLAN_ TABLE in the HR schema CONNECT HR your password SORACLE_HOME RDBMS ADMIN UTLXPLAN SQL Table created 9 2 SQL Plus User s Guide and Reference Tracing Statements Example 9 2 Creating the PLUSTRACE Role Run the following commands from your SQL Plus session to create the PLUSTRACE role and grant it to the DBA CONNECT AS SYSDBA SORACLE_HOME SQLPLUS ADMIN PLUSTRCE SQL drop role plustrace Role dropped create role plustrace Role created grant plustrace to dba with admin option Grant succeeded Example 9 3 Granting the PLUSTRACE Role Run the following commands from your SQL Plus session to grant the PLUSTRACE role to the HR user CONNECT AS SYSDBA GRANT PLUSTRACE TO HR Grant succeeded Execution Plan The Execution Plan shows the SQL optimizer s query execution path Each line of the Execution Plan has a sequential line number SQL Plus also displays the line number of the parent operation The Execution Plan consists of four columns displayed in the following order Column Name Description ID_PLUS_EXP Shows the line number of each execution step PARENT_ID_PLUS_EXP Shows the relationship between each step and its parent This column is useful for large reports
279. eSize iSQLPlusConnectIdList a idle timeout For information about these parameters see Configuring the Middle Tier iSQL Plus Server on page 3 7 Security HTTP Server authentication usernames for DBA connections need to be added to the iSQL Plus 9 2 password file iplusdba pw using the htpasswd utility If you had HTTP Authentication for user connections enabled in 9 0 1 verify the new isglplus conf format is followed and add users to the specified password file You may wish to allow access only to a specified list of database servers by enabling iSQLPlusConnectIdList For more information see Chapter 10 SQL Plus Security Style Sheet The style sheet iplus css has changed It is recommended that you use the default 9 2 style sheet as the basis for iSOL Plus Release 9 2 customization XXXV New Features in SQL Plus 9 0 1 xxxvi SQLPLUS Command line Switches The version and usage command line switches have been standardized as V ERSION H HELP Invalid options give the usage message corresponding to HELP The and options have been obsoleted isSQL Plus iSQL Plus is a browser based interface to SOL Plus iSQL Plus is only available on the Microsoft Windows operating system in this release START New commands were added to read and execute a SQL script from a Uniform Resource Locator URL The ability to read and execute a script from a URL is available in the and S
280. ecurity Warning If the Oracle HTTP Server is started by a user who is a member of the dba or oper groups on UNIX or who is a member of the ORA_DBA ORA_OPER ORA_SID_DBA or ORA_SID_OPER groups on Windows the iSOL Plus DBA URL is automatically authenticated for Oracle9i by the operating system To avoid this start the Oracle HTTP Server as a user who is not a member of these operating system groups Users of the iSQL Plus DBA URL can authenticate for Oracle9i using as sysdba or as sysoper Adding Entries to an Oracle HTTP Server Authentication File If you have enabled Oracle HTTP Server authentication for user connections you need to create a separate authentication file to contain username password entries for user level connections See Enabling Server Authentication for Users for information about enabling user level Oracle HTTP Server authentication To create a new entry in an Oracle HTTP Server authentication file on Windows 1 Loginto the machine running the Oracle HTTP Server as the Oracle HTTP Server administrator 2 Opena terminal 3 Run the htpasswd utility to add users to the authentication file htpasswd is usually located in ORACLE HOM SYSOPER users use the form E Apache Apache bin For SYSDBA or htpasswd ORACLE_HOME sqlplus admin iplusdba pw username For user connections where iplus authentication file use the form pw has been created as an em
281. ed This is a debugging message SP2 0894 Unsuccessful log in for username from URL to connect_id Cause iSQL Plus failed to log in user with the given username URL and connect identifier Action No action required This is a debugging message SP2 0895 Logged in username as session from URL to connect_id Cause iSQL Plus logged in user with the given user session Id username URL and connect identifier Action No action required This is a debugging message SP2 0896 Failed to log out username Cause iSQL Plus failed to log out user with given user session Id Action No action required This is a debugging message SP2 0897 Logged out username Cause iSQL Plus logged out user with given user session Id Action No action required This is a debugging message SP2 0898 Number of active sessions is number Cause Number of active iSQL Plus sessions is displayed Action No action required This is a debugging message SP2 0899 Number of sessions to be expired is number active sessions is number Cause Displays the number of sessions that have timed out and are to be expired and the resulting number of active sessions Action No action required This is a debugging message SQL Plus Error Messages 14 41 iSQL Plus Error Messages SP2 0900 username username password password connect id connect_id privilege privilege Cause Displays iSQL Plus log in details username password connection identifier
282. ed the appropriate privilege For more information about changing your password see the CONNECT command in this chapter Examples If you want to change your current password enter ja PASSWORD Changing password for your_password Old password your_password New password new_password Retype new password new_password Password changed If you are logged on as a DBA and want to change the password for user johnw currently identified by johnwpass to johnwnewpass PASSWORD johnw Changing password for johnw New password johnwnewpass Retype new password johnwnewpass Password changed Passwords are not echoed to the screen they are shown here for your convenience SQL Plus Command Reference 13 75 PAUSE PAUSE Syntax Terms Usage Examples PAUSE is not available in iSQL Plus PAU SE text Displays the specified text then waits for the user to press RETURN Refer to the following for a description of the clause or term text Represents the text you wish to display Enter PAUSE followed by no text to display two empty lines Because PAUSE always waits for the user s response it is best to use a message that tells the user explicitly to press Return PAUSE reads input from the terminal if a terminal is available even when you have designated the source of the command input as a file For information on pausing between pages of a report see the PAUSE variable of the SET command later in this ch
283. ed to allow connections to Action If this occurred with the CONNECT command in iSQL Plus the ISQLPlusConnectIdList configuration parameter in the isglplus conf file does not include the connection identifier used For example when the command CONNECT username passwordQGconnect identifier is entered the connect identifier must match a connection identifier in the parameter list The connection identifier is not case sensitive SQL Plus Error Messages 14 39 iSQL Plus Error Messages SP2 0885 Only a valid username or is allowed in the username field Cause An attempt was made to enter a value other than a username or in the iSQL Plus Login screen Username field Action Only a username is allowed in the iSQL Plus Login screen Username field A username or is allowed in the iSQL Plus DBA Login screen SP2 0886 No scripts in history Cause No scripts are available in the history list because no scripts have yet been executed in this session Action Scripts are only made available in the history list after they have been executed in the session SP2 0887 History size specified is non numeric or outside the range 0 100 Cause The history size specified was either not a numeric value or was not in the range 0 to 100 Action Re enter a numeric value in the range 0 to 100 for the history size SP2 0888 Keyword keyword is not available in iSOL Plus Cause Attempted to use a keyword or variable in an
284. ee running execution plan 9 3 execution statistics including in report 13 102 EXIT clause WHENEVER OSERROR 13 152 WHENEVER SQLERROR 13 154 EXIT command 4 13 13 64 BindVariable clause 13 65 COMMIT clause 13 64 disabling 10 5 FAILURE clause 13 64 inascript 13 133 ROLLBACK clause 13 65 use with SET MARKUP 8 3 WARNING clause 13 64 exit conditional 13 152 13 154 exiting iSQL Plus 4 15 Expired Password screen 4 19 extension 13 93 13 98 13 121 13 138 extension for windows 2 16 F FAILURE clause 13 64 FEEDBACK variable 13 96 13 108 fields connection identifier 2 5 2 11 define substitution variables 6 25 enter statements 2 6 2 7 new password 4 19 old password 4 19 password 2 4 2 11 privilege 2 11 retype new password 4 19 script location 2 8 username 2 4 2 11 3 16 4 19 file extensions 3 3 13 93 13 98 13 121 13 138 file names in at sign command 13 5 in double at sign command 13 7 in EDIT command 13 61 in GET command 13 66 inSAVE command 13 93 in SPOOL command 7 34 13 131 in SOLPLUS command 4 12 files configuring associations 3 5 flat 7 34 output 2 9 FLAGGER variable 13 97 13 108 flat file 7 34 FLUSH variable 13 97 13 109 FOLD_AFTER clause 13 31 FOLD_BEFORE clause 13 31 font national language support 12 3 footers aligning elements 13 90 displaying at bottom of page 13 87 displaying system maintained values 13 89 formatting elements 13 90
285. em variables are listed in alphabetical order The current state of system variables is displayed with the exception of the three system variables CONSTRAINT ROLE and TRANSACTION While you can enter and set values for CONSTRAINT ROLE and TRANSACTION through the associated text fields the current state is never displayed OK Click the OK button to set all system variables that you have changed Cancel Click the Cancel button to return to the Preferences screen without making any changes Using SET and COLUMN Commands in iSQL Plus iSQL Plus remembers the state of your current SET command variables from one execution to the next If you use the Back button on your web browser and then re execute scripts or if you re execute scripts from the History screen iSQL Plus may display the results differently according to any commands executed since the original script was executed For example a new SET PAGESIZE command may set column headings to appear in different positions The COLUMN command and the SET LINESIZE and SET WRAP commands have an effect on the buffer sizes used by iSQL Plus If words in your script output include unexpected white spaces or are truncated make sure the column size is large enough to accommodate the word and that word wrapping is set to ON SQL Plus User Interface 2 15 iSQL Plus Extension for Windows isQL Plus Extension for Windows The iSQL Plus Extension for Windows provides a context menu to load o
286. en normal media recovery is done a completion status is returned To recover the entire database enter RECOVER DATABASE To recover the database until a specified time enter RECOVER DATABASE UNTIL TIME 01 JAN 2001 04 32 00 13 84 SQL Plus User s Guide and Reference RECOVER To recover the two tablespaces ts_one and ts_two from the database enter RECOVER TABLESPACE ts_one ts_two To recover the datafile datal db from the database enter RECOVER DATAFILE datal db SQL Plus Command Reference 13 85 REMARK REMARK Syntax Usage Examples C REM ARK Begins a comment in a script SQL Plus does not interpret the comment as a command The REMARK command must appear at the beginning of a line and the comment ends at the end of the line A line cannot contain both a comment and a command A at the end of a REMARK line is treated as a line continuation character For details on entering comments in scripts using the SQL comment delimiters or the ANSI ISO comment delimiter refer to Placing Comments in Scripts on page 6 10 The following script contains some typical comments REM COMPUTE uses BREAK ON REPORT to break on end of table BREAK ON REPORT COMPUTE SUM OF DEPARTMENT 10 DEPARTMENT 20 DEPARTMENT 30 TOTAL BY JOB ID ON REPORT REM Each column displays the sums of salaries by job for REM one of the departments 10 20 30 SELECT JOB ID SUM DECODE DEPARTME
287. ence 13 95 SET System Variable Page Description SET AUTORECOVERY ON OFF 13 101 ON sets the RECOVER command to automatically apply the default filenames of archived redo log files needed during recovery SET AUTOTRACE ON OFF TRACE ONLY 13 102 Displays a report on the execution of successful SOL EXPLAIN STATISTICS DML statements SELECT INSERT UPDATE or DELETE SET BLOCKTERMINATOR c 13 102 Sets the non alphanumeric character used to end PL SQL blocks to c SET CMDSEP clON OFF 13 103 Sets the non alphanumeric character used to separate multiple SQL Plus commands entered on one line to c SET COLSEP text 13 104 In iSQL Plus SET COLSEP determines the column separator character to be printed between column output that is rendered inside lt PRE gt tags Sets the text to be printed between selected columns SET COMPATIBILITY V7 V8 NATIVE 13 104 Specifies the version of Oracle to which you are currently connected SET CONCAT cJONJOFF 13 105 Sets the character you can use to terminate a substitution variable reference if you wish to immediately follow the variable with a character that SQL Plus would otherwise interpret as a part of the substitution variable name SET COPYCOMMIT 0 n 13 105 Controls the number of batches after which the COPY command commits changes to the database SET COPYTYPECHECK ON OFF 13 105 Sets the suppression of the comparison of datatypes while inserting or appending to tables w
288. ents of the specified file or on the contents of the buffer Refer to the following for a description of the term or clause file name ext Represents the file you wish to edit typically a script Enter EDIT with no filename to edit the contents of the SOL buffer with the host operating system text editor If you omit the file extension SQL Plus assumes the default command file extension normally SQL For information on changing the default extension see the SUFFIX variable of the SET command in this chapter If you specify a filename SQL Plus searches for the file in the current working directory If SOL Plus cannot find the file in the current working directory it creates a file with the specified name The user variable EDITOR contains the name of the text editor invoked by EDIT You can change the text editor by changing the value of EDITOR See COPY for information about changing the value of a user variable If EDITOR is undefined EDIT attempts to invoke the default host operating system editor EDIT alone places the contents of the SOL buffer in a file by default named AFIEDT BUF in your current working directory and invokes the text editor on the contents of the file If the file AFIEDT BUF already exists it is overwritten with the contents of the buffer You can change the default filename by using the SET EDITFILE command For more information about setting a default filename for the EDIT command see the EDITFILE va
289. eparate version for each operating system that SQL Plus supports Keep a copy of your Oracle installation and user s guide available for reference Who Can Use SQL Plus The SQL Plus SOL and PL SQL command languages are powerful enough to serve the needs of users with some database experience yet straightforward enough for new users who are just learning to work with Oracle The design of the SOL Plus command language makes it easy to use For example to give a column labelled LAST NAME in the database the clearer heading Family Name you might enter the following command SQL Plus Overview 1 5 How Can I Learn SQL Plus COLUMN LAST NAME HEADING Family Name Similarly to list the column definitions for a table called EMPLOYEES you might enter this command DESCRIBE EMPLOYEES How Can Learn SQL Plus There are several sources available to assist you to learn SOL Plus Online Help for SOL Plus Command line and iSQL Plus online help a Using SQL Plus Section of this Guide Part II of this Guide Chapters 5 through 12 SOLA Course for SOL Plus A course run by Oracle with the course code of SOLA A three day hands on course How to Use the SQL Plus Guide This guide gives you information about SQL Plus that applies to all operating systems Some aspects of SOL Plus however differ on each operating system Such operating system specific details are covered in the Oracle installation and user s guide provided for
290. er isQL Plus Work Screen W After successfully logging in the Work screen is displayed Ele Edt View Favorites Tools Help Ea ORACLE al iSQL Plus Logout New History Preferences Help Session Work Screen File or URL Browse Load Script Enter statements H B Execute Save Script Clear Screen Cancel Connected f l Connected as SYSTEM cjones2 fit Local intranet Z File or URL Enter the path and filename or the URL of a file you want to load into the Input area for editing or execution SQL Plus User Interface 2 5 iSQL Plus User Interface Browse Click the Browse button to search for a script file that you want to load for editing or execution When you select the file its path and name are entered in the File or URL field Load Script Click the Load Script button to load the script specified in the File or URL field into the iSOL Plus Input area for editing or execution Enter statements Enter SOL statements PL SQL blocks or iSQL Plus commands This area is also referred to as the Input area You can resize the Input area in the Interface Options screen which you access from the Preferences screen Execute Click the Execute button to execute the contents of the Input area Depending on your preference settings the results are displayed in the Work screen in a new web browser window or saved to a file Save Script Click the Save Script button to save the contents o
291. er If the port number was not recorded during installation check the Port and Listen directives in httpd FOU On Windows httpd conf is located in SORACLE_ HOME Apache Apache conf On UNIX httpd conf is located in ORACLE HOME Apache Apache bin conf on UNIX The URL for iSQL Plus Release 9 2 is http machine name doman port isqlplus You must ensure that any HTML links to iSQL Plus are updated to the new URL iSQL Plus Configuration File The format of the iSQL Plus configuration file isqlplus conf has changed Any user customizations can be manually merged into the default iSQL Plus Release 9 2 configuration file On Windows isglplus conf is located in sORACLE_ HOME sqlplus admin On UNIX isqlplus conf is located in ORACLE_ HOME sqlplus admin iSQL Plus Release 9 0 1 Parameters There were two parameters that could be configured in iSQL Plus Release 9 0 1 a iSOLPlusTimeOut This parameter has been removed Expiry is now always enabled iSQLPlusTimeOut Interval The new default value is 30 minutes This directive is now a parameter to the FastCgiServer directive iSQL Plus Release 9 2 Parameters There are several new parameters for sizing and tuning iSQL Plus Release 9 2 You can edit the isglplus conf configuration file directly to change settings for iSQL Plus Server parameter settings iSQLPlusNumberOfThreads iSQLPlusLogLevel iSQLPlusTimeOutInterval iSQLPlusHashTabl
292. er in the destination table match the column names and column order in the optional column list or in the SELECT command CPY0005 Source and destination column attributes don t match Cause On an APPEND operation or an INSERT when the table exists at least one column in the destination table does not have the same datatype as the corresponding column in the SELECT command Action Re specify the COPY command making sure that the data types for items being selected agree with the destination Use TO DATE TO CHAR and TO NUMBER to make conversions CPY0006 Select list has more columns than destination table Cause On an APPEND operation or an INSERT when the table exists the number of columns in the SELECT command is greater than the number of columns in the destination table Action Re specify the COPY command making sure that the number of columns being selected agrees with the number in the destination table SQL Plus Error Messages 14 45 COPY Command Messages CPY0007 Select list has fewer columns than destination table Cause On an APPEND operation or INSERT when the table exists the number of columns in the SELECT command is less than the number of columns in the destination table Action Re specify the COPY command making sure that the number of columns being selected agrees with the number in the destination table CPY0008 More column list names than columns in the destination table Cause On an APPEND operation
293. er of rows the cardinality In Tuning SQL Plus 9 7 Tracing Parallel and Distributed Queries E nn E general the cost cardinality and bytes at each node represent cumulative results For example the cost of a join node accounts for not only the cost of completing the join operations but also the entire costs of accessing the relations in that join Lines marked with an asterisk denote a parallel or remote operation Each operation is explained in the second part of the report See the Oracle9i Database Performance Tuning Guide and Reference for more information on parallel and distributed operations The second section of this report consists of three columns displayed in the following order Column Name Description ID PLUS EXP Shows the line number of each execution step OTHER TAG PLUS EXP Describes the function of the SOL statement in the OTHER PLUS EXP column OTHER PLUS EXP Shows the text of the query for the parallel server or remote database The format of the columns may be altered with the COLUMN command The default formats can be found in the site profile for example glogin sql Example 9 7 Tracing Statements With Parallel Query Option To trace a parallel query running the parallel query option CREATE TABLE D2 T1 UNIQUE1 NUMBER PARALLEL DEGREE 6 Table created CREATE TABLE D2 T2 UNIQUE1 NUMBER PARALLEL degree 6 Table created
294. er the EXIT command at the SQL Plus command prompt Example 4 2 Exiting SQL Plus To leave SOL Plus enter the EXIT command at the SOL Plus command prompt EXIT SQL Plus displays the version of Oracle from which you disconnected and the versions of tools available through SQL Plus After a moment you will see the operating system prompt Before continuing with this chapter follow steps 3 4 and 5 of Example 4 1 to start SQL Plus again Alternatively log in using the shortcut shown under Shortcuts to Starting Command line SOL Plus Starting SQL Plus 4 13 Starting iSQL Plus Starting SQL Plus The Oracle HTTP Server and the iSQL Plus Server must be running on the middle tier before you can run iSQL Plus See Starting and Stopping the Oracle HTTP Server on page 3 13 To run iSQL Plus 1 Enter the Uniform Resource Locator URL of iSQL Plus in the Location field of your web browser for example http machine name domain port isqlplus where machine name domainis the URL and port is the port number for the Oracle HTTP Server you want to use The iSQL Plus Login screen is displayed Each successful login is uniquely identified so you can have multiple iSQL Plus sessions running from the same machine or from multiple client machines 2 Enter your Username Password and Connection Identifier See Login Username and Password and Database Connection Identifier for more information 3 Click the Login button The
295. ermits SQL Plus output to be generated in HTML format for delivery on the Internet SQL Plus output generated in HTML can be viewed with any web browser supporting HTML 3 2 mounted database A database associated with an Oracle instance The database may be opened or closed A database must be both mounted an opened to be accessed by users A database that has been mounted but not opened can be accessed by DBAs for some maintenance purposes multi threaded server Allows many user processes to share a small number of server processes minimizing the number of server processes and maximizing the utilization of available system resources NCHAR datatype Beginning with Oracle9i the NCHAR datatype is redefined to be a Unicode only datatype The NCHAR datatype specifies a fixed width national character set character string with width specifications referring to the number of characters and can have a maximum column size up to 2000 bytes For more information about the NCHAR datatype refer to the Oracle9i SOL Reference NCLOB datatype A standard Oracle datatype The NCLOB datatype is used to store fixed width national character set character NCHAR data and can store up to 4 gigabytes of character text data Net8 See Oracle Net network A group of two or more computers linked together through hardware and software to allow the sharing of data and or peripherals NLS_LENGTH_SEMANTICS NLS LENGTH SEMANTICS is an environment
296. erver 3 12 configuring Oracle Net 3 15 DBA Login screen 2 10 DBA Work screen 2 12 enabling cookies 3 5 enabling HTTP Server authentication 3 11 enabling javascript 3 5 enabling or disabling 3 14 entering commands 2 6 exiting 4 15 Expired Password screen 4 19 extension for windows 2 16 globalization support 12 1 History screen 2 6 Interface options screen 2 9 iSOLPlusHashTableSize parameter 9 13 iSQLPlusNumberOfThreads parameter 9 13 language support 4 14 Login screen 2 4 4 14 online help 4 14 overview 2 3 Preferences screen 2 8 security 10 9 Server configuration 3 7 server parameters 2 14 server statistics 2 12 session 1 5 setting system variables 2 14 starting 4 14 4 15 System variables screen 2 14 three tier model 1 4 unsupported commands D 1 useraccess 10 9 user interface 1 4 1 5 2 3 Work screen 2 5 iSQL Plus error messages 14 35 iSQL Plus Server active statistics 9 12 authentication 10 10 configuring httpd conf 3 12 configuring oracle apache conf 3 12 enabling DBA access 10 11 enabling restricted database access 10 10 isqlplus conf 3 8 3 9 3 10 3 11 3 12 10 11 iSQLPlusConnectIdList 10 10 iSQLPlusHashTableSize parameter 9 13 iSQLPlusNumberOfThreads parameter 9 13 iSQLPlusTimeOutInterval parameter 9 14 J Japanese 12 2 12 3 javascript configuring for iSQL Plus 3 5 JUSTIFY clause 13 34 Index 11 L LABEL variable SH
297. es in the column MINIMUM Computes the minimum value in the column MAXIMUM Computes the maximum value in the column AVG Computes the average of the values in the column STD Computes the standard deviation of the values in the column VARIANCE Computes the variance of the values in the column COUNT Computes the number of non null values in the column NUMBER Computes the number of rows in the column The function you specify in the COMPUTE command applies to all columns you enter after OF and before ON The computed values print on a separate line when the value of the ordered column changes Labels for ON REPORT and ON ROW computations appear in the first column otherwise they appear in the column specified in the ON clause You can change the compute label by using COMPUTE LABEL If you do not define a label for the computed value SQL Plus prints the unabbreviated function keyword The compute label can be suppressed by using the NOPRINT option of the COLUMN command on the break column See the COMPUTE command on page 13 40 for more details Note that if you use the NOPRINT option for the column on which the COMPUTE is being performed the COMPUTE result is also suppressed Example 7 13 Computing and Printing Subtotals To compute the total of SALARY by department first list the current BREAK definition BREAK which displays current BREAK definitions Formatting SQL Plus Reports 7 17 Clarifying Your Report with S
298. es the current line through line n adds one or more lines adds a line consisting of text lists all lines in the SOL buffer lists line n lists the current line Editing Scripts in SQL Plus Table 6 1 SQL Plus Editing Commands Command Abbreviation Purpose LIST n Ln lists line n through the current line LIST LAST L LAST lists the last line LIST mn Lmn lists a range of lines m to n LIST n L n lists the current line through line n These are useful if you want to correct or modify a command you have entered Listing the Buffer Contents The SQL buffer contains the last SOL or PL SQL command Any editing command other than LIST and DEL affects only a single line in the buffer This line is called the current line It is marked with an asterisk when you list the current command or block Example 6 2 Listing the Buffer Contents Suppose you want to list the current command Use the LIST command as shown below If you have exited SQL Plus or entered another SOL command or PL SQL block since following the steps in Example 5 1 Entering a SOL Command perform the steps in that example again before continuing LIST SELECT EMPLOYEE ID LAST NAME JOB ID SALARY 2 FROM EMP DETAILS VIEW 3 WHERE SALARY gt 12000 Notice that the semicolon you entered at the end of the SELECT command is not listed This semicolon is necessary to mark the end of the command when you enter it but SOL Plus does not store it i
299. essages SP2 0878 Duplicate keyword keyword specified Cause The keyword was already specified in a previous parameter of a URL argument Action Remove one of the keyword occurrences SP2 0879 Must specify a script for dynamic reports to execute Cause The script keyword was not specified in the URL Action Add a script keyword value pair to the URL argument SP2 0880 Enter connection details to run script script_url Cause No connection string was supplied in the URL argument for a dynamic report That is the userid keyword was not specified Action Login via the interactive login page SP2 0881 username password connect_identifier Cause Incorrect syntax was used for the iSQL Plus username in the connection string No AS SYSDBA or AS SYSOPER clause can be included Action Correct the syntax Use the AS SYSDBA or AS SYSOPER field of the login page for privileged connections SP2 0882 Empty password field Cause The password field of the iSQL Plus Login screen was empty Action Enter your password before attempting to log in SP2 0883 Invalid input area size specified Cause The width or height specified for the input area size was either not a numeric value or was not in the range 1 to 999 Action Re enter valid numeric values for the input area size SP2 0884 Connection to database connect identifier is not allowed Cause An attempt was made to connect to a database that SOL Plus has not been configur
300. et of Oracle database server system processes instance failure See database instance failure instance recovery Recovery of an instance in the event of software or hardware failure so that the database is again available to users If the instance terminates abnormally then the instance recovery automatically occurs at the next instance startup iSQL Plus iSQL Plus is a browser based interface to SOL Plus It is a component of the SQL Plus product iSQL Plus enables you to use a web browser to connect to Oracle9i and perform the same actions as you would through the command line version of SQL Plus You can use iSQL Plus to write SOL Plus SOL and PL SQL commands to a Enter edit run and save SOL commands and PL SQL blocks Calculate and print query results Listcolumn definitions for any table a Access and copy data between databases Perform database administration iSQL Plus Server The SQL Plus Server is located on the middle tier of the jSOL Plus three tier architecture It comprises the SOL Plus engine and the SQL Plus module In combination with the web server provided by the Oracle HTTP Server they provide the SQL Plus web enabled interface to Oracle9i Julian date An algorithm for expressing a date in integer form using the SQL function JDATE Julian dates allow additional arithmetic functions to be performed on dates justification See alignment label Defines the label to be printed for th
301. ether SQL Plus allows trailing blanks at the end of each displayed line ON removes blanks at the end of each line improving performance especially 13 122 SQL Plus User s Guide and Reference SET when you access SQL Plus from a slow communications device OFF allows SQL Plus to display trailing blanks TRIMOUT ON does not affect spooled output SET TRIMS POOL ON OFF SET TRIMSPOOL is not supported in iSQL Plus Determines whether SQL Plus allows trailing blanks at the end of each spooled line ON removes blanks at the end of each line OFF allows SQL Plus to include trailing blanks TRIMSPOOL ON does not affect terminal output SET UND ERLINE c ON OFF Sets the character used to underline column headings in reports to c Note c cannot be an alphanumeric character or a white space ON or OFF turns underlining on or off ON changes the value of c back to the default SET VER IFY ON OFF Controls whether to list the text of a SQL statement or PL SQL command before and after replacing substitution variables with values ON lists the text OFF suppresses the listing SET WRA P ON OFF Controls whether to truncate the display of a selected row if it is too long for the current line width OFF truncates the selected row ON allows the selected row to wrap to the next line Use the WRAPPED and TRUNCATED clauses of the COLUMN command to override the setting of WRAP for specific columns SQL Plus Command Reference
302. even one containing blanks and punctuation If the SOL command containing the reference should have quote marks around the variable and you do not include them there the user must include the quotes when prompted SQL Plus reads your response from the keyboard even if you have redirected terminal input or output to a file If a terminal is not available if for example you run the script in batch mode SOL Plus uses the redirected file After you enter a value at the prompt SQL Plus lists the line containing the substitution variable twice once before substituting the value you enter and once after substitution You can suppress this listing by setting the SET command variable VERIFY to OFF You should avoid creating substitution variables with names that may be identical to values that you will pass to them as unexpected results can occur If a value supplied for a substitution variable matches a variable name then the contents of the matching variable are used instead of the supplied value Example 6 11 Using Substitution Variables Create a script named STATS to be used to calculate a subgroup statistic the maximum value on a numeric column CLEAR BUFFER INPUT SELECT amp GROUP COL MAX amp NUMBER COL MAXIMUM FROM amp TABLE GROUP BY amp GROUP COL SAVE STATS Created file STATS Now run the script STATS STATS And respond to the prompts for values as shown Using Scripts in SQL Plus 6 19 Writing Interactiv
303. example there is a database failure the redo log is used to recover the database To protect against a failure involving the redo log itself Oracle allows a mirrored redo log so that two or more copies of the redo log can be maintained on different disks ARCHIVELOG Mode Operating a database in ARCHIVELOG mode enables the archiving of the online redo log The ARCHIVE LOG command permits a complete recovery from disk failure as well as instance failure because all changes made to the database are permanently saved in an archived redo log For more information about redo log files and database archiving modes see the Oracle9i Database Concepts manual For information about using the ARCHIVE LOG command see Chapter 13 5OL Plus Command Reference To automatically begin archiving enter ARCHIVE LOG START To list the details of the current log file being archived enter ARCHIVE LOG LIST Database log mode Archive Mode Automatic archival Enabled Archive destination vobs oracle dbs arch Oldest online log sequence 221 Next log sequence to archive 222 Current log sequence 222 11 4 SQL Plus User s Guide and Reference Database Recovery Database Recovery If a damaged database is in ARCHIVELOG mode it is a candidate for either complete media recovery or incomplete media recovery operations To begin media recovery operations use the RECOVER command For more information about using the RECOVER command see C
304. f the COLUMN command and reference the column in a subsequent SOL SELECT command a you EXIT SQL Plus Whenever you run a stored query or script SOL Plus substitutes the value of variable for each substitution variable referencing variable in the form amp variable or amp amp variable SQL Plus will not prompt you for the value of variable in this session until you UNDEFINE variable SQL Plus Command Reference 13 49 DEFINE Examples Note that you can use DEFINE to define the variable EDITOR which establishes the host system editor invoked by the SOL Plus EDIT command If you continue the value of a defined variable on multiple lines using the SQL Plus command continuation character SOL Plus replaces each continuation character and carriage return you enter with a space in the resulting variable For example SQL Plus interprets DEFINE TEXT ONE TWO THREE as DEFINE TEXT ONE TWO THREE You should avoid defining variables with names that may be identical to values that you will pass to them as unexpected results can occur If a value supplied for a defined variable matches a variable name then the contents of the matching variable are used instead of the supplied value Some variables are predefined when SQL Plus starts Enter DEFINE to see their definitions To assign the value MANAGER to the variable POS type DEFINE POS MANAGER If you execute a command that contains a reference to amp
305. f the Input area to a file You are prompted to enter the name of the file The file extension you choose is for your convenience It may be useful to identify scripts with an extension of SQL Clear Screen Click the Clear Screen button to clear all statements in the Input area and all displayed output Cancel Click the Cancel button to interrupt the script that is currently running isQL Plus History Screen Click the History icon to display the History screen The History screen allows you to reload scripts that you have previously executed in the same session A History entry is created each time you execute a script in the Work screen if it is not the same as the most recently executed script The History screen shows the leading 80 characters of the script Once you load a script from History it is moved to the top of the History list and when the History limit is reached the earliest scripts are removed When you exit a session the History is lost and History is not shared between sessions You can change the default number of entries stored in the History list in the Interface Options screen which you access from the Preferences screen 2 6 SQL Plus User s Guide and Reference iSQL P lus User Interface i File Edit View Favorites Tools Help Ea x ORACLE amp 9 amp a 7SQL Plus Logout New History Preferences Help Session Work Screen gt History History Click on
306. f the user interface You can replace the default style sheet with your own style sheet It is recommended that you do not delete the default style sheet but rename it so that you can revert to it if necessary For example to replace the cascading style sheet in Windows 1 Navigate to the SORACLE_HOME sqlplus admin iplus directory 2 Rename the existing style sheet from iplus css to another name 3 Copy your new style sheet to the 3ORACLE_HOME sqlplus admin iplus directory 4 Rename your new style sheet to iplus css 5 You may need to refresh your web browser display to see the effects of your new style sheet Enabling Server Authentication for Users By default Oracle HTTP Server authentication is required for SYSDBA and SYSOPER privileged users You may also want to limit who can access iSQL Plus by requiring Oracle HTTP Server authentication for normal user logins See Enabling Server Authentication for Users on page 10 10 for more details Enabling DBA Access To connect with SYSDBA or SYSOPER privileges or to generate the iSQL Plus Server Statistics report your username and password must be added to the iSQL Plus authentication file for the Oracle HTTP Server See Enabling DBA Access on page 10 10 for more details Configuring SQL Plus 3 11 iSQL Plus Configuration Configuring the Middle Tier Oracle HTTP Server The Oracle HTTP Server is installed during Oracle9i Database installat
307. fer SOL Plus does not store SOL Plus commands in the SOL buffer Understanding SQL Plus Command Syntax SQL Plus commands have a different syntax from SOL commands or PL SQL blocks Continuing a Long SQL Plus Command on Additional Lines You can continue a long SQL Plus command by typing a hyphen at the end of the line and pressing Return If you wish you can type a space before typing the hyphen SQL Plus displays a right angle bracket gt as a prompt for each additional line For example SQL Plus Basics 5 9 System Variables that Affect How Commands Run COLUMN SALARY FORMAT 99 999 HEADING MONTHLY SALARY Since SQL Plus identifies the hyphen as a continuation character entering a hyphen within a SQL statement is ignored by SQL Plus SQL Plus does not identify the statement as a SQL statement until after the input processing has joined the lines together and removed the hyphen For example entering the following SELECT 200 100 FROM DUAL returns the error SELECT 200 100 FROM DUAL ERROR at line 1 ORA 00923 FROM keyword not found where expected To ensure that the statement is interpreted correctly reposition the hyphen from the end of the first line to the beginning of the second line Ending a SQL Plus Command You do not need to end a SQL Plus command with a semicolon When you finish entering the command you can just press Return If you wish however you can enter a semicolon at the e
308. fer that line becomes line 1 Assume the SQL buffer contains the following command SELECT LAST_NAME DEPARTMENT_ID SALARY COMMISSION_PCT FROM EMP DETAILS VIEW To add an ORDER BY clause to the query enter LIST 2 2 FROM EMP DETAILS VIEW SQL Plus Command Reference 13 71 INPUT E INPUT ORDER BY LAST NAME LIST 2 ensures that line 2 is the current line INPUT adds a new line containing the ORDER BY clause after the current line The SOL buffer now contains the following lines 1 SELECT LAST NAME DEPARTMENT ID SALARY COMMISSION PCT 2 FROM EMP DETAILS VIEW 3 ORDER BY LAST NAME To add a two line WHERE clause enter LIST 2 2 FROM EMP DETAILS VIEW INPUT 3 WHERE JOB ID SA MAN 4 AND COMMISSION PCT 25 5 INPUT prompts you for new lines until you enter an empty line or a period The SQL buffer now contains the following lines SELECT LAST NAME DEPARTMENT ID SALARY COMMISSION PCT FROM EMP DETAILS VIEW WHERE JOB ID SA MAN AND COMMISSION PCT 25 ORDER BY LAST NAME 13 72 SQL Plus User s Guide and Reference LIST LIST Syntax Terms Examples E LIIST njn min n LAST n LAST LAST Lists one or more lines of the SQL buffer Refer to the following list for a description of each term or clause n Lists line n nm Lists lines n through m n Lists line n through the current line n LAST Lists line n through the la
309. flat file with SQL Plus you first must enter the following SET commands SET NEWPAGE 0 SET SPACE 0 SET LINESIZE 80 SET PAGESIZE 0 SET ECHO OFF SET FEEDBACK OFF SET VERIFY OFF SET HEADING OFF SET MARKUP HTML OFF SPOOL OFF After entering these commands you use the SPOOL command as shown in the previous section to create the flat file The SET COLSEP command may be useful to delineate the columns For more information see the SET command on page 13 95 Sending Results to a File To store the results of a query in a file and still display them on the screen enter the SPOOL command in the following form SPOOL file name SQL Plus stores all information displayed on the screen after you enter the SPOOL command in the file you specify 7 34 SQL Plus User s Guide and Reference Storing and Printing Query Results Sending Results to a Printer To print query results spool them to a file as described in the previous section Then instead of using SPOOL OFF enter the command in the following form SPOOL OUT SQL Plus stops spooling and copies the contents of the spooled file to your host computer s standard default printer SPOOL OUT does not delete the spool file after prin ting Example 7 26 Sending Query Results to a Printer To generate a final report and spool and print the results create a script named EMPRPT First use EDIT EMPR containing the following commands EDIT to create th
310. following unsupported commands or command options raises an SP2 0850 error message The following commands have no context in iSQL Plus and have not been implemented ACCEPT PASSWORD CLEAR SCREEN PAUSE The following SET command variables have no context in iSQL Plus and have not been implemented SET EDITFILE SET SOLBLANKLINES SET TAB SET FLUSH SET SOLCONTINUE SET TERMOUT SET NEWPAGE SET SOLNUMBER SET TIME SET PAUSE SET SOLPREFIX SET TRIMOUT SET SHIFTINOUT SET SOLPROMPT SET TRIMSPOOL SET SHOWMODE SET SUFFIX The following commands have security issues on the middle tier and have not been implemented GET SPOOL HOST STORE The following commands are SQL buffer editing commands which are not relevant in iSQL Plus and have not been implemented APPEND DEL INPUT CHANGE EDIT SAVE Commands Not Supported in iSQL Plus D 1 D 2 SQL Plus User s Guide and Reference Glossary account An authorized user of an operating system or a product such as Oracle database server or Oracle Forms Depending on the operating system may be referred to as ID User ID login and so on Accounts are often created and controlled by a system administrator alias In SQL a temporary name assigned to a table view column or value within a SQL statement used to refer to that item later in the same statement or in associated SOL Plus commands alignment The way in which data is positioned in a field It may be positioned to the left
311. for a description of each term or clause ON column action action When you include action s specifies action s for SOL Plus to take whenever a break occurs in the specified column called the break col umn column cannot have a table or view appended to it To achieve this you can alias the column in the SQL statement A break is one of three events a change in the value of a column or expression the out put of a row or the end of a report When you omit action s BREAK ON column suppresses printing of duplicate values in column and marks a place in the report where SQL Plus will perform the computation you specify in a corresponding COMPUTE command You can specify ON column one or more times If you specify multiple ON clauses as in 13 18 SQL Plus User s Guide and Reference BREAK BREAK ON DEPARTMENT_ID SKIP PAGE ON JOB_ID SKIP 1 ON SALARY SKIP 1 the first ON clause represents the outermost break in this case ON DEPARTMENT_ID and the last ON clause represents the innermost break in this case ON SALARY SQL Plus searches each row of output for the specified break s starting with the outermost break and pro ceeding in the order you enter the clauses to the innermost In the example SQL Plus searches for a change in the value of DEPARTMENT_ID then JOB_ID then SALARY Next SQL Plus executes actions beginning with the action specified for the innermost break and proceeding in reverse order toward the
312. for additional languages by selecting Windows Update on the Tools menu For Netscape Navigator Select Preferences from the Edit menu a b Select Fonts under Appearance c Choose Unicode from the Encoding dropdown list d Select the variable and fixed pitch fonts that support the Unicode character set from the Variable and Fixed Pitch dropdown lists Oracle HTTP Server Set the Globalization Support variables you want in the Oracle HTTP Server operating system Every iSQL Plus session inherits this environment On Windows do the following 1 Shutdown the Oracle HTTP Server 2 Open System from the Control Panel 3 Create a new environment variable NLS5 LANG with a value of Japanese Japan UTF8 4 Restart the Oracle HTTP Server On UNIX do the following 1 Shutdown the Oracle HTTP Server 2 Setthe NLS LANG variable using either set or setenv depending on the UNIX shell you are using For example in csh you would enter setenv NLS LANG Japanese Japan UTF8 3 Restart the Oracle HTTP Server The Oracle HTTP Server should be started from the terminal used to set the NLS_ LANG variable This is to ensure that the variable is read at startup Alternatively NLS LANG could be set in your login initialization file or a command shell initialization file Oracle9i Create your Oracle9i database with the UTF8 character set 12 4 SQL Plus User s Guide and Reference Part Ill SQL Plus Reference This section c
313. g 3 800 Dilly 3 600 Gates 2 900 Perkins 2 500 Bell 4 000 Everett 3 900 McCain 3 200 Jones 2 800 SALARIES LAST NAME SALARY Walsh 3 100 SQL Plus Command Reference 13 103 SET Feeney 3 000 OConnell 2 600 Grant 2 600 20 rows selected SET COLSEP _ text Example In iSQL Plus SET COLSEP determines the column separator character to be printed between column output that is rendered inside lt PRE gt tags HTML table output is the default To generate preformatted output you must set PREFORMAT ON with the SET MARKUP HTML PREFORMAT ON command Sets the text to be printed between selected columns If the COLSEP variable contains blanks or punctuation characters you must enclose it with single quotes The default value for text is a single space In multi line rows the column separator does not print between columns that begin on different lines The column separator does not appear on blank lines produced by BREAK SKIP n and does not overwrite the record separator See SET RECSEP in this chapter for more information Mae To set the column separator to enter SET COLSEP SELECT LAST_NAME JOB_ID DEPARTMENT_ID FROM EMP DETAILS VIEW WHERE DEPARTMENT ID 20 LAST NAME JOB_ID DEPARTMENT_ID a a ae a ee a ee cn ta Hartstein MK_MAN 20 Fay MK REP 20 SET COM PATIBILITY V7 V8 NATIVE Specifies the version of Oracle SQL syntax to use Se
314. g Hartstein 13 000 00 KERR ERE ICKIR HSE HERRERA RE ERER o a a ee te IEEE Subtotal 13 000 00 Sales Partners 13 500 00 Russell 14 000 00 FORME RAR ATR eee x kuxxokeo 0o 07 Aw PN Subtotal 27 500 00 Total 98 500 00 The following example illustrates producing a report containing a CLOB column and then displaying it with the SET LOBOFFSET command Assume you have already created a table named clob tab which contains a column named clob col of type CLOB The clob col contains the following data Remember to run the Departmental Salary Bill report each month This report contains confidential information To produce a report listing the data in the col clob column enter VARIABLE T CLOB BEGIN SELECT CLOB COL INTO T FROM CLOB TAB END PL SQL PROCEDURE SUCCESSFULLY COMPLETED n 13 150 SQL Plus User s Guide and Reference VARIABLE n To print 200 characters from the column clob col enter SET LINESIZE 70 SET LONG 200 PRINT T Remember to run the Departmental Salary Bill report each month This r eport contains confidential information To set the printing position to the 21st character enter SET LOBOFFSET 21 PRINT T Departmental Salary Bill report each month This report contains confi dential information For more information on creating CLOB columns see your Oracle9i SQL Reference SQL Plus Command Reference 13 151 WHENEVER OSERROR WHENEVER OS
315. g Help in iSQL Plus a Exiting iSOL Plus Starting iSQL Plus Login Username and Password a Database Connection Identifier Starting SQL Plus 4 1 Starting Command line SQL P lus Starting Command line SQL Plus To begin using SOL Plus you must first understand how to start and leave SOL Plus E Example 4 1 Starting SQL Plus This example shows you how to start SQL Plus Follow the steps shown 1 2 3 Make sure that SQL Plus has been installed on your computer Log on to the host operating system if required Enter the command SQLPLUS and press Return Note Some operating systems expect you to enter commands in lowercase letters If your system expects lowercase enter the SQLPLUS command in lowercase SQLPLUS SQL Plus displays its version number the current date and copyright information and prompts you for your username the text displayed on your system may differ slightly SQL Plus Release 9 2 0 1 0 Production on Thu Aug 1 16 29 01 2002 c Copyright 1986 2002 Oracle Corporation All rights reserved Enter user name Enter your username and press Return SOL Plus displays the prompt Enter password Enter your password and press Return again For your protection your password does not appear on the screen The process of entering your username and password is called logging in SQL Plus displays the version of Oracle to which you connected and the versi
316. g format 7 6 13 31 default format 13 31 setting maximum width 13 97 13 112 setting retrieval size 13 97 13 112 LONG variable 13 97 13 112 effect on COPY command B 4 B 8 LONGCHUNKSIZE variable 7 6 13 31 13 97 13 112 LONGRAW column definition from DESCRIBE 13 53 MARKUP 4 4 8 2 SPOOL clause 4 6 SQLPLUS command clause 4 5 MARKUP 4 4 8 2 13 112 BODY clause 4 6 ENTMAP clause 4 6 HEAD clause 4 6 PREFORMAT clause 4 8 SPOOL clause 4 6 TABLE clause 4 6 MAXDATA variable C 2 C 6 MAXIMUM function 7 17 media recovery 13 135 message sending to screen 6 27 13 78 Microsoft Internet Explorer configuring proxy exceptions 3 6 middle tier 1 4 configuration 3 7 MIME type configuration 3 5 MINIMUM function 7 17 mod_ssl 10 9 MOUNT clause 13 135 mounting a database 13 135 N nationallanguage support 12 2 12 3 character encoding 12 3 font 12 3 See also globalization support NCHAR clause VARIABLE command 13 145 NCHAR columns changing format 7 6 13 31 default format 7 6 13 31 NCLOB clause VARIABLE command 13 146 NCLOB columns changing format 7 6 13 31 default format 13 31 setting maximum width 13 97 13 112 setting retrieval position 13 97 13 111 setting retrievalsize 13 97 13 112 negative infinity sign 13 34 Netscape Navigator configuring proxy exceptions 3 6 new password field 4 19 NEW VALUE clause 7 29 13 34 storing current date in variable fo
317. g in again and the following error is displayed SP2 0864 Session has expired Please log in again Configuring SQL Plus 3 9 iSQL Plus Configuration Setting the jSQL Plus Hash Table Size Parameter The number of hash table entries is defined by the iSQLPlusHashTableSize initialization parameter Each user session consumes one entry in the hash table even if it is idle Its default value is derived from the value of the iSQLPlusNumberOfThreads parameter value However iSQLPlusHashTableSize can be set independently to tune the system You can edit the iSQL Plus configuration file isglplus conf to change the hash table size The syntax of the line to change in the configuration file is FastCgiServer initial env iSQLPlusHashTableSize n Where n is the number of entries in the hash table Enabling or Disabling Restricted Database Access The restricted database parameter limits the databases that users can access in iSQL Plus When enabled a dropdown list of available databases is displayed in place of the Connection Identifier text field on the Login screen This allows greater security for iSQL Plus Servers in hosted environments Connection identifiers are listed in the order defined in iSQLPlusConnectIdList You can edit the iSQL Plus configuration file isglplus conf to restrict database access The syntax of the line to change in the configuration file is FastCgiServer initial env iSQLPlusConnectIdL
318. ge and Report Titles and Dimensions you would probably prefer to have the date automatically appear when the report is run You can do this by creating a variable to hold the current date To create the variable in this example named _DATE you can add the following commands to your SQL Plus LOGIN file BREAK ON TODAY COLUMN TODAY NEW_VALUE _DATE SELECT TO CHAR SYSDATE fmMonth DD YYYY TODAY FROM DUAL CLEAR BREAKS When you start SOL Plus these commands place the value of SYSDATE the current date into a variable named _DATE To display the current date you can reference DATE ina title as you would any other variable The date format model you include in the SELECT command in your LOGIN file determines the format in which SQL Plus displays the date See your Oracle9i SQL Reference for more information on date format models For more information about the LOGIN file see Modifying Your LOGIN File on page 3 3 You can also enter these commands interactively at the command prompt For more information see the COLUMN command on page 13 29 Setting Page Dimensions Typically a page of a report contains the number of blank line s set in the NEWPAGE variable of the SET command a top title column headings your query results and a bottom title SQL Plus displays a report that is too long to fit on one page on several consecutive pages each with its own titles and column headings The amount of data SQL Plus displays on e
319. ging your Password In the command line interface you can change your password with the PASSWORD command See PASSWORD on page 13 75 Once you have logged in you can connect under a different username with the CONNECT command The username and password must be valid for the database For example to connect the username HR to the default database using the password your password you could enter CONNECT HR your password You can disconnect the username currently connected to Oracle without leaving SQL Plus or ending your iSQL Plus session with the DISCONNECT command 4 18 SQL Plus User s Guide and Reference Login Username and Password Changing Your Password in jSQL Plus You can change your Oracle database account password in the Change Password screen If you have logged in with DBA privileges you can change the password of other users You access the Change Password screen from the Preferences screen I Ee Edt Yew Favoies look Help a 4 ORACLE AA t New History Preferences Help S Work Screen Preferences Change Password Change Password Username system Old password New password Retype new password ox Cancel El l Connected as SYSTEM Gicjones2 fin Local intranet y Username Enter your Oracle database account username Old password Enter your current Oracle database account password New password Enter your new password Retype new password Enter your new password again t
320. gt sqlplus username8connect identifier You will be prompted to enter your password xlii Part SQL Plus Getting Started This section provides you with the information you need to get started with SQL Plus It provides an overview of SQL Plus describes the command line and iSQL Plus user interfaces provides configuration information and information you need to log in and run SQL Plus The following chapters are covered in this section a SQL Plus Overview a SQL Plus User Interface a Configuring SOL Plus a Starting SOL Plus 1 SQL Plus Overview This chapter introduces you to SQL Plus covering the following topics What is SOL Plus SOL Plus Installation Who Can Use SQL Plus How Can I Learn SQL Plus How to Use the SOL Plus Guide Oracle9i Sample Tables and SQL Plus SQL Plus Overview 1 1 What is SQL Plus What is SQL Plus SQL Plus is an interactive and batch query tool that is installed with every Oracle Server or Client installation It has a command line user interface and more recently a web based user interface called iSQL Plus On Windows platforms context menu options accessed through the right mouse button enable local files to be sent to the iSQL Plus user interface SQL Plus has its own commands and environment and it provides access to the Oracle RDBMS It allows you to enter and execute SOL PL SQL SQL Plus and operating system commands to perform the following enter
321. hange the width of a datatype to n use FORMAT An A stands for alphanumeric If you specify a width shorter than the column head ing SOL Plus truncates the heading DATE Columns The default width and format of unformatted DATE columns in SQL Plus is derived from the NLS parameters in effect Oth erwise the default width is A9 In Oracle9i the NLS parameters may be set in your database parameter file or may be environment variables or an equivalent platform specific mechanism They may also be specified for each session with the ALTER SESSION command See the docu SQL Plus Command Reference 13 31 COLUMN mentation for Oracle9i for a complete description of the NLS parame ters You can change the format of any DATE column using the SQL func tion TO CHAR in your SOL SELECT statement You may also wish to use an explicit COLUMN FORMAT command to adjust the column width When you use SQL functions like TO CHAR Oracle automatically allows for a very wide column To change the width of a DATE column to n use the COLUMN com mand with FORMAT An If you specify a width shorter than the col umn heading the heading is truncated NUMBER Columns To change a NUMBER column s width use FOR MAT followed by an element as specified in Table 13 1 Table 13 1 Number Formats Element Examples Description 9 MI PR 9999 Number of 9 s specifies number of significant digits returned Blanks are displayed for leading ze
322. hapter 13 SQL Plus Command Reference In order to begin recovery operations you must have DBA privileges To recover the database up to a specified time using a control backup file enter RECOVER DATABASE UNTIL TIME 1998 11 23 12 47 30 USING BACKUP CONTROLFILE To recover two offline table spaces enter RECOVER TABLESPACE tsl ts2 Make sure that the table spaces you are interested in recovering have been taken offline before proceeding with recovery for those table spaces Database Administration with SQL Plus 11 5 Database Recovery 11 6 SQL Plus User s Guide and Reference 12 SQL Plus Globalization Support This chapter provides a brief overview of the globalization support in SOL Plus Configuring Globalization Support in Command line SQL Plus a Configuring Globalization Support in iSQL Plus For more information on globalization support see the Oracle Technology Network globalization notes at http otn oracle com tech globalization content html and see the Oracle9i Database Globalization Support Guide SQL Plus Globalization Support 12 1 Configuring Globalization Support in Command line SQL P lus Configuring Globalization Support in Command line SQL Plus To display another language in SOL Plus you must configure both the Oracle9i database and the client environment before starting SQL Plus Configuration of the client environment involves setting the NLS_LANG environment variable NLS_ LANG is
323. hat is located at the URL http machine name2 domain myscript sqlin iSQL Plus and prompt for username and password enter http machine name domain port isqlplus script http machine name2 domain myscript sql To execute a script that is located at a URL pass the username and password login to a database and pass parameters to the script to provide values for substitution variables enter http machine_name domain port isqlplusdba userid hr your_ password oracle9i 20as 20sysdba amp script ftp machine_ name2 domain script sql amp name amp salary 12000 As the iSQL Plus DBA URL is used Oracle HTTP Server authentication is also required As spaces are not supported they have been encoded as 20 in this example To load a script into iSQL Plus without passing the username and password enter http machine name domain port isqlplus script select from employee details view amp type text amp action load Login Username and Password When you start SOL Plus you need a username that identifies you as an authorized Oracle user and a password that proves you are the legitimate owner of your username The database administrator DBA is responsible for creating your database account with the necessary privileges and giving you the username and password that allows you to access your account Default logins are created and displayed in messages during Oracle9 installation The default login username password combinations
324. he SKIP PAGE action OLD VALUE is useful for master detail reports in which there is a new master record for each page For master detail reporting you must also include the column in the ORDER BY clause For information on displaying a column value in the top title see COL UMN NEW VALUE For more information on referencing variables in titles see the TTITLE command later in this chapter SQL Plus Command Reference 13 35 COLUMN Usage Examples ONJOFF Controls the status of display attributes for a column OFF disables the attributes for a column without affecting the attributes definition ON reinstates the attributes WRAIPPED WOR D_WRAPPED TRU NCATED Specifies how SQL Plus will treat a datatype or DATE string that is too wide for a column WRAPPED wraps the string within the column bounds beginning new lines when required When WORD WRAP is enabled SQL Plus left justifies each new line skipping all leading whitespace for example returns newline characters tabs and spaces including embedded newline characters Embedded whitespace not on a line boundary is not skipped TRUNCATED truncates the string at the end of the first line of display You can enter any number of COLUMN commands for one or more columns All column attributes set for each column remain in effect for the remainder of the session until you turn the column OFF or until you use the CLEAR COLUMN command Thus the COLUMN commands you enter
325. he display of each command ina script that is executed with the START command HTML Entities Certain characters lt gt and amp have a predefined meaning in HTML In the previous example you may have noticed that the gt character was replaced by amp gt as soon as you entered the SET MARKUP HTML ON command To enable these characters to be displayed in your web browser HTML provides character entities to use instead Table 8 1 Equivalent HTML Entities Character HTML Entity Meaning lt amp lt Start HTML tag label gt amp gt End HTML tag label amp quot Double quote amp amp amp Ampersand The web browser displays the character but the actual text in the HTML encoded file is the HTML entity amp gt The SET MARKUP option ENTMAP controls the substitution of HTML entities ENTMAP is set ON by default It ensures that the characters lt gt and amp are always replaced by the HTML entities representing these characters This prevents web browsers from misinterpreting these characters when they occur in your SQL Plus commands or in data resulting from your query You can set ENTMAP at a global level with SET MARKUP HTML ENTMAP ON or ata column level with COLUMN column name ENTMAP ON 8 12 SQL Plus User s Guide and Reference Creating Reports using iSQL Plus Creating Reports using SQL Plus You can create dynamic reports and pass variables to scripts by sending iSQL Plus a request to r
326. he following icons are displayed in iSQL Plus screens including online help Logout Logs you out of the SQL Plus session and returns you to the Login screen New Session Starts a new iSQL Plus session in a separate web browser window You can log in to the new session as the same user or as any other valid user B History Opens the SQL Plus History screen You can select one or more previously executed scripts to reload into the Input area or to delete from the History list jz Preferences Opens the iSQL Plus Preferences screen where you can set interface options system variables or change your password Help Opens the iSQL Plus Help in a separate web browser window SQL Plus User Interface 2 3 iSQL Plus User Interface gt Next Takes you to the next page in SQL Plus Help 4 Previous Takes you to the previous page in iSQL Plus Help Contents Takes you to the contents in iSQL Plus Help Index Takes you to the index in iSQL Plus Help Breadcrumbs Breadcrumbs are navigation links showing the navigation path you have taken They appear as text links displayed under the iSQL Plus logo Click on a breadcrumb link to return to any of the screens listed For example navigating to the Preferences screen using the Preferences icon displays a Work screen breadcrumb Work Screen Preferences Click the Work Screen link to return to the Work screen isQL Plus Login Screen 2 4 You connect to the Login
327. hen you double click The default application is Windows Notepad This definition does not affect the iSQL Plus Server definitions Browse Click Browse to find an application you want to associate with the SQL file extension when you double click Language Select a language you want to use in the iSQL Plus Extension from the dropdown list of available languages Brazilian Portuguese English French Canadian French German Italian Japanese Korean Simplified Chinese Spanish LA Spanish Traditional Chinese This language setting only affects the iSQL Plus Extension not iSQL Plus OK Click OK to save your changes and close the Configure iSQL Plus Servers dialog Cancel Click Cancel to quit your changes and close iSQL Plus Extension You are prompted once more before your changes are lost Configuring SQL Plus 3 17 iSQL Plus Extension for Windows Configuration When you first open the Configure iSQL Plus Servers dialog the OK button is unavailable and the Cancel button is labelled Close Once you make changes OK is enabled and Close is renamed Cancel Adding a Server You must configure at least one iSQL Plus Server before you can use the iSQL Plus Server Extension To add an iSQL Plus Server perform the following steps 1 Right click on a SQL file in Windows Explorer 2 Select iSQL Plus Servers to display the context menu options Initially there are the following options a No iSQL Plus Servers configured
328. ho have been granted SYSOPER or SYSDBA system privileges You can also use either of these privileged connections with and NOLOG If you use this option you need to quote the command arguments on many operating systems for example SQLPLUS AS SYSDBA SQLPLUS SYSTEM your password AS SYSOPER Establishes no initial connection to Oracle Before issuing any SOL com mands you must issue a CONNECT command to establish a valid logon Use NOLOG when you want to have a SQL Plus script prompt Starting SQL Plus 4 11 Getting Command line Help for the username password or database specification The first line of this script is not assumed to contain a logon Start url file_namel ext arg Specifies the name of a script and arguments to run The script can be called from the local file system or from a web server SQL Plus passes the arguments to the script as if executing the file using the SQL Plus START command If no file suffix file extension is specified the suffix defined by the SET SUFFIX command is used The default suffix is sql See the START command on page 13 132 for more information Getting Command line Help To access online help for SQL Plus commands you can type HELP followed by the command name at the SQL command prompt For example HELP ACCEPT To display a list of SQL Plus commands type HELP followed by either TOPICS or INDEX HELP TOPICS displays a single column list of SOL Plus c
329. iSQL Plus Work screen is displayed To run iSQL Plus with SYSDBA or SYSOPER privileges use the iSQL Plus DBA URL http machine name domain port isqlplusdba When you are connected through the iSQL Plus DBA URL the Oracle HTTP Server authentication permits AS SYSDBA or AS SYSOPER connections through the DBA Login screen or through a CONNECT command but the Oracle9i username and password authentication may still prevent access Getting Help in iSQL Plus The online SQL Plus Help provides help and syntax specific to iSQL Plus Click the Help icon to access the iSQL Plus Help It is displayed in a new browser window iSQL Plus Help is available in the following eight languages Brazilian Portuguese French German Italian 4 14 SQL Plus User s Guide and Reference Starting iSQL Plus froma URL Japanese Korean Simplified Chinese Spanish English is installed by default For more information about language support in SQL Plus see Chapter 12 SQL Plus Globalization Support Exiting jSQL Plus To exit iSQL Plus click the Logout icon It is recommended that you always use the Logout icon to exit iSQL Plus to free up system and server resources In iSQL Plus the EXIT command does not exit or quit your iSQL Plus session it halts the currently running script Starting iSQL Plus from a URL You can start iSQL Plus and pass URL variables SOL scripts and substitution variables by sending a request from a URL SQL scr
330. iable name SP2 0137 DEFINE requires a value following equal sign Cause There was no value for the variable or symbol SQL Plus expected a value to be assigned to a symbol or variable name after the equal sign Action Specify a value for the symbol or variable SP2 0138 DEFINE variable not added no room Cause Maximum number of variables that can be defined in a SQL Plus session was exceeded Action UNDEFINE any unused variables to make room for this variable and re run the command SP2 0145 Udalnk is not 12345 Probably a link error Action The SQL Plus executable is not linked correctly Action Make a note of the message and the number then contact the System Administrator to re link SOL PIus SP2 0146 Unable to allocate dynamic space needed number of bytes bytes exiting Cause An internal error occurred Action Note the message and number and contact the System Administrator SQL Plus Error Messages 14 9 SQL Plus Error Messages SP2 0152 ORACLE may not be functioning properly Cause Unable to initialize a session to the Oracle instance Action Make a note of the message and the number then contact the Database Administrator SP2 0157 Unable to CONNECT to ORACLE after 3 attempts exiting SOL Plus Cause Unable to connect to Oracle after three attempts Action Validate login details and re try SP2 0158 Unknown command_name option option_name Usage SET SHIFT INOUT VIS IBLE INV ISIBLE SET NEW
331. iddle tier coordinates interactions and resources between the client tier and the database tier The database tier is Oracle9i which is accessed via Oracle Net 1 4 SQL Plus User s Guide and Reference Who Can Use SQL Plus Web Browser The iSQL Plus user interface runs in a web browser connected to the Internet or your intranet There is no installation or configuration required for the iSQL Plus user interface You only need to know the URL of the Oracle HTTP Server to access Oracle9i isQL Plus Server The iSQL Plus Server is installed with the Oracle HTTP Server when Oracle is installed The middle tier contains the Oracle HTTP Server and the iSQL Plus Server The iSQL Plus Server enables communication and authentication between the iSQL Plus user interface and Oracle9i Each iSQL Plus session is uniquely identified so you can have multiple concurrent sessions open to Oracle9i Oracle9i Oracle Net components provide communication between the iSQL Plus Server and Oracle9i in the same way as for a client server installation of Oracle9i SQL Plus Installation SQL Plus is a component of the Oracle Database distribution SQL Plus and its web based user interface called iSQL Plus are installed by default when you install the Oracle Database A few aspects of Oracle and SQL Plus differ from one host computer and operating system to another These topics are discussed in the Oracle installation and user s guide published in a s
332. identical to an alias in the tnsnames ora file There are several initialization parameters that are set in one statement in the isglplus conf file You should leave existing elements intact Once set all connections made through the Login screen all Dynamic Reports and any connections attempted with the CONNECT command are refused unless the connection is to one of the databases in the restricted list Similarly if SET INSTANCE is used the connection identifier defined must match an entry in iSQLPlusConnectIdList or the connection is refused If no connection identifier is given or if the one given does not match an entry in iSQLPlusConnectIdList the database connection is refused and the following error occurs SP2 0884 Connection to database database name is not allowed Enabling DBA Access SYSDBA and SYSOPER privileged connections are not available to iSQL Plus users automatically but must be set up the system administrator To connect with SYSDBA or SYSOPER privileges or to generate the iSQL Plus Server Statistics report your username and password must be added to the iSQL Plus authentication file for the Oracle HTTP Server For example on Windows the authentication file is installed with no user entries at SORACLE HOME sqlplus admin iplusdba pw The username and password used in the authentication file are independent of the Oracle9i username and password LH SQL Plus Security 10 11 iSQL Plus S
333. iew Favorites Tools Help a ORACLE ISQL Plus DBA He Login Username system Password ecce Connection Identifier Privilege PASES a E Ei Done fit Local intranet Z Username Enter a valid username to connect to Oracle9i Password Enter a valid password for the username Your password is not displayed asterisks are displayed for each character entered in the password field Connection Identifier Leave this field blank to use the default Oracle database if one exists otherwise enter an Oracle Net connection identifier to specify a remote database you want to connect to You can use the full connection identifier for example DESCRIPTION ADDRESS PROTOCOL TCP HOST www oracle com PORT 1521 CONNECT DATA SERVICE NAME orashop us acme com You can optionally use INSTANCE NAME instance phrase in place of the SERVICE_NAME name phrase When connecting to an Oracle8 or earlier database you use the SID name phrase Alternatively you can use an Oracle Net alias If you use an Oracle Net alias it must be specified on the machine running the iSQL Plus Server which may not be the same machine from which you run your web browser iSQL Plus can be configured to restrict connections to specific databases If restricted database access has been enabled a dropdown list of available databases is displayed in place of the Connection Identifier text field This allows greater security for iSQL Plus Servers in hosted e
334. ifying Your Report with Spacing and Summary Lines on page 7 12 Refer to the following list for a description of each term or clause function Represents one of the functions listed in Table 13 2 If you specify more than one function use spaces to separate the functions COMPUTE command functions are always executed in the sequence AVG COUNT MINIMUM MAXIMUM NUMBER SUM STD VARI ANCE regardless of their order in the COMPUTE command Table 13 2 COMPUTE Functions Function Computes Applies to Datatypes AVG Average of non null values NUMBER COU NT Count of non null values all types MIN IMUM Minimum value NUMBER CHAR NCHAR VARCHAR2 VARCHAR NVARCHAR2 NCHAR VARYING MAX IMUM Maximum value NUMBER CHAR NCHAR VARCHAR2 VARCHAR NVARCHAR2 NCHAR VARYING NUM BER Count of rows all types 13 40 SQL Plus User s Guide and Reference COMPUTE Table 13 2 COMPUTE Functions Function Computes Applies to Datatypes SUM Sum of non null values NUMBER STD Standard deviation of non null NUMBER values VAR IANCE Variance of non null values NUMBER LAB EL text Defines the label to be printed for the computed value If no LABEL clause is used text defaults to the unabbreviated function keyword You must place single quotes around text containing spaces or punctuation The label prints left justified and truncates to the column width or line size whichever is smaller The maximum label length is 500 chara
335. ighlighted iSQL Plus Server is configured to start iSQL Plus in a browser and load MIS Reports sgl into the Input area of the iSQL Plus Server named Employee LA For information about configuring iSQL Plus Servers in the iSQL Plus Extension see iSQL Plus Extension for Windows Configuration on page 3 15 2 16 SQL Plus User s Guide and Reference 3 Configuring SQL Plus This chapter explains how to configure your SQL Plus command line and iSQL Plus environments It has the following topics a SQL Plus Configuration a iSQL Plus Configuration a iSQL Plus Extension for Windows Configuration Configuring SQL Plus 3 1 SQL Plus Configuration SQL Plus Configuration Site Profile User Profile You may wish to set up your SQL Plus environment in a particular way such as showing the current time as part of the SQL Plus command prompt and then reuse those settings with each session You can do this through two host operating system files the Site Profile for site wide settings and the User Profile for user specific settings The exact names of these files is system dependent see the Oracle installation and user s guide provided for your operating system for the precise name SQL Plus supports a global Site Profile a SQL Plus script created by the database administrator This file is generally named glogin sql SOL Plus executes this script whenever any user starts SQL Plus and SQL Plus establishes the Oracle connecti
336. ill be obsoleted in future releases of SQL Plus COPY supports the datatypes listed for the COPY command but no new datatypes will be supported SQL Plus COPY Command B 1 COPY Command Syntax COPY Command Syntax Syntax Terms COPY FROM database TO database FROM database TO database APPEND CREATE INSERT REPLACE destination table column column column USING query where database has the following syntax username password connect identifier Copies data from a query to a table in a local or remote database COPY supports the following datatypes CHAR DATE LONG NUMBER VARCHAR2 Refer to the following list for a description of each term or clause FROM database TO database database The database that contains the data to be copied If you omit the FROM clause the source defaults to the database to which SQL Plus is con nected that is the database that other commands address You must use a FROM clause to specify a source database other than the default The database containing the destination table If you omit the TO clause the destination defaults to the database to which SQL Plus is connected that is the database that other commands address You must use a TO clause to specify a destination database other than the default Specifies username password Gconnect identifier of the Oracle source or destination database you wish to COPY FROM or COPY TO If you do not specify pas
337. in iSQL Plus you must configure all three tiers The following example is for Japanese using the Unicode UTF 8 character set in Microsoft Windows To use the UTF 8 character encoding for Japanese Web Browser 1 Ensure you have a font available that supports the Unicode character set Microsoft Language Packs and updates are available for Windows operating systems to provide international language support at http windowsupdate microsoft com or you can find information about Asian language support for Windows at http www microsoft com windows ie features ime asp Netscape information about fonts and font downloads to support international language sets can be found at http home netscape com eng intl Change the character encoding in your web browser For Microsoft Internet Explorer 5 0 a Select Encoding from the View menu b Select Unicode UTF 8 For Netscape Navigator 4 7 a Select Character Set from the View menu b Click Unicode UTF 8 Set the fonts associated with the UTF 8 character encoding For Microsoft Internet Explorer Select Internet Options from the Tools menu b Select the General tab in the Internet Options dialog box and click Fonts c Choose a language script and the web page proportional font and plain text fixed width font to be used with it SQL Plus Globalization Support 12 3 Configuring Globalization Support in iSQL P lus d You can install fonts and support
338. ina BREAK command with the SKIP PAGE action The variable name can not contain a pound sign NEW VALUE is useful for master detail reports in which there is a new master record for each page For master detail reporting you must also include the column in the ORDER BY clause See the exam ple at the end of this command description For information on displaying a column value in the bottom title see COLUMN OLD VALUE For more information on referencing vari ables in titles see the TTITLE command later in this chapter For infor mation on formatting and valid format models see COLUMN FORMAT command NOPRI NT PRI NT NULIL text Controls the printing of the column the column heading and all the selected values NOPRINT turns off the screen output and printing of the column PRINT turns the printing of the column on Controls the text SOL Plus displays for null values in the given col umn The default is a white space SET NULL controls the text dis played for all null values for all columns unless overridden for a specific column by the NULL clause of the COLUMN command When a NULL value is SELECTed a variable s type will always become CHAR so the SET NULL text can be stored in it OLD V ALUE variable Specifies a variable to hold a column value You can reference the vari able in BTITLE commands Use OLD VALUE to display column values in the bottom title You must include the column in a BREAK com mand with t
339. ing SOL Plus script in a text editor and save it as employee sql in the cgi bin directory of your web server SELECT LAST NAME CITY SALARY FROM EMP DETAILS VIEW EXIT Start your web browser and enter the appropriate URL to open plus html 4 SQL Plus CGI Report Microsoft Internet Explorer ox Ele Edit View Favorites Tools Help SQL Plus CGI Report Username hr Password ren Connect string lora9i Report to run lemployee sql Reset Form Click Run It to execute the shell script plus pl which in turn starts SOL Plus and runs the employee sql script The query results are displayed directly in your web browser N Employee List _ Oy x File Edit View Search Go Bookmarks Tasks Help King Seattle Kochhar Seattle De Haan Seattle Russell Oxford Partners Oxford Hartstein Toronto 6 rows selected sa Teche Fune Interact Generating HTML Reports from SQL Plus 8 11 Creating Reports using Command line SQL P lus Suppressing the Display of SQL Plus Commands in Reports The SQLPLUS SILENT option is particularly useful when used in combination with MARKUP to generate embedded SQL Plus reports using CGI scripts or operating system scripts It suppresses the display of SQL Plus commands and the SQL Plus banner The HTML output shows only the data resulting from your SQL query You can also use SET ECHO OFF to suppress t
340. ing script named PRINTRPT SELECT DEPARTMENT ID CITY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 EMPRPT SQL WKRPT SOL When you START PRINTRPT and it reaches the command it looks for the script named EMPRPT in the current working directory and runs it When PRINTRPT reaches the command it looks for the script named WKRPT in the same path as PRINTRPT and runs it Suppose that the same script PRINTRPT was located on a web server and you ran it with START HTTP machine_name domain port PRINTRPT When it reaches the command it looks for the script named EMPRPT in the current local working directory and runs it When PRINTRPT reaches the command it looks for the script named WKRPT in the same url as PRINTRPT HTTP machine_ name domain port WKRPT SQL and runs it 13 8 SQL Plus User s Guide and Reference slash slash Syntax Usage Examples n l slash Executes the SOL command or PL SQL block currently stored in the SOL buffer You can enter a slash at the command prompt or at a line number prompt of a multi line command The slash command functions similarly to RUN but does not list the command in the buffer on your screen Executing a SOL command or PL SQL block using the slash command will not cause the current line number in the SQL buffer to change unless the command in the buffer contains an error In that case SQL Plus changes the current line number to the number of
341. ing the size of the command or statement or by recoding the query to select fewer records SQL Plus Error Messages 14 13 SQL Plus Error Messages SP2 0267 option_name option parameter_number out of range lower_range through upper_range Cause A value for a parameter was out of the specified range Action Check the limits of the parameter and enter a value that is within the range SP2 0268 option_name option not a valid number Cause Non numeric value integer was entered for a parameter Action Enter a valid numeric value integer SP2 0270 unknown flag in afiset number ignored Cause An unknown error occurred in the SET command Action Make a note of the message then contact Oracle Support Services SP2 0271 variable_name is not a buffer variable Cause The specified variable was not defined as a buffer Action Make sure that the buffer variable name is correct and try again SP2 0272 character_name character cannot be alphanumeric or white space Cause The specified character in the SET command cannot be alphanumeric or white space Action Check the syntax of the command you used for the correct options SP2 0277 entered_value value not valid Cause The value entered was incorrect Action Re enter with a valid value SP2 0281 option_name missing set option Usage SET SHIFT INOUT VIS IBLE INV ISIBLE SET MARKUP HTML ON OFF HEAD text BODY text TABLE text ENTMAP ON OFF SPOOL ON O
342. injisalplus gt gt lt lt host gt gt lt lt username password connect_identiier gt gt V Required field Add Remove File Association fe WINNT System32 Notepad exe 1 Browse Language English v OK Close URL Enter a valid iSQL Plus Server URL in the form http host domain isqlplus This field is mandatory Name Enter a name for this iSQL Plus Server The name if entered is used in the context menu otherwise the full iSQL Plus Server URL is used Connect String Enter a connect string to specify your username and password and the database you want to connect to If you omit a username and password you are 3 16 SQL Plus User s Guide and Reference iSQL P lus Extension for Windows Configuration prompted for them when iSQL Plus starts If you omit a database connection identifier or Oracle Net alias you are connected to the default database Execute Clear the Execute checkbox to change the action performed on the selected file The default action is Execute the alternative is Load Execute runs the selected file in the iSQL Plus Server and displays the results in your browser Load opens the iSQL Plus Server and loads the selected file into the Input area Add Click Add to add a new iSQL Plus Server Remove Click Remove to delete a selected iSQL Plus Server definition File Association Enter a path and arguments for the application you want to associate with the SQL file extension w
343. ion Getting Help To run a host operating system command enter the SOL Plus command HOST followed by the host operating system command For example this SOL Plus command runs a host command DIRECTORY SOL HOST DIRECTORY SQL When the host command finishes running the SOL Plus command prompt appears again Note Operating system commands entered from a SQL Plus session using the HOST command do not effect the current SQL Plus session For example setting an operating system environment variable does not effect the current SOL Plus session but may effect SQL Plus sessions started subsequently You can suppress access to the HOST command For more information about suppressing the HOST command see Chapter 10 SQL Plus Security While you use SQL Plus you may find that you need to list column definitions for a table or start and stop the display that scrolls by You may also need to interpret error messages you receive when you enter a command incorrectly or when there is a problem with Oracle or SOL Plus The following sections describe how to get help for those situations Listing a Table Definition To see the definitions of each column in a given table or view use the SOL Plus DESCRIBE command Example 5 4 Using the DESCRIBE Command To list the column definitions of the columns in the sample view EMP DETAILS VIEW enter DESCRIBE EMP DETAILS VIEW EMPLOYEE ID NOT NULL NUMBER 6
344. ion QRY enter QWKRPT QRY You can run a script named YEAREND specified by a URL and pass values to variables referenced in YEAREND in the usual way HTTP machine_name domain port YEAREND SQL VAL1 VAL2 QFTP machine name domain port YEAREND SQL VAL1 VAL2 On a web server configured to serve SQL reports you could request SQL Plus to execute a dynamic script by using QHTTP machine name domain port SCRIPTSERVER ENDOFYEAR VALI VAL2 13 6 SQL Plus User s Guide and Reference double at sign double at sign Syntax Terms Usage urtl file_namel ext Runs a script This command is almost identical to the at sign command It is useful for running nested scripts because it has the additional functionality of looking for the specified script in the same path or url as the script from which it was called Only the url form is supported in iSQL Plus Refer to the following for a description of the term or clause Specifies the Uniform Resource Locator of a script to run on the speci fied web server SOL Plus supports HTTP and FIP protocols file name ext Represents the nested script you wish to run If you omit ext SOL Plus assumes the default command file extension normally SQL For infor mation on changing the default extension see the SUFFIX variable of the SET command on page 13 121 When you enter file_name ext from within a script SQL Plus runs file name ext from the same d
345. ion on the middle tier You can a Test the Oracle HTTP Server Configuration File Start and Stop the Oracle HTTP Server a Enable or Disable iSQL Plus Additional iSQL Plus configuration information must be included in the Oracle HTTP Server configuration file httpd conf for the iSQL Plus Server There are two layers of nested configuration files a httpd conf includes the Oracle9i configuration file oracle apache conf a Oracle apache conf includes the iSQL Plus configuration file isglplus conf Changes are usually only made to a isglplus conf to configure the iSQL Plus Server Oracle apache conf to disable iSQL Plus After making changes to conf files check them to make sure there are no errors and then stop and start the Oracle HTTP Server to implement the changes Testing the Oracle HTTP Server Configuration File To check the Oracle HTTP Server configuration file httpd conf and any included configuration files for errors On Windows do the following steps 1 Opena Windows Command Prompt 2 Change directory to the Oracle HTTP Server home directory by entering cd SORACLE_HOME Apache Apache conf 3 Parse the Oracle HTTP Server httpd conf configuration file by entering apache t Any errors in the configuration file are displayed If there are any errors edit the included configuration files oracle apache conf or isglplus conf again to correct them and then test again If there are no errors the message Sy
346. ipts must be available through HTTP HTTPS or FTP or passed to iSQL Plus as a URL variable iSQL Plus executes the script and returns the results in a web browser window or loads the script into the Work screen You can invoke iSQL Plus as a normal user or with SYSDBA or SYSOPER privileges You can also invoke iSQL Plus to generate a report on iSQL Plus Server settings and statistics The syntax to enter in your web browser s Location Address field to invoke iSQL Plus as a normal user is http machine name domain port isqlplus UserOpts or to invoke iSQL Plus with SYSDBA or SYSOPER privileges use http machine name domain port isqlplusdba DBAOpts or to invoke iSQL Plus to generate the SQL Plus Server statistics report use http machine name domain port isqlplusdba Statistics where machine name domain is the URL of the Oracle HTTP Server Starting SQL Plus 4 15 Starting iSQL Plus from a URL port is the number of the port used by the Oracle HTTP Server UserOpts is UserLogin Script UserLogin amp Script DBAOpts is DBALogin Script DBALogin amp Script Statistics is statistics active full amp refresh number and UserLogin is userid username password connect_identifier DBALogin is userid username password connect_identifier AS SYSDBA SYSOPER Script is script text amp type url text amp action execute load amp variable value If there
347. irectory as the script When you enter file_name ext interactively SOL Plus runs file name ext from the current working directory or from the same url as the script from which it was called If SQL Plus does not find such a file SQL Plus searches a system dependent path to find the file Some oper ating systems may not support the path search See the Oracle installa tion and user s manual provided for your operating system for specific information related to your operating system environment All previous settings like COLUMN command settings stay in effect when the script starts If the script changes any setting then this new value stays in effect after the script has finished You can include in a script any command you would normally enter interactively typically SOL or SOL Plus commands SQL Plus Command Reference 13 7 double at sign Examples An EXIT or QUIT command used in a script terminates SQL Plus The command functions similarly to START If the START command is disabled see Disabling SOL Plus SOL and PL SQL Commands on page 10 4 this will also disable the command For more information see the SPOOL command on page 13 131 SQL Plus removes the SQLTERMINATOR a semicolon by default before the command is issued A workaround for this is to add another SOLTERMINATOR See the SOLTERMINATOR variable of the SET command on page 13 121 for more information Suppose that you have the follow
348. is no userid URL parameter or if it has incomplete information iSQL Plus displays the login screen If the URL parameter is complete and the login information is valid iSQL Plus connects and continues with the request SQL script parameters can be given in any order If any script parameter begins with a reserved keyword such as script or userid iSQL Plus may interpret it as a command rather than as a literal parameter If the URL parameter type is url or if it is not specified the script parameter is assumed to be the URL of a SQL script If the URL parameter type is text the text in the script parameter is assumed to be the contents of the SOL script itself There may be HTML character set restrictions on scripts passed using this method If the URL parameter action is execute or if it is not specified the SOL script is executed in iSQL Plus If the URL parameter action is load the script is loaded into the Input area of the Work screen but it is not executed A web browser may not be able to display large scripts in the Work screen and as a result scripts may be truncated See iSQL Plus Server Statistics on page 2 12 for an explanation of the Statistics syntax and functionality 4 16 SQL Plus User s Guide and Reference Login Username and Password Examples To log into iSQL Plus with the username hr and password your_password enter http machine name domain isqlplus userid hr your password To execute a script t
349. is requested users are not only required to enter their Oracle9i username and password but they are also prompted to enter an Oracle HTTP Server authentication username and password Enabling or Disabling Restricted Database Access You may want to limit the databases that users can access in iSQL Plus to a restricted list When restricted database access has been enabled a dropdown list of available databases is displayed in place of the Connection Identifier text field on the Login screen This allows greater security for iSQOL Plus Servers in hosted environments Connection identifiers are listed in the order defined in iSQLPlusConnectIdList 10 10 SQL Plus User s Guide and Reference iSQL Plus Security You can edit the isglplus conf file to enforce restricted database access by changing the following line FastCgiServer initial env iSQLPlusConnectIdList SID1 SID2 where SIDI SID2 is a comma separated list of Oracle Net connection identifiers specifying permitted databases For example FastCgiServer initial env iSQLPlusConnectIdList ABC1 PROD2 DEV3 For information about editing the isqlplus conf file see Session Integrity on page 3 7 While no quotes or embedded whitespace is allowed in a connection identifier quotes are required around the entire iSQLPlusConnectIdList argument as shown Connection identifiers are case insensitive and each connection identifier listed in the argument should be
350. ish to connect to Ora cle If you omit username and password SQL Plus prompts you for them If you enter a slash or simply enter Return to the prompt for user name SQL Plus logs you in using a default logon see slash If you omit only password SQL Plus prompts you for password When prompting SQL Plus does not display password on your terminal screen See the PASSWORD command for information about changing your password in SQL Plus and see Changing your Password on page 4 18 for information about changing passwords in iSQL Plus connect identifier slash An Oracle Net connect identifier The exact syntax depends on the Ora cle Net communications protocol your Oracle installation uses For more information refer to the Oracle Net manual for your protocol or contact your DBA SQL Plus does not prompt for a service name but uses your default database if you do not include a connect identifier Represents a default logon using operating system authentication You cannot enter a connect_identifier if you use a default logon In a default logon SQL Plus typically attempts to log you in using the username OPS name where name is your operating system username See the 13 46 SQL Plus User s Guide and Reference CONNECT Usage Examples a Oracle9i Database Administrator s Guide for information about operating system authentication AS SYSOPER SYSDBA The AS clause allows privileged connections by
351. ist SID1 SID2 where SIDI SID2 is a comma separated list of Oracle Net connection identifiers specifying permitted databases For example FastCgiServer initial env iSQLPlusConnectIdList ABC1 PROD2 DEV3 Note the use of quotes in the example The opening quote must occur before the iSQLPlusConnectIdList parameter name the closing quote at the end of the list of SIDs For more information about restricted database access see Enabling or Disabling Restricted Database Access on page 10 10 Setting the SQL Plus Idle Timeout The FastCGI timeout parameter or idle timeout is the time the Oracle HTTP Server waits for results from iSQL Plus It is set to a value likely to prevent iSQL Plus timing out before the web browser It is sufficient for many long queries to return results before iSQL Plus times out 3 10 SQL Plus User s Guide and Reference iSQL Plus Configuration The idle timeout should not be confused with the iSQLPlusTimeOut Interval which manages the lifetime of a user s session You can edit the iSQL Plus configuration file isglplus conf to change the idle timeout value The syntax of the line to change in the configuration file is FastCgiServer initial env idle timeout n Where n is the number of seconds of the Oracle HTTP Server waits for results from iSQL Plus The default value is 3600 seconds Changing the Cascading Style Sheet iSQL Plus uses a cascading style sheet to control the format o
352. isting current in buffer 6 5 saving current 13 93 setting character used to end and run 13 98 13 121 SQL Plus abbreviations 5 8 command summary 13 2 continuing on additional lines 5 9 13 1 editing at command prompt 6 4 ending 5 10 13 1 entering and executing 5 8 entering during SOL command entry 13 120 obsolete command alternatives C 2 SQL continuing on additional lines 5 5 stopping while running 5 12 tabs 5 2 types of 5 2 variables that affect running 5 10 writing interactive 6 17 comments including in scripts 6 10 13 86 C 2 using to create 6 11 using to create 6 10 using REMARK to create 6 10 13 86 C 2 COMMIT clause 13 64 WHENEVER OSERROR 13 152 WHENEVER SQLERROR 13 154 COMMIT command 5 11 communication between tiers 1 4 1 5 COMPATIBILITY variable 13 96 13 104 Index 6 COMPUTE command 7 12 13 40 AVG function 7 17 computing a summary on different columns 7 20 COUNT function 7 17 LABEL clause 7 17 7 20 13 41 listing all definitions 7 22 13 42 MAXIMUM function 7 17 maximum LABEL length 13 41 MINIMUM function 7 17 NUMBER function 7 17 OF clause 7 16 ON column clause 7 16 13 41 ON expr clause 13 41 ON REPORT clause 7 20 13 41 ON ROW clause 13 41 printing grand and sub summaries 7 20 printing multiple summaries on same column 7 21 printing summary lines at ends of reports 7 20 printing summary lines on a break 7 16 referencing a SELECT expression in
353. ith the COPY command SET DEFINE amp cJONJOFF 13 105 Sets the character used to prefix substitution variables to a SET DESCRIBE DEPTH Q L nALLJ LINENUM X 13 106 Sets the depth of the level to which you can recursively ONJOFFJIINDENT ON OFF describe an object SET ECHO QNJOFF 13 107 Controls whether the START command lists each command in a script as the command is executed SET EDITFILE file name ext 13 107 Sets the default filename for the EDIT command SET EMBEDDED ON OFF 13 107 Controls where on a page each report begins SET ESCAPE 4JcJONJOFF 13 108 Defines the character you enter as the escape character SET FEEDBACK 6 n ON OFF 13 108 Displays the number of records returned by a query 13 96 SQL Plus User s Guide and Reference when a query selects at least n records SET System Variable Page Description SET FLAGGER OFF ENTRY 13 108 Checks to make sure that SOL statements conform to the INTERMEDIATE FULL ANSI ISO SQL92 standard SET FLUSH ONJOFF 13 109 Controls when output is sent to the user s display device SET HEADING ON OFF 13 109 Controls printing of column headings in reports SET HEADSEP c ON OFF 13 110 Defines the character you enter as the heading separator character SET INSTANCE instance path LO CAL 13 110 Changes the default instance for your session to the specified instance path SET LINESIZE 80 n 13 111 Sets the total number of characters that SOL Plus displays on one
354. l set maximum width for LONG to 777 SET LONG 777 This comment is illegal SET LONG 777 set maximum width for LONG to 777 If you enter the following SQL Plus command SQL Plus interprets it as a comment and does not execute the command SET LONG 777 Notes on Placing Comments SQL Plus generally does not parse or execute input it identifies as a comment SQL Plus does not have a SOL or PL SQL command parser It scans the first few keywords of each new statement to determine the command type SOL PL SQL or SQL Plus Comments in some locations can prevent SQL Plus from correctly identifying the command type giving unexpected results The following usage notes may help you to use SQL Plus comments more effectively Using Scripts in SQL Plus 6 11 Placing Comments in Scripts E Do not put comments within the first few keywords of a statement For example CREATE OR REPLACE 2 HELLO 3 PROCEDURE HELLO AS 4 BEGIN 5 DBMS OUTPUT PUT LINE HELLO Warning Procedure created with compilation errors The location of the comment prevents SOL Plus from recognizing the command as a PL SQL command SQL Plus submits the block to the server when it sees the slash at the beginning of the comment which it interprets as the statement terminator Move the comment to avoid this error For example CREATE OR REPLACE PROCEDURE 2 HELLO 3 HELLO AS 4 BEGIN 5 DBMS OUTPUT PUT LINE HEL
355. l HTML tags to the spool file when you issue the SPOOL filename command The tags written and their default content are lt HTML gt lt HEAD gt lt TITLE gt SQL Plus Report lt TITLE gt lt META name generator content SQL Plus 9 0 1 gt lt HEAD gt lt BODY gt When you issue any of the SQL Plus commands EXIT SPOOL OFF or SPOOL filename SQL Plus appends the following end tags and closes the file lt BODY gt lt HTML gt You can specify lt HEAD gt tag contents and lt BODY gt attributes using the HEAD and BODY options PRE FORMAT ON OFF PREFORMAT ON or OFF specifies whether or not SQL Plus writes out put to the lt PRE gt tag or to an HTML table The default is OFF so out put is written to a HTML table by default You can turn PREFORMAT ON and OFF as required during a session Notes To produce report output using the HTML lt PRE gt tag you must set PREFORMAT ON For example SQLPLUS M HTML ON PREFORMAT ON SET MARKUP HTML ON PREFORMAT ON 4 8 SQL Plus User s Guide and Reference The SQLPLUS Command MARKUP Usage Notes Existing scripts that do not explicitly set PREFORMAT ON will generate output in HTML tables If you want output in HTML lt PRE gt tags you must set PREFORMAT ON Some SQL Plus commands have different behavior when output is directed to an HTML table Commands originally intended to format paper reports may have different meaning for reports intended for
356. last two examples your default schema becomes SYS SQL Plus Command Reference 13 47 COPY COPY The COPY command is not being enhanced to handle datatypes or features introduced with or after Oracle8 The COPY command is likely to be made obsolete in a future release For COPY command details and syntax see Appendix B SQL Plus COPY Command 13 48 SQL Plus User s Guide and Reference DEFINE DEFINE Syntax Terms Usage DEF INE variable variable text Specifies a user variable and assigns a CHAR value to it or lists the value and variable type of a single variable or all variables Refer to the following list for a description of each term or clause variable Represents the user variable whose value you wish to assign or list text Represents the CHAR value you wish to assign to variable Enclose text in single quotes if it contains punctuation or blanks variable text Defines names a user variable and assigns it a CHAR value Enter DEFINE followed by variable to list the value and type of variable Enter DEFINE with no clauses to list the values and types of all user variables Defined variables retain their values until one of the following events occurs a you enter a new DEFINE command referencing the variable you enter an UNDEFINE command referencing the variable you enter an ACCEPT command referencing the variable a you reference the variable in the NEW_VALUE or OLD VALUE clause o
357. lause VARIABLE command 13 146 VARCHAR columns changing format 7 6 13 31 default format 7 6 VARIABLE command 13 145 CHAR clause 13 145 CLOB clause 13 146 NCHAR clause 13 145 NCLOB clause 13 146 NUMBER clause 13 145 REFCURSOR clause 13 147 VARCHAR clause 13 146 variable clause 13 145 variables bind variables 6 31 substitution 6 24 substitution variables 6 18 system variables 5 10 user variables 13 49 VARIANCE function 7 17 VERIFY clause 6 19 VERIFY variable 6 23 13 99 13 123 W WARNING clause 13 64 web browser 1 4 2 3 8 2 web outputting reports 8 2 WHENEVER OSERROR command 13 152 COMMIIT clause 13 152 CONTINUE clause 13 152 EXIT clause 13 152 NONE clause 13 153 ROLLBACK clause 13 152 WHENEVER SQLERROR command 6 17 13 154 COMMIT clause 13 154 CONTINUE clause 13 154 EXIT clause 13 154 NONE clause 13 155 ROLLBACK clause 13 154 window output 2 9 windows iSQL Plus extension 2 16 WORD WRAPPED clause 7 7 7 10 13 36 Work screen 2 5 output options 2 9 WRAP variable 7 7 13 99 13 123 WRAPPED clause 7 7 13 36 X XMLType column definition from DESCRIBE 13 53 column formatting 7 8 column width 7 6 creating 7 8 formatting in reports 7 6 inserting values 7 8 selecting data 7 8 setting column retrieval size 13 112 setting maximum column width 13 112 Index 23 Index 24
358. led Adding MIME Types Some web browsers may require you to either remove a MIME type definition or application association for files with a SQL extension or to create a MIME type or application association for files with a SQL extension in order to load scripts into iSQL Plus Some browsers may require you to set up a MIME type to be able to save scripts to your local machine If iSQL Plus opens a new window when you click Save Script on the Work screen instead of prompting you to enter a filename to save the script then set up a MIME type application vnd oracle isglplus script and configure it to allow you to save to disk Also add application vnd oracle isqlplus output to allow you to use the Save to file option accessed through the Interface Options screen of iSQL Plus For example to set up an application association for files with a SOL extension in Netscape Navigator 4 7 for Windows NT 1 Select Preferences from the Edit menu 2 Select Applications from the Navigator menu tree 3 Click the New Type button On the displayed form enter Description of type SQL files File extension SOL MIME type text plain Application to use notepad exe Configuring SQL Plus 3 5 iSQL Plus Configuration Uncheck the use this MIME as the outgoing default for this extension If this is not set up in your web browser you may get an error when you try to load scripts that iSQL Plus cannot identify as text files Adding
359. lename then replaces each amp 2 with the second value and so forth For example you could include the following commands in a script called MYFILE SELECT FROM EMP DETAILS VIEW WHERE JOB ID amp 1 AND SALARY amp 2 In the following START command SQL Plus would substitute CLERK for amp 1 and 7900 for amp 2 in the script MYFILE START MYFILE PU CLERK 3100 When you use arguments with the START command SQL Plus DEFINEs each parameter in the script with the value of the appropriate argument Example 6 13 Passing Parameters through START To create a new script based on SALES that takes a parameter specifying the job to be displayed enter GET SALES 1 COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 COLUMN COMMISSION PCT HEADING COMMISSION FORMAT 90 90 SELECT LAST NAME SALARY COMMISSION PCT FROM EMP DETAILS VIEW WHERE JOB ID SA MAN Oo owe W h2 6 6 WHERE JOB ID SA MAN CHANGE SA MAN amp 1 6 WHERE JOB ID amp 1 SAVE ONEJOB Created file ONEJOB Now run the command with the parameter SA MAN START ONEJOB SA MAN 6 26 SQL Plus User s Guide and Reference Writing Interactive Commands E SQL Plus lists the line of the SOL command that contains the parameter before and after replacing the parameter with its value and then displays the output old 3 WHERE JOB_ID amp 1 new 3 WHERE JOB ID SA MAN LAST NAME MONTHLY SA
360. length units of variable Cause The length of the bind variable datatype was exceeded Action Reduce the length of the bind variable datatype 14 30 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0678 Column or attribute type can not be displayed by SOL Plus Cause The type specified is not supported Action Rewrite the query to select the data with types that SOL Plus supports SP2 0685 The date entered variable is invalid or format mismatched format Cause An invalid date was entered or does not match the format Action Enter a valid date or a date in the required format SP2 0686 Usage DESCRIBE schema object Gdb link Cause An invalid option was used in the DESCRIBE command Action Check the syntax of the DESCRIBE command for the correct options SP2 0691 Expected SYSDBA or SYSOPER not command name Cause Attempted to use the CONNECT AS syntax and specified something other than SYSDBA or SYSOPER Action Correct the syntax and issue the CONNECT command again SP2 0692 Usage CONNIECT login AS SYSDBA SYSOPER Where login username password Q connect string Cause An invalid option was entered for the SQL Plus CONNECT command Action Check the syntax for the CONNECT command for the correct usage SP2 0714 Invalid combination of STARTUP options Cause The specified options of the STARTUP command cannot be used simultaneously Action Check the syntax of the S
361. listing definitions 5 14 mode in SQL Plus 5 6 within SOL commands 5 6 PLUSTRACE role 9 2 PLUSTRACE creating role 9 3 PNO clause 13 126 pound sign 13 34 Preferences screen 2 8 PREFORMAT 4 8 PREFORMAT clause 4 8 PRINT clause 13 35 PRINT command 13 77 printing bind variables automatically 13 101 REFCURSOR variables 13 147 SPOOL command 13 131 privileges list 2 11 Product User Profile table 10 13 PRODUCT_USER_PROFILE table 10 2 prompt SET SOLPROMPT 13 98 13 120 PROMPT clause 6 28 13 11 PROMPT command 6 27 13 78 customizing prompts for value 6 29 prompts for value bypassing with parameters 6 26 customizing 6 29 through ACCEPT 6 27 through substitution variables 6 19 proxy server exceptions configuration 3 6 Microsoft Internet Explorer 3 6 Netscape Navigator 3 6 PUPBLD SQL 10 2 Q queries in COPY command B 3 B 6 show number of records retrieved 5 4 13 96 13 108 queries tracing 9 7 query execution path including in report 13 102 query results displaying on screen 5 4 sending to a printer 7 35 13 131 storing ina file 7 34 13 131 QUIT command 13 64 See also EXIT R RAW column definition from DESCRIBE 13 53 record separators printing 7 10 13 98 13 115 RECOVER clause 13 135 RECOVER command 13 79 and database recovery 11 5 AUTOMATIC clause 13 80 CANCEL clause 13 81 13 83 CONTINUE clause 13 80 DATABASE clause 13 81 FROM clause 13 80 Index
362. ll not affect queries you run in a given file Computing Summary Lines when a Break Column s Value Changes If you organize the rows of a report into subsets with the BREAK command you can perform various computations on the rows in each subset You do this with the functions of the SOL Plus COMPUTE command Use the BREAK and COMPUTE commands together in the following forms BREAK ON break_column COMPUTE function LABEL label_name OF column column column ON break column You can include multiple break columns and actions such as skipping lines in the BREAK command as long as the column you name after ON in the COMPUTE command also appears after ON in the BREAK command To include multiple break columns and actions in BREAK when using it in conjunction with COMPUTE use these commands in the following forms BREAK ON break column 1 SKIP PAGE ON break column 2 SKIP 1 COMPUTE function LABEL label name OF column column column ON break column 2 The COMPUTE command has no effect without a corresponding BREAK command You can COMPUTE on NUMBER columns and in certain cases on all types of columns For more information about the COMPUTE command see Chapter 13 SOL Plus Command Reference 7 16 SQL Plus User s Guide and Reference Clarifying Your Report with Spacing and Summary Lines The following table lists compute functions and their effects Table 7 1 Compute Functions Function Effect SUM Computes the sum of the valu
363. low the variable or parameter by default the period For more information about system variables see the SET command on page 13 95 Using Scripts in SQL Plus 6 23 Writing Interactive Commands Substitution Variables in iSQL Plus System variables specified with the SET command can affect iSOQL Plus behavior SET DEFINE SET ESCAPE SET VERIFY ON and SET CONCAT affect variable substitution behavior and should be set in iSQL Plus before attempting to execute a script For further information about these SET options see the SET command on page 13 95 iSQL Plus preprocesses a script for amp and amp amp variables and prompts the user for their values before sending the script to the SQL Plus engine for execution You should synchronize variable substitution with one of the two following options Enter SET DEFINE ON to set iSQL Plus to always prompt for substitution variables before running any further scripts Click the Execute button to execute the command Enter your script using amp and amp amp as the prefix for variables Do not use DEFINE or UNDEFINE Click the Execute button to execute the script iSQL Plus prompts you for values for all the substitution variables in your script At the end of script execution any double ampersand values contained in the script remain defined This means that you will not be prompted to enter values for these variables again until they have been undefined or you log o
364. lowed by a number format such as 99 999 sets the default format for displaying numbers in query results SET PAGESIZE Followed by a number sets the number of lines per page SET PAUSE Followed by ON causes SQL Plus to pause at the beginning of each page of output SQL Plus continues scrolling after you enter Return Followed by text sets the text to be displayed each time SQL Plus pauses you must also set PAUSE to ON SET SQLPROMPT Followed by the connect information variable in the form SET SOLPROMPT amp CONNECT IDENTIFIER gt changes the SOL Plus command line prompt to display the SID of the database you are connected to SET TIME Followed by ON displays the current time before each command prompt See the SET command on page 13 95 for more information on these and other SET command variables you may wish to set in your SQL Plus LOGIN file Storing and Restoring SQL Plus System Variables You can store the current SQL Plus system SET variables in a host operating system file a script with the STORE command If you alter any variables this script can be run to restore the original values This is useful if you want to reset system variables after running a report that alters them To store the current setting of all system variables enter STORE SET file name By default SOL Plus adds the extension SQL to the file name If you want to use a different file extension type a period at the end of the file
365. lusdba statistics active full amp refresh number where machine name domain is the URL of the Oracle HTTP Server for which you want to generate iSQL Plus Server statistics where port is the port number used by the iSQL Plus Server 2 12 SQL Plus User s Guide and Reference iSQL P lus User Interface where statistics active full specifies the level of detail to report where full gives all possible statistics and is the default active gives dynamically changing session statistics for the SQL Plus Server These statistics are also included at the end of the full report where amp refresh number optionally specifies the time in seconds before the statistics report is automatically refreshed The minimum value is 10 seconds You must have Oracle HTTP Server authentication to access the iSQL Plus DBA URL but as there is no connection to a database no Oracle9i login is required The iSQL Plus Server statistics report has the following sections Server Details This section displays the following information about the iSQL Plus Server a Host name a Host address Oracle HTTP Server port a Host system a iSQL Plus Server start time a iSQL Plus version a iSQL Plus logfile Server Environment This section shows settings for iSQL Plus Server environment variables a ORACLE HOME a ORACLE SID a INS ADMIN a NLS LANG a NLS NCHAR SQL Plus User Interface 2 13 iSQL Plus User Interface Configuration P
366. ly committed or rolled back by the user truncate To discard or lose one or more characters from the beginning or end of a value whether intentionally or unintentionally type A column contains information in one of four types character date number or long The operations users can perform on the contents of a column depend on the type of information it contains See also format USERID A command line argument that allows you to specify your Oracle username and password with an optional Oracle Net address username The name by which a user is known to the Oracle database server and to other users Every username is associated with a private password and both must be entered to connect to an Oracle database See also account user variable A variable defined and set by you explicitly with the DEFINE command or implicitly with an argument to the START command Glossary 25 Glossary 26 VARCHAR An Oracle Corporation datatype Specifically this datatype functions identically to the Oracle VARCHAR datatype see definition below However Oracle Corporation recommends that you use VARCHAR instead of VARCHAR because Oracle Corporation may change the functionality of VARCHAR in the future VARCHAR2 An Oracle Corporation datatype Specifically it is a variable length alpha numeric string with a maximum length of 4000 bytes If data entered for a column of type VARCHAR is less than 4000 bytes no spaces will be padded the
367. ly consider security on your server before embedding login information in a script file or using a CGI script to prompt for login information and pass it into the SOLPLUS command Consider setting initial conditions rather than assuming default values For example explicitly set ENTMAP ON even thought its default is ON Create an HTML file containing the following script and save it as plus html Generating HTML Reports from SQL Plus 8 7 Creating Reports using Command line SQL P lus lt html gt lt head gt lt title gt SQL Plus CGI Report lt title gt lt head gt lt body bgcolor ffffff gt lt hl gt SQL Plus CGI Report lt h1 gt lt Change the URL here On Windows NT you may need to use http machine_name domain port cgi bin perl plus pl if your web server is not configured to identify the script as a Perl program gt lt form method post action http machine name domain port cgi bin plus pl table border 0 summary gt lt tr gt lt td gt Username lt td gt lt td gt lt input type text name username size 10 align left gt lt td gt lt tr gt lt tr gt lt td gt Password lt td gt lt td gt lt input type password name password size 10 align left gt lt td gt lt tr gt lt tr gt lt td gt Connect string lt td gt lt td gt lt input type text name db size 10 align left gt lt td gt lt tr gt lt tr gt lt td gt Report to run lt td g
368. m different tables a COL UMN command for that column name will apply to both columns That is a COLUMN command for the column LAST NAME applies to all columns named LAST NAME that you reference in this session COL UMN ignores table name prefixes in SELECT commands Also spaces are ignored unless the name is placed in double quotes To format the columns differently assign a unique alias to each column within the SELECT command itself do not use the ALIAS clause of the COLUMN command and enter a COLUMN command for each col umn s alias Assigns a specified alias to a column which can be used to refer to the column in BREAK COMPUTE and other COLUMN commands Resets the display attributes for the column to default values To reset the attributes for all columns use the CLEAR COLUMNS com mand CLEAR COLUMNS also clears the ATTRIBUTEs for that col umn ENTMAP ONJOFF Allows entity mapping to be turned on or off for selected columns in HTML output This feature allows you to include for example HTML hyperlinks in a column of data while still mapping entities in other col umns of the same report By turning entity mapping off for a column containing HTML hyperlinks the HTML anchor tag delimiters lt gt and amp are correctly interpreted in the report Otherwise they would be replaced with their respective entities amp lt amp gt amp quot and amp amp preventing web browsers from correctly interpreting the
369. manages the server portion must be optimized for its duties session The time after a username connects to an Oracle database and before disconnecting and the events that happen in that time SET command variable See system variable SGA See also System Global Area SGA spooling Sending or saving output to a disk storage area Often used in order to print or transfer files The SQL Plus SPOOL command controls spooling Glossary 21 Glossary 22 SQL Structured Query Language The internationally accepted standard for relational systems covering not only query but also data definition manipulation security and some aspects of referential integrity See also Data Manipulation Language DML Data Definition Language DDL and Data Control Language DCL SQL buffer The default buffer containing your most recently entered SQL command or PL SQL block SQL Plus commands are not stored in the SOL buffer SQL command See SOL statement SQL script A file containing SQL statements that you can run in SQL Plus to perform database administration quickly and easily SQL statement A complete command or statement written in the SOL language Synonymous with statement SOL SQL Loader An Oracle tool used to load data from operating system files into Oracle database tables SQL Net Net8 s precursor An Oracle product that works with the Oracle Server and enables two or more computers that run the Oracle RDBMS or
370. mand ca HOW PAGESIZE HOW NEWPAGE HOW LINESIZE ca ca Through the SQL Plus command SPOOL you can store your query results in a file or print them on your computer s default printer Storing and Printing Query Results Send your query results to a file when you want to edit them with a word processor before printing or include them in a letter memo or other document To store the results of a query in a file and still display them on the screen enter the SPOOL command in the following form SPOOL file name If you do not follow the filename with a period and an extension SPOOL adds a default file extension to the filename to identify it as an output file The default varies with the host operating system on most hosts it is LST or LIS See the Oracle Formatting SQL Plus Reports 7 33 Storing and Printing Query Results installation and user s manual s provided for your operating system for more information SQL Plus continues to spool information to the file until you turn spooling off using the following form of SPOOL SPOOL OFF Creating a Flat File When moving data between different software products it is sometimes necessary to use a flat file an operating system file with no escape characters headings or extra characters embedded For example if you do not have Oracle Net you need to create a flat file for use with SQL Loader when moving data from Oracle8 to Oracle9i To create a
371. mand SPACE variable C 2 C 6 SET command TRUNCATE variable C 2 C 7 SHOW command LABEL variable C 2 C 7 TTITLE command old form C 7 OF clause 7 16 OFF clause 13 36 in ATTRIBUTE command 13 17 in COLUMN command 7 10 13 36 in REPFOOTER commands 13 90 in REPHEADER commands 13 90 in SPOOL command 7 24 13 131 in TTITLE and BTITLE commands 7 29 13 141 old password field 4 19 OLD VALUE clause 7 30 13 35 ON clause in ATTRIBUTE command 13 17 in COLUMN command 7 10 13 36 in TTITLE and BTITLE commands 7 29 ON column clause in BREAK command 7 13 13 18 in COMPUTE command 7 16 13 41 ON expr clause in BREAK command 13 19 in COMPUTE command 13 41 ON REPORT clause in BREAK command 7 20 13 20 in COMPUTE command 7 20 13 41 ON ROW clause in BREAK command 7 14 13 20 in COMPUTE command 13 41 online help 4 12 13 68 OPEN clause 13 135 opening a database 13 135 Oracle HTTP Server 1 5 administrator 10 12 authentication username password entries 3 11 10 11 configuration 3 7 configuring 3 12 configuring globalization support 12 4 glogin sql 10 13 Product User Profile table 10 13 starting and stopping 3 13 testing configuration file 3 12 Index 14 Oracle Net 1 4 10 9 connect identifier 13 46 protocol 4 22 security 10 9 Oracle Net configuring 3 15 oracle apache conf 3 12 3 14 Oracle9i 1 4 3 15 globalization support 12 2 12 4 ORDER BY clause displaying column values in titles 7
372. mmand is used to execute the buffer 13 66 SQL Plus User s Guide and Reference GET The GET command can be used to load files created with the SAVE command See the SAVE command in this chapter for more information Examples To load a file called YEARENDRPT with the extension SQL into the buffer enter GET YEARENDRPT SQL Plus Command Reference 13 67 HELP HELP Syntax Terms Usage Examples HELP topic Accesses the SQL Plus command line help system Enter HELP INDEX for a list of topics Refer to the following for a description of the term or clause topic Represents a SQL Plus help topic for example COLUMN Enter HELP without topic to get help on the help system You can only enter one topic after HELP You can abbreviate the topic for example COL for COLUMN However if you enter only an abbreviated topic and the abbreviation is ambiguous SQL Plus displays help for all topics that match the abbreviation For example if you enter HELP EX SQL Plus displays the syntax for the EXECUTE command followed by the syntax for the EXIT command If you get a response indicating that help is not available consult your database administrator To see a list of SQL Plus commands for which help is available enter HELP INDEX Alternatively to see a single column display of SQL Plus commands for which help is available enter HELP TOPICS 13 68 SQL Plus User s Guide and Reference HOST HOST S
373. mmand Reference 13 77 PROMPT PROMPT Syntax Terms Usage Examples C E PRO MPT text Sends the specified message or a blank line to the user s screen Refer to the following for a description of the term or clause text Represents the text of the message you wish to display If you omit text PROMPT displays a blank line on the user s screen You can use this command in scripts to give information to the user The following example shows the use of PROMPT in conjunction with ACCEPT in a script called ASKFORDEPT ASKFORDEPT contains the following SQL Plus and SQL commands PROMPT PROMPT Please enter a valid department PROMPT For example 10 20 30 40 SELECT DEPARTMENT_NAME FROM EMP_DETAILS_VIEW WHERE DEPARTMENT_ID amp NEWDEPT Assume you run the file using START or YEAREND SQL VAL1 VAL2 SQL VAL1 VAL2x Please enter a valid department For example 10 20 30 40 Department ID gt You can enter a department number at the prompt Department ID gt By default SQL Plus lists the line containing amp NEWDEPT before and after substitution and then displays the department name corresponding to the number entered at the Department ID prompt You can use SET VERIFY OFF to prevent this behavior 13 78 SQL Plus User s Guide and Reference RECOVER RECOVER Syntax RECOVER general managed END BACKUP where the general clause has the following syntax AUTO
374. mmand Summary SQL Plus Command Summary Command Page Description 13 5 Runs the SQL Plus statements in the specified script The script can be called from the local file system or from a web server QQ 13 7 Runs a script This command is similar to the at sign command It is useful for running nested scripts because it has the additional functionality of looking for the specified script in the same path as the calling script Kslash 13 9 Executes the SQL command or PL SQL block ACCEPT 13 10 Reads a line of input and stores it in a given user variable APPEND 13 12 Adds specified text to the end of the current line in the buffer ARCHIVE LOG 13 10 Starts or stops the automatic archiving of online redo log files manually explicitly archives specified redo log files or displays information about redo log files ATTRIBUTE 13 16 Specifies display characteristics for a given attribute of an Object Type column and lists the current display characteristics for a single attribute or all attributes BREAK 13 18 Specifies where and how formatting will change in a report or lists the current break definition BTITLE 13 23 Places and formats a specified title at the bottom of each report page or lists the current BTITLE definition CHANGE 13 24 Changes text on the current line in the buffer CLEAR 13 27 Resets or erases the current clause or setting for the specified option such as BREAKS or COLUMNS COLUMN 13 29 Spe
375. mmand files aborting and exiting with a return code 6 17 13 153 13 155 allowing end user input 6 17 creating with a system editor 6 2 creating with SAVE 13 93 editing with host system editor 6 3 13 61 in at sign command 6 14 13 5 in 99 double at sign command 13 7 in EDIT command 6 3 13 61 in GET command 13 66 in SAVE command 6 3 13 93 in SOLPLUS command 4 12 6 15 in START command 6 14 13 132 including comments in 6 10 13 86 including more than one PL SOL block 6 2 including more than one SOL command 6 2 nesting 6 15 passing parameters to 6 26 13 5 13 132 registering 9 10 13 95 13 99 retrieving 13 66 running 6 14 13 5 13 132 running a series in sequence 6 15 running as you start SQL Plus 4 12 6 15 running in batch mode 6 17 13 65 running nested 13 7 uniform resource locator 13 5 13 7 13 132 command prompt SET SOLPROMPT 13 98 13 120 SQL Plus 4 2 command line configuring globalization support 12 2 user interface 2 2 commands collecting timing statistics on 9 7 13 139 disabling 10 4 Index 5 commands continued entering iniSQL Plus 2 6 host running from SQL Plus 5 12 13 69 listing current in buffer 13 73 not supported in iSQL Plus D 1 re enabling 10 4 spaces 5 2 SQL editing in buffer 6 4 editing with host system editor 13 61 ending 5 5 entering and executing 5 3 entering without executing 5 5 executing current 5 7 13 9 13 92 following syntax 5 4 l
376. mple creates some variables VARIABLE id NUMBER VARIABLE txt CHAR 20 VARIABLE myvar REFCURSOR Enter VARIABLE with no arguments to list the defined variables VARIABLE variable id datatype NUMBER variable txt datatype CHAR 20 variable myvar datatype REFCURSOR The following example lists a single variable VARIABLE txt variable txt datatype CHAR 20 The following example illustrates producing a report listing individual salaries and computing the departmental salary cost for employees who earn more than 12 000 per month VARIABLE rc REFCURSOR BEGIN OPEN rc FOR SELECT DEPARTMENT_NAME LAST_NAME SALARY FROM EMP_DETAILS_VIEW WHERE SALARY gt 12000 ORDER BY DEPARTMENT NAME LAST NAME END PL SQL procedure successfully completed SET PAGESIZE 100 FEEDBACK OFF TTITLE LEFT Departmental Salary Bill SKIP 2 COLUMN SALARY FORMAT 999 990 99 HEADING Salary COLUMN DEPARTMENT NAME HEADING Department COLUMN LAST NAME HEADING Employee SQL Plus Command Reference 13 149 VARIABLE COMPUTE SUM LABEL Subtotal OF SALARY ON DEPARTMENT NAME COMPUTE SUM LABEL Total OF SALARY ON REPORT BREAK ON DEPARTMENT NAME SKIP 1 ON REPORT SKIP 1 PRINT rc jm Departmental Salary Bill DEPARTMENT NAME Employee Salary Executive De Haan 17 000 00 King 24 000 00 Kochhar 17 000 00 dk see I dee e ke dex HR RRR o 5 0 ll 0090 A tases Subtotal 58 000 00 Marketin
377. mpty Action Enter the name of an existing file into the field and try again or if the specified file existed but was empty no action is required SP2 0872 SET AUTORECOVERY ON must be used in iSQL Plus Cause Attempted to use the interactive mode of the RECOVER command in iSQL Plus Use the autorecovery mode in iSQL Plus Action Switch SET AUTORECOVERY ON and rerun the RECOVER command SP2 0873 An unexpected quote was found in the URL argument Cause A quote was found in the middle of the value portion of a keyword value pair Action Check for and remove the extra quote SP2 0874 URL argument is missing a keyword Cause No keyword was found in a keyword value pair of a URL argument Action Check for a missing keyword or a missing equals sign SP2 0875 URL argument contains a keyword but no value Cause The value for a keyword was missing in a keyword value pair of a URL Action Check for a missing value or perhaps a missing equals sign SP2 0876 URL argument is missing an end quote Cause Could not find the end quote to match an open quote in a keyword value pair of a URL Action Check for and insert the matching end quote SP2 0877 Found an unexpected character in a URL argument Cause Already have a keyword value pair where the value is quoted but extra characters were still found in a URL argument Action Remove the extra characters 14 38 SQL Plus User s Guide and Reference iSQL Plus Error M
378. must be mounted and closed and all tablespaces requiring recovery must be online To perform media recovery on a tablespace the database must be mounted and open and the tablespace must be offline To perform media recovery on a datafile the database can remain open and mounted with the damaged datafiles offline unless the file is part of the SYSTEM tablespace Before using the RECOVER command you must have restored copies of the damaged datafile s from a previous backup Be sure you can access all archived and online redo log files dating back to when that backup was made When another log file is required during recovery a prompt suggests the names of files that are needed The name is derived from the values specified in the initialization parameters LOG_ARCHIVE_DEST and LOG_ARCHIVE_FORMAT You should restore copies of the archived redo log files needed for recovery to the destination specified in LOG_ARCHIVE_DEST if necessary You can override the initialization parameters by setting the LOGSOURCE variable with the SET LOGSOURCE command During recovery you can accept the suggested log name by pressing return cancel recovery by entering CANCEL instead of a log name or enter AUTO at the prompt for automatic file selection without further prompting If you have enabled autorecovery that is SET AUTORECOVERY ON recovery proceeds without prompting you with filenames Status messages are displayed when each log file is applied Wh
379. n Reconnect to iSQL Plus SP2 0866 Please enter statements in the input area Cause The Execute button was clicked when there were no statements in the input area to execute Action Enter statements to run in the input area and click Execute again SP2 0867 No script to be saved Cause Save Script was clicked when there were no statements in the input area to save Action Enter statements to save in the input area and click Save Script again SP2 0868 No script to execute Cause An attempt was made to execute a script and output the results to a file when there were no statements in the script to execute Action Make sure the script contains statements to execute and execute the script again SP2 0869 Invalid file content Cause Attempted to load a script into the input area with a format the web server cannot understand Action Make sure the script is in a text file and the MIME type settings needed by the browser to recognize the file are set correctly Typically if you are loading a file with the extension SQL make sure the browser has a SQL MIME type SP2 0870 Exited normally Cause This is an informational message You successfully exited out of iSQL Plus Action No action required SQL Plus Error Messages 14 37 iSQL Plus Error Messages SP2 0871 No script to load Cause Clicked Load Script but either no file name was specified or the specified file name did not exist or if it existed it was e
380. n a DESCRIBE or COPY command database object Something created and stored in a database Tables views synonyms indexes sequences clusters and columns are all examples of database objects database server The computer which runs the ORACLE Server kernel and contains the database database specification An alphanumeric code that identifies a database used to specify the database in Oracle Net operations and to define a database link In SQL Plus you can reference a database specification in a COPY CONNECT or SQLPLUS command Glossary 7 Glossary 8 database string A string of Oracle Net parameters used to indicate the network prefix the host system you want to connect to and the system ID of the database on the host system Data Control Language DCL The category of SQL statements that control access to the data and to the database Examples are the GRANT and REVOKE statements Occasionally DCL statements are grouped with DML statements Data Definition Language DDL The category of SQL statements that define or delete database objects such as tables or views Examples are the CREATE ALTER and DROP statements data dictionary A comprehensive set of tables and views automatically created and updated by the Oracle database server which contains administrative information about users data storage and privileges It is installed when Oracle is initially installed and is a central source of information for the
381. n functions and procedures The maximum size of a retrieved XMLType column is determined by SET LONG and SET LONGCHUNKSIZE determines the size of the increments or chunks SQL Plus uses to retrieve XMLType data See Also DESCRIBE on page 13 53 a SET LONG 801 n on page 13 112 a SETLONGC HUNKSIZE 801 n on page 13 112 a Formatting Datatypes on page 7 5 SQLPLUS L Argument There is a new command line argument for the SOLPLUS command SOLPLUS L which specifies not to reprompt for username or password if the initial connection does not succeed This can be useful in operating system scripts that must either succeed or fail It is also useful for situations where you do not want to be reprompted for connection details if the Server is not running This option is not available with the SOL Plus Windows graphical user interface See Also SQL Plus Command Summary on page 13 2 CONNECT IDENTIFIER DEFINE Variable There is a new DEFINE variable CONNECT IDENTIFIER which contains the SID as supplied by the user to make a connection where it is available This allows the connection information to be accessed like any other DEFINE variable For example it could be used in TTITLE in amp substitution variables or as your SOL Plus command line prompt by using the SET SOLPROMPT command For example to change your SQL Plus prompt to display your username and SID enter SET SOLPROMPT amp CONNECT IDENTIFIER gt You can
382. n is active than all commands can be used unless disabled in the PUP table If RESTRICT 3 is used then LOGIN SQL is not read GLOGIN SQL is read but restricted commands used will fail Starting SQL Plus 4 9 The SQLPLUS Command Table 7 1 shows the commands disabled in each restriction level Table 4 1 Commands Disabled by Restriction Level Command Level 1 Level 2 Level 3 EDIT disabled disabled disabled GET disabled HOST disabled disabled disabled SAVE disabled disabled SPOOL disabled disabled START disabled STORE disabled disabled SILENT Option S ILENT Suppresses all SOL Plus information and prompt messages including the command prompt the echoing of commands and the banner nor mally displayed when you start SQL Plus If you omit username or pass word SQL Plus prompts for them but the prompts are not visible Use SILENT to invoke SQL Plus within another program so that the use of SQL Plus is invisible to the user SILENT is a useful mode for creating reports for the web using the SOLPLUS MARKUP command inside a CGI script or operating sys tem script The SQL Plus banner and prompts are suppressed and do not appear in reports created using the SILENT option Logon username password Represent the username and password with which you wish to start SQL Plus and connect to Oracle If you enter your password on the command line as part of the SOLPLUS command in the form sqlplus username pas
383. n the SOL buffer This makes editing more convenient since it means you can append a new line to the end of the buffer without removing a semicolon Using Scripts in SQL Plus 6 5 Editing Scripts in SQL P lus E Editing the Current Line The SQL Plus CHANGE command allows you to edit the current line Various actions determine which line is the current line a LIST a given line to make it the current line a When you LIST or RUN the command in the buffer the last line of the command becomes the current line Note that using the slash command to run the command in the buffer does not affect the current line a If you get an error the error line automatically becomes the current line Example 6 3 Making an Error in Command Entry Suppose you try to select the JOB ID column but mistakenly enter it as JO ID Enter the following command purposely misspelling JOB ID in the first line SELECT EMPLOYEE ID LAST NAME JO ID SALARY FROM EMP DETAILS VIEW WHERE JOB ID SA MAN You see this message on your screen SELECT EMPLOYEE ID LAST NAME JO ID SALARY ERROR at line 1 ORA 00904 invalid column name Examine the error message it indicates an invalid column name in line 1 of the query The asterisk shows the point of error the mis typed column JOB ID Instead of re entering the entire command you can correct the mistake by editing the command in the buffer The line containing the error is now
384. n_name Cause Unable to allocate memory to process the COMPUTE command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0088 Missing keyword_name keyword Usage STORE SET filenamel ext CRE ATE REP LACE APP END Cause Missing a keyword in the statement Action Check the syntax of the command you used for the correct options and use the keyword in the appropriate place SP2 0092 Missing columns for keyword name keyword Cause The column name was not specified for the keyword Action Specify the column name and try again 14 6 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0096 No more room to allocate INTO variable variable_name Cause Unable to allocate memory to process the COMPUTE command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0097 No storage to allocate ON column column_name Cause Unable to allocate memory to process the COMPUTE command Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0098 No storage to allocate COMPUTE block for column_name Cause Unable to allocate memory to process the COMPUTE command
385. name followed by the extension Alternatively you can use the SET SUFFIX command to change the default file extension Configuring SQL Plus 3 3 SQL Plus Configuration Restoring the System Variables To restore the stored system variables enter START file_name If the file has the default extension as specified by the SET SUFFIX command you do not need to add the period and extension to the file name You can also use the at sign or the double at sign commands to run the script Example 3 1 Storing and Restoring SQL Plus System Variables To store the current values of the SQL Plus system variables in a new script plusenv sql STORE SET plusenv Created file plusenv Now the value of any system variable can be changed SHOW PAGESIZE PAGESIZE 24 SET PAGESIZE 60 SHOW PAGESIZE PAGESIZE 60 The original values of system variables can then be restored from the script START plusenv SHOW PAGESIZE PAGESIZE 24 3 4 SQL Plus User s Guide and Reference iSQL Plus Configuration MSQL Plus Configuration Configuring iSQL Plus is discussed in the following topics Configuring the Client Tier This section discusses options for configuring your web browser to use iSQL Plus Web Browser Setup Your web browser needs to be configured to enable cookies iSQL Plus can be used without JavaScript but you may find it better with JavaScript enab
386. nce The description for tables views types and synonyms contains the following information a each column s name a whether or not null values are allowed NULL or NOT NULL for each column datatype of columns for example CHAR DATE LONG LONGRAW NUMBER RAW ROWID VARCHAR2 VARCHAR or XMLType precision of columns and scale if any for a numeric column When you do a DESCRIBE VARCHAR columns are returned with a type of VARCHAR2 SQL Plus Command Reference 13 53 DESCRIBE Examples The DESCRIBE command allows you to describe objects recursively to the depth level set in the SET DESCRIBE command You can also display the line number and indentation of the attribute or column name when an object contains multiple object types For more information see the SET command later in this chapter To control the width of the data displayed use the SET LINESIZE command Columns output for the DESCRIBE command are typically allocated a proportion of the linesize currently specified Decreasing or increasing the linesize with the SET LINESIZE command usually makes each column proportionally smaller or larger This may give unexpected text wrapping in your display For more information see the SET command later in this chapter The description for functions and procedures contains the following information the type of PL SQL object function or procedure a the name of the function or procedure the ty
387. nce of this guide for a SQL Plus command in the Oracle9i SQL Reference for a SOL command or in the PL SQL User s Guide and Reference for a PL SQL block Otherwise contact your DBA SQL Plus Basics 5 15 Interpreting Error Messages 5 16 SQL Plus User s Guide and Reference 6 Using Scripts in SQL Plus This chapter helps you learn to write and edit scripts containing SOL Plus commands SQL commands and PL SQL blocks It covers the following topics Editing Scripts Modifying Scripts Editing Scripts in SQL Plus Placing Comments in Scripts Running Scripts Nesting Scripts Receiving a Return Code Exiting from a Script with a Return Code Writing Interactive Commands Using Bind Variables Read this chapter while sitting at your computer and try out the examples shown Before beginning make sure you have access to the sample schema described in Chapter 1 SOL Plus Overview Using Scripts in SQL Plus 6 1 Editing Scripts Editing Scripts In command line SOL Plus the use of an external editor in combination with the or START commands is an effective method of creating and executing generic scripts You can write scripts which contain SQL Plus SOL and PL SQL commands which you can retrieve and edit and which can be executed in either command line or iSQL Plus user interfaces This is especially useful for storing complex commands or frequently used reports You can load any valid SQL script into iS
388. nce by reducing the amount of program I O SET HEA DING ON OFF Example ca G ca Controls printing of column headings in reports ON prints column headings in reports OFF suppresses column headings The SET HEADING OFF command will not affect the column width displayed and only suppresses the printing of the column header itself To suppress the display of column headings in a report enter SET HEADING OFF If you then run a SQL SELECT command SELECT LAST_NAME SALARY FROM EMP_DETAILS_VIEW WHERE JOB ID AC MGR the following output results Higgins 12000 To turn the display of column headings back on enter SET HEADING ON SQL Plus Command Reference 13 109 SET SET HEADS EP c ON OFF Defines the character used as the heading separator character The heading separator character cannot be alphanumeric or white space You can use the heading separator character in the COLUMN command and in the old forms of BTITLE and TTITLE to divide a column heading or title onto more than one line ON or OFF turns heading separation on or off When heading separation is OFF SQL Plus prints a heading separator character like any other character ON changes the value of c back to the default SET INSTANCE instance path LOCAL Example Changes the default instance for your session to the specified instance path Using the SET INSTANCE command does not connect to a database The default instanc
389. nd CENTER clauses place the following values at the beginning end and center of the line The SKIP clause tells SQL Plus to move down one or more lines Note that there is no longer any space between the last row of the results and the bottom title The last line of the bottom title prints on the last line of the page The amount of space between the last row of the report and the bottom title depends on the overall page size the number of lines occupied by the top title and the number of rows in a given page In the above example the top title occupies three more lines than the top title in the previous example You will learn to set the number of lines per page later in this chapter To always print n blank lines before the bottom title use the SKIP n clause at the beginning of the BTITLE command For example to skip one line before the bottom title in the example above you could enter the following command BTITLE SKIP 1 CENTER COMPANY CONFIDENTIAL Indenting a Title Element You can use the COL clause in TTITLE or BTITLE to indent the title element a specific number of spaces For example COL 1 places the following values in the first character position and so is equivalent to LEFT or an indent of zero COL 15 places the title element in the 15th character position indenting it 14 spaces Example 7 21 Indenting a Title Element To print the company name left aligned with the report name indented five spaces on the next line e
390. nd behavior as SQLPLUS MARKUP 13 112 SQL Plus User s Guide and Reference SET Example For detailed information see MARKUP Options on page 4 4 For examples of usage see SET MARKUP on page 13 112 and Generating HTML Reports from SQL Plus on page 8 1 Use the SHOW MARKUP command to view the status of MARKUP options The following is a script which uses the SET MARKUP HTML command to enable HTML marked up text to be spooled to a specified file Note TheSET MARKUP example command is laid out for readability using line continuation characters and spacing Command options are concatenated in normal entry Use your favorite text editor to enter the commands necessary to set up the HTML options and the query you want for your report ET MARKUP HTML ON SPOOL ON HEAD lt TITLE gt SQL Plus Report lt title gt TYLE TYPE TEXT CSS BODY background ffffc6 gt lt STYLE gt ET ECHO OFF POOL employee htm ELECT FIRST NAME LAST NAME SALARY ROM EMP DETAILS VIEW HERE SALARY gt 12000 POOL OFF ET MARKUP HTML OFF ET ECHO ON coco c zi do cdocucu cu As this script contains SOL Plus commands do not attempt to run it with slash from the buffer because it will fail Save the script in your text editor and use START to execute it START employee sql As well as writing the html spool file employee htm the output is also displayed on screen because SET TERMOUT defaults to ON Y
391. nd inserts one blank line when the value of JOB_ID changes and additionally prints the sum of SALARY and inserts another blank line when the value of DEPARTMENT_ID changes you could enter the following commands The example selects departments 50 and 80 and the jobs of clerk and salesman only BREAK ON DEPARTMENT_ID SKIP 1 ON JOB_ID SKIP 1 DUPLICATES COMPUTE SUM OF SALARY ON DEPARTMENT_ID COMPUTE AVG OF SALARY ON JOB_ID SELECT DEPARTMENT ID JOB ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE JOB ID IN SH_CLERK SA MAN AND DEPARTMENT ID IN 50 80 ORDER BY DEPARTMENT ID JOB ID SQL Plus Command Reference 13 21 BREAK E DEPARTMENT_ID JOB_ID LAST_NAME SALARY 50 SH_CLERK SH_CLERK SH_CLERK DEPARTMENT_ID JOB_ID Taylor Fleaur Gates LAST_NAME 2900 SALARY 50 SH_CLERK SH_CLERK SH_CLERK kkk kk kkkk avg DEPARTMENT ID JOB ID Perkins Bell Grant LAST NAME ckckckck ck ck k kk kk sum 80 SA MAN SA MAN SA MAN SA MAN SA MAN kkk kk kkkk avg DEPARTMENT ID JOB ID Russell Partners Errazuriz Cambrault Zlotkey LAST NAME ckckckck kk k kk KKK sum 25 rows selected 13 22 SQL Plus User s Guide and Reference BTITLE BTITLE Syntax Terms Usage Examples BTI TLE printspec text variable ON OFF where printspec represents one or more of the following clauses used to place and format the text
392. nd of a SOL Plus command System Variables that Affect How Commands Run The SQL Plus command SET controls many variables called SET variables or system variables the settings of which affect the way SOL PlIus runs your commands System variables control a variety of conditions within SQL Plus including default column widths for your output whether SQL Plus displays the number of records selected by a command and your page size System variables are also called SET variables The examples in this guide are based on running SQL Plus with the system variables at their default settings Depending on the settings of your system variables your output may appear slightly different than the output shown in the examples Your settings might differ from the default settings if you have a SQL Plus LOGIN file on your computer For more information on system variables and their default settings see the SET command on page 13 95 For details on the SQL Plus LOGIN file refer to SQL Plus Configuration on page 3 2 and to The SOLPLUS Command on page 4 3 5 10 SQL Plus User s Guide and Reference Saving Changes to the Database Automatically To list the current setting of a SET command variable enter SHOW followed by the variable name at the command prompt See the SHOW command on page 13 124 for information on other items you can list with SHOW Saving Changes to the Database Automatically nn Through the SOL DML commands
393. nd prompts again for a reply The format element must be a text constant such as A10 or 9 999 See the CHANGE command in this chapter for a complete list of format elements Oracle date formats such as dd mm yy are valid when the datatype is DATE DATE without a specified format defaults to the Oracle NLS_ 13 10 SQL Plus User s Guide and Reference ACCEPT Examples DATE_FORMAT of the current session See the Oracle9i Database Admin istrator s Guide and the Oracle9i SQL Reference for information on Oracle date formats DEFAULT Sets the default value if a reply is not given The reply must be in the specified format if defined PROMPT text Displays text on screen before accepting the value of variable from the user NOPRIOMPT Skips a line and waits for input without displaying a prompt HIDE Suppresses the display as you type the reply To display or reference variables use the DEFINE command See the DEFINE command in this chapter for more information To display the prompt Password place the reply in a CHAR variable named PSWD and suppress the display enter ACCEPT pswd CHAR PROMPT Password HIDE To display the prompt Enter weekly salary and place the reply in a NUMBER variable named SALARY with a default of 000 0 enter ACCEPT salary NUMBER FORMAT 999 99 DEFAULT 000 0 PROMPT Enter weekly salary To display the prompt Enter date hired and place the reply in a DATE va
394. nded that each user of iSQL Plus have a database schema profile with appropriately defined limits For the full syntax and for further information about the full iSQL Plus Server Statistics report see iSQL Plus Server Statistics on page 2 12 Only active statistics are shown in the following list Active Statistics The active statistics report shows the current values for the following Sessions active The number of concurrent active sessions or the number of sessions currently logged in to iSQL Plus Sessions since The cumulative count of sessions established since the startup iSQL Plus Server started Maximum The maximum or peak number of concurrent sessions concurrent since the iSQL Plus Server started sessions Sessions expired The cumulative count of sessions timed out due to since startup inactivity since the iSQL Plus Server started Requests active The number of concurrent active HTTP requests Each request corresponds to a user action such as clicking a button and the processing of that request by iSOL Plus Requests active has a maximum value set by iSQLPlusNumberOfThreads If it reaches this limit and user response time is poor then response time may be improved by increasing iSQLPlusNumberOfThreads 9 12 SQL Plus User s Guide and Reference iSQL P lus Server Statistics Requests since startup Next expiry operation minutes Expiry operations since startup Hash table collisions Ha
395. ndow C File History f0 Scripts ox Cancel xi l Connected as SYSTEM Gicjones2 fit Local intranet Input Area Enter the width in characters and the height in lines that you want for the Input area The default width is 70 characters and the default height is 10 lines Output Select one of the three options to set the output destination for script results generated from your session Work screen when the contents of the Input area are executed the resulting output is displayed on screen under the Input area This is the default New window when the contents of the Input area are executed the resulting output is displayed in a new web browser window a File when the contents of the Input area are executed the resulting output is saved to a file You are prompted to enter the name of the file As the output is in HTML format it is useful to give the saved output file a HTM or HTML extension The Output setting returns to the default of Work screen every time a new session is started History Enter the number of scripts to be stored in History The minimum value allowed is zero the maximum 100 and the default is 10 If you set an invalid value the previous valid value is used SQL Plus User Interface 2 9 iSQL Plus User Interface isQL Plus DBA Login Screen You can log in to iSQL Plus with SYSDBA or SYSOPER privileges to perform database administration and run DBA commands through iSQL Plus You mus
396. nds will currently affect database A set of operating system files treated as a unit in which an Oracle database server stores a set of data dictionary tables and user tables A database requires three types of files database files redo log files and control files database administrator DBA 1 A person responsible for the operation and maintenance of an Oracle database server or a database application The database administrator monitors its use in order to customize it to meet the needs of the local community of users 2 An Oracle username that has been given DBA privileges and can perform database administration functions Usually the two meanings coincide There may be more than one DBA per site database instance failure Failure that occurs when a problem arises that prevents an Oracle database instance SGA and background processes from continuing to work Instance failure may result from a hardware problem such as power outage or a software problem such as operating system crash When an instance failure occurs the data in the buffers of the SGA is not written to the datafiles database link An object stored in the local database that identifies a remote database a communication path to the remote database and optionally a username and password for it Once defined a database link can be used to perform queries on tables in the remote database Also called DBlink In SQL Plus you can reference a database link i
397. nds you enter can control an attribute s display characteristics for multiple SOL SELECT commands When you enter multiple ATTRIBUTE commands for the same attribute SQL Plus applies their clauses collectively If several ATTRIBUTE commands apply the same clause to the same attribute the last one entered will control the output To make the LAST NAME attribute of the Object Type EMPLOYEE TYPE 20 characters wide enter ATTRIBUTE EMPLOYEE TYPE LAST NAME FORMAT A20 To format the SALARY attribute of the Object Type EMPLOYEE TYPE so that it shows millions of dollars rounds to cents uses commas to separate thousands and displays 0 00 when a value is zero enter ATTRIBUTE EMPLOYEE TYPE SALARY FORMAT 9 999 990 99 SQL Plus Command Reference 13 17 BREAK BREAK Syntax Terms BRE AK ON report element action action where report element Requires the following syntax column expr ROW REPORT action Requires the following syntax SKI P n SKI P PAGEJINODUPILICATES DUP LICATES Specifies where changes occur in a report and the formatting action to perform such as suppressing display of duplicate values for a given column skipping a line each time a given column value changes printing computed figures each time a given column value changes or at the end of the report see also the COMPUTE command Enter BREAK with no clauses to list the current BREAK definition Refer to the following list
398. ne 6 4 13 73 listing the last line 6 5 13 73 loading into host system editor 13 61 saving contents 13 93 BUFFER clause 6 3 6 4 13 27 BUFFER variable C 4 buttons browse 2 6 2 15 cancel 2 8 4 19 6 25 clear screen 2 6 execute 2 6 load script 2 6 login 2 5 2 12 save script 2 6 Index 3 C cancel button 2 8 4 19 6 25 CANCEL clause 13 81 13 83 cancelquery 5 12 cascading style sheet customizing 3 11 user interface 3 11 CENTER clause 7 26 13 90 13 142 CHANGE command 6 4 6 6 13 24 Change Password screen 4 19 CHAR clause 13 10 VARIABLE command 13 145 CHAR columns changing format 7 6 13 31 default format 7 6 13 31 definition from DESCRIBE 13 53 character encoding nationallanguage support 12 3 CLEAR clause 7 10 13 30 in ATTRIBUTE command 13 16 CLEAR command 13 27 BREAKS clause 7 16 13 27 BUFFER clause 6 3 6 4 13 27 COLUMNS clause 13 27 COMPUTES clause 13 27 SCREEN clause 6 30 13 27 SOL clause 13 28 TIMING clause 13 28 clear screen button 2 6 clienttier 1 4 configuring 3 5 CLOB clause VARIABLE command 13 146 CLOB columns changing format 7 6 13 31 default format 13 31 setting maximum width 13 97 13 112 setting retrieval position 13 97 13 111 setting retrievalsize 13 97 13 112 CLOSECURSOR variable C 2 C 5 CMDSEP variable 13 96 13 103 COL clause 7 26 13 90 13 142 colons bind variables 6 31 Index 4 COLSEP variable 13 96 13 104 COLUMN
399. ne or more columns Also called tuple 2 One set of field values in the output of a query See also column schema A collection of logical structures of data or schema objects A schema is owned by a database user and has the same name as that user script A file containing a sequence of commands that you can otherwise enter interactively The file is saved for convenience and re execution scripts are often called by operating system specific names In SQL Plus you can execute the script with the START or commands security level The combination of a hierarchical classification and a set of non hierarchical compartments that represent the sensitivity of information select To fetch rows from one or more database tables using a query the SOL statement SELECT SELECT list The list of items that follow the keyword SELECT in a query These items may include column names SQL functions constants pseudo columns calculations on columns and aliases The number of columns in the result of the query will match the number of items in the SELECT list SELECT statement A SQL statement that specifies which rows and columns to fetch from one or more tables or views See also SOL statement Server Oracle software that handles the functions required for concurrent shared data access to an Oracle database The server portion receives and processes SOL and PL SQL statements originating from client applications The computer that
400. ng Bind Variables JOB_ID SA_MAN END PL SQL procedure successfully completed The results from the SELECT statement can now be displayed in SQL Plus with the PRINT command PRINT employee_info EMPLOYEE_ID SALARY 145 14000 146 13500 147 12000 148 11000 149 10500 The PRINT statement also closes the cursor To reprint the results the PL SQL block must be executed again before using PRINT Example 6 17 Using REFCURSOR Variables in Stored Procedures A REFCURSOR bind variable is passed as a parameter to a procedure The parameter has a REF CURSOR type First define the type CREATE OR REPLACE PACKAGE cv_types AS TYPE EmpInfoTyp is REF CURSOR RETURN emp ROWTYPE END cv_types Package created Next create the stored procedure containing an OPEN FOR SELECT statement CREATE OR REPLACE PROCEDURE EmpInfo_rpt emp_cv IN OUT cv_types EmpInfoTyp AS BEGIN OPEN emp cv FOR SELECT EMPLOYEE ID SALARY FROM EMP DETAILS VIEW WHERE JOB ID 2 SA MAN END Procedure created Execute the procedure with a SQL Plus bind variable as the parameter VARIABLE odcv REFCURSOR Using Scripts in SQL Plus 6 33 Using Bind Variables x n EXECUTE EmpInfo_rpt odcv PL SQL procedure successfully completed Now print the bind variable PRINT odcv EMPLOYEE ID SALARY 145 14000 146 13500 147 12
401. ng a role it must contain the name of the role you wish to disable You cannot use a wildcard See Disabling Commands with SQLPLUS RESTRICT for information on disabling a role Date_Value Not used it is recommended that you enter NULL Other products may store DATE values in this column Long Value Not used it is recommended that you enter NULL Other products may store LONG values in this column PUP Table Administration The DBA username SYSTEM owns and has all privileges on the PUP table Other Oracle usernames should have only SELECT access to this table which allows a view of restrictions for that username and those restrictions assigned to PUBLIC The script PUPBLD SQL when run grants SELECT access on the PUP table to PUBLIC Disabling SQL Plus SQL and PL SQL Commands To disable a SQL or SQL Plus command for a given user insert a row containing the user s username in the Userid column the command name in the Attribute column and DISABLED in the Char_Value column The Scope Numeric_Value and Date_Value columns should contain NULL For example PRODUCT USERID ATTRIBUTE SCOPE NUMBERIC CHAR DATE VALUE VALUE VALUE SOL Plus HR HOST DISABLED SQL Plus INSERT DISABLED SOL Plus UPDATE DISABLED SQL Plus DELETE DISABLED To re enable commands delete the row containing the restriction 10 4 SQL Plus User s Guide and Reference Disabling SQL Plus SQL and PL SQL Commands You can disable the following
402. ng and fix or remove the incorrect content SP2 0925 No scripts selected to load or delete Cause In the Script History page no scripts were selected for loading or deleting from the history list Action Click the checkbox of each script to be loaded or deleted and then click the Load or Delete button SP2 0926 iSQL Plus internal error state number message message Cause An internal error has occurred in iSQL Plus Action Make a note of the message then contact Oracle Support Services 14 44 SQL Plus User s Guide and Reference COPY Command Messages COPY Command Messages CPY0002 Illegal or missing APPEND CREATE INSERT or REPLACE option Cause An internal COPY function has invoked COPY with a create option flag value that is out of range Action Please contact Oracle Worldwide Customer Support Services CPY0003 Internal Error logical host number out of range Cause An internal COPY function has been invoked with a logical host number value that is out of range Action Please contact Oracle Worldwide Customer Support Services CPY0004 Source and destination table and column names don t match Cause On an APPEND operation or an INSERT when the table exists at least one column name in the destination table does not match the corresponding column name in the optional column name list or in the SELECT command Action Re specify the COPY command making sure that the column names and their respective ord
403. ng command at the operating system prompt SQLPLUS S M HTML ON TABLE BORDER 2 HR your_password Ora9i Qdepart sql depart html where depart sql contains SELECT DEPARTMENT NAME CITY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 EXIT This example starts SOL Plus with user HR sets HTML ON sets a BORDER attribute for TABLE and runs the script depart sgl The output from depart sgl is a web page which in this case has been redirected to the file depart html using the gt operating system redirect command it may be different on your operating system It could be sent to a web browser if SQL Plus was called in a web server CGI script See Creating Reports with CGI Scripts for information about calling SOL Plus from a CGI script Start your web browser and enter the appropriate URL to open depart html M SQL Plus Report Of x 4 File Edit view Search Go Bookmarks Tasks Help imei DEPARTMENT NAME CITY Executive Seattle Executive Seattle Executive Seattle Sales Oxford Sales Oxford Marketing Toronto 6 rows selected Document Done f Business Teche Fune I The SOLPLUS command in this example contains three layers of nested quotes From the inside out these are a 2 isa quoted HTML attribute value for BORDER a BORDER 2 is the quoted text argument for the TABLE option a HTML ON TABLE BORDER 2 is the quoted argument for the MARKUP
404. ng to be archived or reused 2 A set of two or more online redo log files that record all committed changes made to the database open database A database that has been mounted and opened by an instance and is available for access by users If a database is open users can access the information it contains See also mounted database operating system The system software that manages a computer s resources performing basic tasks such as allocating memory and allowing computer components to communicate Oracle Net Oracle s remote data access software that enables both client server and server server communications across any network Oracle Net supports distributed processing and distributed database capability Oracle Net runs over and interconnects many communications protocols Oracle Net is backward compatible with Net8 and SOL Net version 2 Oracle Server The relational database management system RDBMS sold by Oracle Corporation Components of Oracle Server include the kernel and various utilities for use by DBAs and database users output Results of a report after it is run Output can be displayed on a screen stored in a file or printed on paper output file File to which the computer transfers data packages A method of encapsulating and storing related procedures functions and other package constructs together as a unit in the database While packages provide the database administrator or application devel
405. ng used Every time an online redo log file group is reused the con tents are assigned a new log sequence number Disables automatic archival If the instance is still in ARCHIVELOG mode and all redo log file groups fill database operation is suspended until a redo log file is archived for example until you enter the com mand ARCHIVE LOG NEXT or ARCHIVE LOG ALL Enables automatic archiving Starts the background process ARCH which performs automatic archiving as required If ARCH is started and a filename is supplied the filename becomes the new default archive destination ARCH automatically starts on instance startup if the initialization parameter LOG_ARCHIVE_START is set to TRUE Manually archives the next online redo log file group that has been filled but not yet archived Manually archives all filled but not yet archived online redo log file groups Causes archival of the online redo log file group with log sequence number n You can specify any redo log file group that is still online An error occurs if the log file cannot be found online or the sequence num ber is not valid This option can be used to re archive a log file group Specifies the destination device or directory in an operating system Specification of archive destination devices is installation specific see your platform specific Oracle documentation for examples of specify ing archive destinations On many operating systems multiple log files can be s
406. nging a Column Heading To produce a report from EMP DETAILS VIEW with new headings specified for LAST NAME SALARY and COMMISSION PCT enter the following commands COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY COLUMN COMMISSION PCT HEADING COMMISSION SELECT LAST NAME SALARY COMMISSION PCT FROM EMP DETAILS VIEW WHERE JOB ID SA MAN LAST_NAME MONTHLY SALARY COMMISSION Russell 14000 4 Partners 13500 ES Errazuriz 12000 v3 Cambrault 11000 3 Zlotkey 10500 2 7 2 SQL Plus User s Guide and Reference Formatting Columns Note The new headings will remain in effect until you enter different headings reset each column s format or exit from SOL Plus To change a column heading to two or more words enclose the new heading in single or double quotation marks when you enter the COLUMN command To display a column heading on more than one line use a vertical bar where you want to begin a new line You can use a character other than a vertical bar by changing the setting of the HEADSEP variable of the SET command See the SET command on page 13 95 for more information Example 7 2 Splitting a Column Heading To give the columns SALARY and LAST_NAME the headings MONTHLY SALARY and LAST NAME respectively and to split the new headings onto two lines enter COLUMN SALARY HEADING MONTHLY SALARY COLUMN LAST NAME HEADING LAST NAME
407. nments require that service names be placed in double quotes The following command copies the entire EMPLOYEES table to a table named WESTEMPLOYEES Note that the tables are located in two different databases If WESTEMPLOYEES already exists SQL Plus replaces the table and its contents The columns in WESTEMPLOYEES have the same names as the columns in the source table EMPLOYEES COPY FROM HR your_password HQ TO JOHN your passwordQWEST REPLACE WESTEMPLOYEES USING SELECT FROM EMPLOYEES The following command copies selected records from EMPLOYEES to the database to which SQL Plus is connected SQL Plus creates SALESMEN through the copy SQL Plus copies only the columns EMPLOYEE ID and LAST NAME and at the destination names them EMPLOYEE ID and SA MAN COPY FROM HR your_password ORACLE01 CREATE SALESMEN EMPLOYEE ID SA MAN USING SELECT EMPLOYEE ID LAST NAME FROM EMPLOYEES WHERE JOB ID SA MAN B 4 SQL Plus User s Guide and Reference Copying Data from One Database to Another Copying Data from One Database to Another Use the SOL Plus COPY command to copy CHAR DATE LONG NUMBER or VARCHAR data between databases and between tables on the same database With the COPY command you can copy data between databases in the following ways Copy data from a remote database to your local database Copy data from your local default database to a remote database most systems Copy data from one remote da
408. nnect failed or if your users see the following error page generated by the Oracle HTTP Server Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request This indicates that iSQL Plus has not been able to handle the request load The common cause of this problem is that isQLPlusNumberOfThreads is set to too small a value 9 14 SQL Plus User s Guide and Reference 10 SQL Plus Security This chapter describes the available methods for controlling access to database tables and SQL Plus commands It covers the following topics PRODUCT_USER_PROFILE Table Disabling SQL Plus SQL and PL SQL Commands Creating and Controlling Roles Disabling Commands with SQLPLUS RESTRICT iSQL Plus Security SQL Plus Security 10 1 PRODUCT_USER_PROFILE Table PRODUCT_USER_PROFILE Table Various Oracle products use the PRODUCT_USER_PROFILE PUP table a table in the SYSTEM account to provide product level security that supplements the user level security provided by the SQL GRANT and REVOKE commands and user roles DBAs can use the PUP table to disable certain SOL and SQL Plus commands in the SQL Plus environment on a per user basis SQL Plus not Oracle enforces this security DBAs can even restrict access to the GRANT REVOKE and SET ROLE commands to control users ability to change their database privileges SQL Plus reads restrictions from the PUP table when a
409. nnen 6 11 Running Scripts esie en um tile ient itte dasha red eiie e ie e god 6 14 Nesting Scripts iios coit aret ichr hee bad b Feb Rote rene raatein ieena aae 6 15 Receiving a Return Code dee isa d n tei e ruit te 6 16 Exiting from a Script with a Return Code 2 csse enne 6 17 Writing Interactive Commands sese enne n nennen nnns 6 17 Defining User Variables laic rete ter dta eet ete e nita ee erp 6 17 Using Substitution Variables esete eee eme e eb e de Ehe ad 6 18 Substitution Variables in iSQL PIUS eese eerie ener nnne nnne 6 24 Passing Parameters through the START Command sss 6 26 Communicating with the User eei eee der d ete re ate nne re nei nire 6 27 Using Bind Variables reete tee edicere Pe beer eedem tene ie 6 31 Creating Bind Variables i is ntes uie Re rege d ute hei har det de d rh trat 6 31 Referencing Bind Variables tiene tete se teile ee 6 31 Displaying Bind Vatiables 5 estendere Ped steroid uisa 6 32 Using REFCURSOR Bind Variables esee eee nn enne 6 32 Formatting SQL Plus Reports Formatting Col nmns eee epe ee deco des iia dean eerte tees 7 2 Changing Column Headings enmt aee Le secet eerte ed tet Poeta 7 2 Formatting NUMBER Columns eee eee eene nnne nennen nennen 7 4 Formatting Datatypes sienna ei eene nenne eren nnne nennen nnns 7 5 Copying Column Display Attributes ssssssss
410. ns in Code Examples Code examples illustrate SQL PL SQL SOL Plus or other command line statements They are displayed in a monospace fixed width font and separated from normal text as shown in this example SELECT username FROM dba users WHERE username MIGRATE Code examples illustrate SOL PL SQL SOL Plus or other command line statements If users are expected to type them into the system they are identified by the keyboard icon shown in the margin following They are displayed in a monospace fixed width font and separated from normal text as shown in this example SELECT username FROM dba users WHERE username MIGRATE Similarly output from an example is identified by a computer screen icon in the margin as shown in the margin following PAGESIZE 24 Where both icons occur together it implies interactive entry and output mn 1 l SELECT LAST NAME SALARY Xxiv APPEND COMMISSION_PCT The following table describes typographic conventions used in code examples and provides examples of their use Convention Meaning Example u Other notation Italics UPPERCASE Brackets enclose one or more optional items Do not enter the brackets Braces enclose two or more items one of which is required Do not enter the braces A vertical bar represents a choice of two or more options within brackets or braces Enter one of the options Do not enter th
411. nsions for HTML files This allows you to easily identify the type of your output files and also allows web browsers to identify and correctly display your HTML files If no extension is specified the default SQL Plus file extension is used 8 2 SQL Plus User s Guide and Reference Creating Reports using Command line SQL Plus C x5 You use SPOOL OFF or EXIT to append final HTML tags to the spool file and then close it If you enter another SPOOL filename command the current spool file is closed as for SPOOL OFF or EXIT and a new HTML spool file with the specified name is created You can use the SET MARKUP command to enable or disable HTML output as required Example 8 1 Creating a Report Interactively You can create HTML output in an interactive SQL Plus session using the SET MARKUP command You can include an embedded style sheet or any other valid text in the HTML lt HEAD gt tag Open a SOL Plus session and enter the following SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON HEAD TITLE Department Report TITLE lt STYLE type text css gt lt BODY background FFFFC6 gt lt STYLE gt BODY TEXT 4FFOOFf TABLE WIDTH 90 BORDER 5 You use the COLUMN command to control column output The following COLUMN commands create new heading names for the SOL query output The first command also turns off entity mapping for the DEPARTMENT NAME column to allow HTML hyperlinks to be
412. nt for that bind variable or on exit SQL Plus formatting commands such as BREAK COLUMN COMPUTE and SET may be used to format the output from PRINTing a REFCURSOR A REFCURSOR bind variable may not be PRINTed more than once without re executing the PL SQL OPEN FOR statement SQL Plus Command Reference 13 147 VARIABLE Examples The following example illustrates creating a bind variable and then setting it to the value returned by a function VARIABLE id NUMBER BEGIN id EMP_MANAGEMENT HIRE BLAKE MANAGER KING 2990 SALES END The value returned by the stored procedure is being placed in the bind variable id It can be displayed with the PRINT command or used in subsequent PL SOL subprograms The following example illustrates automatically displaying a bind variable SET AUTOPRINT ON VARIABLE a REFCURSOR BEGIN OPEN a FOR SELECT LAST NAME CITY DEPARTMENT ID FROM EMP DETAILS VIEW WHERE SALARY 12000 ORDER BY DEPARTMENT ID END PL SQL procedure successfully completed LAST NAME CITY DEPARTMENT ID Hartstein Toronto 20 Russell Oxford 80 Partners Oxford 80 King Seattle 90 Kochhar Seattle 90 De Haan Seattle 90 6 rows selected In the above example there is no need to issue a PRINT command to display the variable 13 148 SQL Plus User s Guide and Reference VARIABLE x5 L L The following exa
413. nt the default database and open the database enter STARTUP or enter STARTUP OPEN database To start an instance using the standard parameter file mount the default database and open the database enter STARTUP FORCE RESTRICT MOUNT To start an instance using the parameter file TESTPARM without mounting the database enter STARTUP PFILE testparm NOMOUNT To shutdown a particular database immediately restart and open it allow access only to database administrators and use the parameter file MYINIT ORA enter STARTUP FORCE RESTRICT PFILE myinit ora OPEN database To startup an instance and mount but not open a database enter CONNECT as SYSDBA Connected to an idle instance 13 136 SQL Plus User s Guide and Reference STARTUP STARTUP MOUNT ORACLE instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 7629732 bytes 60324 bytes 6627328 bytes 409600 bytes 532480 bytes SQL Plus Command Reference 13 137 STORE STORE Syntax Terms Usage Examples STORE is not available in iSQL Plus STORE SET file_name ext CRE ATE REP LACE APP END Saves attributes of the current SQL Plus environment in a host operating system script Refer to the following list for a description of each term or clause SET Saves the values of the system variables Refer to the SAVE command for information on the other terms and clauses in the STO
414. ntax OK is displayed 3 12 SQL Plus User s Guide and Reference iSQL Plus Configuration On UNIX do the following steps 1 Open a terminal 2 Change directory to the Oracle HTTP Server home bin directory by entering cd SORACLE HOME Apache Apache conf 3 Parse the Oracle HTTP Server httpd conf configuration file by entering apachectl configtest Any errors in the configuration file are displayed If there are any errors edit the included configuration files oracle apache conf or isglplus conf again to correct them and then test again If there are no errors the message Syntax OK is displayed Starting and Stopping the Oracle HTTP Server For changes to the Oracle HTTP Server configuration file httpd conf and any included configuration files to take affect you must stop and restart the Oracle HTTP Server if it is running There is no convenient way to know how many users are currently accessing the server so it is important to have the server down for the shortest time When making changes to configuration files parse the httpd conf configuration file and report any errors before starting and stopping the Oracle HTTP Server To stop and start the Oracle HTTP Server On Windows do the following steps 1 Opena Windows Command Prompt 2 Change directory to the Oracle HTTP Server home directory by entering cd ORACLE_HOME Apache Apache 3 Stop the running Oracle HTTP Server by entering apache k shutdown 4 S
415. nter TTITLE LEFT ACME WIDGET SKIP 1 COL 6 SALES DEPARTMENT PERSONNEL REPORT SKIP 2 Now rerun the current query to see the results ACME WIDGET SALES DEPARTMENT PERSONNEL REPORT DEPARTMENT ID LAST NAME SALARY 30 Colmenares 2500 30 Himuro 2600 30 Tobias 2800 30 Baida 2900 7 26 SQL Plus User s Guide and Reference Defining Page and Report Titles and Dimensions 30 Khoo 3100 30 Raphaely 11000 COMPANY CONFIDENTIAL 6 rows selected Entering Long Titles If you need to enter a title greater than 500 characters in length you can use the SQL Plus command DEFINE to place the text of each line of the title in a separate user variable DEFINE LINE1 DEFINE LINE2 DEFINE LINE3 This is the first line This is the second line This is the third line Then reference the variables in your TTITLE or BTITLE command as follows TTITLE CENTER LINE1 SKIP 1 CENTER LINE2 SKIP 1 CENTER LINE3 Displaying System Maintained Values in Titles E You can display the current page number and other system maintained values in your title by entering a system value name as a title element for example TTITLE LEFT system maintained value name There are five system maintained values you can display in titles the most commonly used of which is SOL PNO the current page number For a list of system maintained values you can display in titles see the TTITLE command on page 13 141 Example 7
416. nvironments Privilege The Privilege dropdown list has two options AS SYSDBA connects to the specified database with SYSDBA privileges AS SYSOPER connects to the specified database with SYSOPER privileges SQL Plus User Interface 2 11 iSQL Plus User Interface Login Click the Login button to log in to iSQL Plus with the supplied username password connection identifier and DBA privilege iSQL Plus DBA Work Screen If you log in with SYSDBA or SYSOPER privileges the iSQL Plus DBA Work screen is displayed to remind you of the privileged connection Fill out the fields on the DBA Work screen as you would for the Work screen I Ele Edt View Favoies Tools Help EJ ORACLE E 7SQL Plus DBA _ Logout New History Preferences Help E Session Work Screen File or URL Browse Load Script Enter statements a i Execute Save Script Clear Screen Cancel Connected l Connected as SYS cjones2 fit Local intranet iSQL Plus Server Statistics iSQL Plus Server statistics provide static environment information as well as dynamic information about iSQL Plus sessions The dynamic information may provide useful feedback that can be used for getting the best from the iSQL Plus Server For information about Tuning the iSQL Plus Server see Interpreting Active Statistics on page 9 13 You can request a report containing iSQL Plus Server statistics with http machine_name domain port isqlp
417. o make sure you have entered it correctly OK Click the OK button to change the password for your Oracle database account Cancel Click the Cancel button to return to the Preferences screen without changing your password isQL Plus Expired Password Screen The Expired Password screen is automatically displayed on attempting to log into iSQL Plus if your password has expired Fill out the fields on the Expired Password screen as you would for the Change Password screen Starting SQL Plus 4 19 Database Connection Identifier I File Edt View Favorites Tools Help a ORACLE 2 p Help ISQL Plus Login Expired Password Expired Password ERROR ORA 28001 the password has expired Your password has expired Change your password Username mo SS Old password 77 SCS New password er Retype new password FP Cancel E Not connected F Local intranet Multi User Systems Each user must have a username and password to access the operating system These may or may not be the same ones you use with SQL Plus Single User Systems If only one person at a time uses your computer you may be expected to perform the functions of a DBA for yourself If you want to define your own username and password see the Oracle9i SQL Reference Database Connection Identifier To use SQL Plus to access data in an Oracle database you must first connect to the database When starting SQL Plus you
418. o the Oracle database before re issuing the PASSWORD command SP2 0641 command_name requires connection to server Cause SQL Plus was unable to execute the command because there was no connection to a database Action Connect to a database and re try the operation SP2 0642 SQL Plus internal error state error state context error number Unsafe to proceed Cause An internal error occurred Action Make a note of the message then contact Oracle Support Services SP2 0645 Operating System error occurred Unable to complete EDIT command Cause An operating system error occurred with the EDIT command Action Check that the file was created successfully and verify that the device you are writing to is still available SP2 0650 New passwords do not match Cause The new passwords entered did not match Action Re issue the PASSWORD command and make sure that the new passwords are entered correctly SP2 0659 Password unchanged Cause The PASSWORD command failed to change passwords because No passwords were given The new passwords did not match Action Re issue the PASSWORD command and make sure that the new passwords are entered correctly SQL Plus Error Messages 14 29 SQL Plus Error Messages SP2 0666 WARNING SHIFTINOUT only affects shift sensitive character sets Cause The NLS character set used in this session does not contain shift sensitive characters The SET SHIFTINOUT command is unnecessary Action
419. obsoleted by SET COLSEP but you can still use it for backward compatibility You may prefer to use COLSEP because the SHOW command recognizes COLSEP and does not recognize SPACE SET TRUNCATE Purpose Controls whether SQL Plus truncates or wraps a data item that is too long for the current line width Syntax SET TRU NCATE ONJOFF Usage Notes ON functions in the same manner as SET WRAP OFF and vice versa You may prefer to use WRAP because the SHOW command recognizes WRAP and does not recognize TRUNCATE SHOW LABEL Purpose Shows the security level for the current session Syntax SHO W LABEL TTITLE old form Purpose Displays a title at the top of each report page Syntax TTI TLE text Obsolete SQL Plus Commands C 7 TTITLE old form Usage Notes The old form of TTITLE offers formatting features more limited than those of the new form but provides compatibility with UFI a predecessor of SQL Plus The old form defines the top title as a line with the date left aligned and the page number right aligned followed by a line with centered text and then a blank line The text you enter defines the title TTITLE will display SQL Plus centers text based on the size of a line as determined by SET LINESIZE A separator character begins a new line two line separator characters in a row insert a blank line You can change the line separator character with SET HEADSEP You can control the formatting of
420. ocking 1 7 SAVE command 13 93 APPEND clause 13 93 CREATE clause 13 93 disabling 10 5 REPLACE clause 13 93 storing commands in scripts 13 93 using with INPUT to create scripts 6 3 save script button 2 6 saving environment attributes 13 138 SCAN variable C 2 C 6 SCREEN clause 6 30 13 27 screen clearing 6 30 13 27 screens Change Password 4 19 connection identifier field 2 5 2 11 DBA Login 2 10 DBA Work screen 2 12 define substitution variables field 6 25 enter statements field 2 6 2 7 Expired Password 4 19 History 2 6 Interface options 2 9 Login 2 4 2 10 new password field 4 19 old password field 4 19 password field 2 4 2 11 Preferences 2 8 privilege list 2 11 retype new password field 4 19 script location field 2 8 System variables 2 14 username field 2 4 2 11 3 16 4 19 Work 2 5 scripts editing 5 2 extension 13 93 13 121 13 138 location field 2 8 See also command files Secure Sockets Layer security 10 9 security changing password 13 75 embedded web reports 8 7 HTTP 10 9 Oracle HTTP Server 10 9 Oracle Net 10 9 password viewable 4 10 PRODUCT_USER_PROFILE table 10 2 RESTRICT 4 9 10 8 Secure Sockets Layer SSL 10 9 SELECT command and BREAK command 7 12 13 19 13 20 and COLUMN command 13 30 and COMPUTE command 7 12 and COPY command B 3 B 6 and DEFINE command 13 49 and ORDER BY clause 7 12 disabling 10 5 formatting results
421. of each term or clause These terms and clauses also apply to the BTITLE command lext The title text Enter text in single quotes if you want to place more than one word on a single line variable A user variable or any of the following system maintained values SOL LNO the current line number SOL PNO the current page num ber SOL RELEASE the current Oracle release number SQL SQL CODE the current error code or SQL USER the current username To print one of these values reference the appropriate variable in the title You can format variable with the FORMAT clause OFF Turns the title off suppresses its display without affecting its defini tion SQL Plus Command Reference 13 141 TTITLE ON Turns the title on restores its display When you define a top title SQL Plus automatically sets TTITLE to ON COL n Indents to column n of the current line backward if column n has been passed Here column means print position not table column SIKIP n Skips to the start of a new line n times if you omit n one time if you enter zero for n backward to the start of the current line TAB n Skips forward n columns backward if you enter a negative value for n Column in this context means print position not table column LE FT CE NTER R IGHT Left align center and right align data on the current line respectively SQL Plus aligns following data items as a group up to the end of the print
422. of the line If you specify a line number larger than the number of lines in the buffer and follow the number with text SOL Plus adds the text in a new line at the end of the buffer If you specify zero 0 for the line number and follow the zero with text SQL Plus inserts the line at the beginning of the buffer that line becomes line 1 Enter 3 so the current line of the buffer contains the following text 3 3 WHERE JOB ID IS IN CLERK SA MAN Enter the following command CHANGE CLERK SH CLERK The text in the buffer changes as follows 3 WHERE JOB ID IN SH CLERK SA MAN Or enter the following command CHANGE CLERK SH CLERK The original line changes to 3 WHERE JOB ID IS IN SH CLERK Or enter the following command CHANGE SA MAN The original line changes to 3 WHERE JOB ID IS IN SA MAN You can replace the contents of an entire line using the line number This entry 3 WHERE JOB ID IS IN SH CLERK SQL Plus Command Reference 13 25 CHANGE causes the second line of the buffer to be replaced with WHERE JOB ID IS IN SH CLERK Note that entering a line number followed by a string will replace the line regardless of what text follows the line number For example 2 CHANGE OLD NEW will change the second line of the buffer to be 2 C OLD NEW 13 26 SQL Plus User s Guide and Reference CLEAR CLEAR Syntax Terms CL
423. ommand and store it in the SOL buffer see The SOL Buffer for details If you mistakenly press Return before typing the semicolon SQL Plus prompts you with a line number for the next line of your command Type the semicolon and press Return again to run the command Note You cannot enter a comment on the same line after a semicolon For more information about placing comments see Placing Comments in Scripts on page 6 10 A slash on a line by itself also tells SQL Plus that you wish to run the command Press Return at the end of the last line of the command SQL Plus prompts you with another line number Type a slash and press Return again SQL Plus executes the command and stores it in the buffer see The SOL Buffer for details A blank line in a SQL statement or script tells SOL Plus that you have finished entering the command but do not want to run it yet Press Return at the end of the last line of the command SQL Plus prompts you with another line number SQL Plus Basics 5 5 Running SQL Commands Note You can change the way blank lines appear and behave in SQL statements using the SET SOLBLANKLINES command For more information about changing blank line behavior see the SET command on page 13 95 Press Return again SQL Plus now prompts you with the SQL Plus command prompt SQL Plus does not execute the command but stores it in the SOL buffer see The SQL Buffer for details If you subse
424. ommand in the form c gt sqlplus username8connect identifier You will be prompted to enter your password xli SQL Plus Command line Quick Start for UNIX Do the following steps to start SQL Plus and connect to the default database 1 Open a UNIX terminal 2 At the command line prompt enter the SQL Plus command in the form sqlplus 3 When prompted enter your Oracle9i username and password If you do not know your Oracle9i username and password ask your Database Administrator 4 SQL Plus starts and connects to the default database Now you can start entering and executing SOL PL SQL and SQL Plus statements and commands at the SOL prompt Do the following to start SQL Plus and connect to a specified database other than the default 1 Start SOL Plus and connect to the default database 2 Usethe CONNECT command to specify the Oracle Net database alias connect identifier of the database you want to connect to To do this enter the CONNECT command in the form SQL gt connect username password8connect identifier To hide your password enter the CONNECT command in the form SQL gt connect username8connect identifier You will be prompted to enter your password 3 Alternatively to start SOL Plus connected to a database other than the default enter the SOL Plus command in the form gt sqlplus username password8 connect identifier To hide your password enter the SOL Plus command in the form
425. ommands HELP INDEX displays a four column list of SOL Plus commands which usually fits in a single screen For example HELP INDEX If you get a response that help is unavailable consult your database administrator See the HELP command on page 13 68 for more information Installing Command line Help The database administrator creates the SQL Plus help tables and populates them with SQL Plus help data Before you can install SQL Plus help ensure that a SQL Plus is installed otherwise you cannot create and load the help tables The default tablespace for the SYSTEM user is large enough to accommodate the help system You must have at least 128K of free space 4 12 SQL Plus User s Guide and Reference Exiting Command line SQL Plus The SQL Plus help script files are available in SORACLE HOME SQLPLUS ADMIN HELP The help script files are a HLPBLD SQL to drop and create new help tables a HELPUS SQL to populate the help tables with the help data HELPDROPSQL to drop existing SQL Plus help tables To install SQL Plus help 1 Log in to SQL Plus as the SYSTEM user with SQLPLUS SYSTEM your password where your passwordis the password you have defined for the SYSTEM user 2 Run the SQL script HLPBLD SQL from SQL Plus with SORACLE_HOME SQLPLUS ADMIN HELP HLPBLD SQL HELPUS SQL Exiting Command line SQL Plus When you are done working with SQL Plus and wish to return to the operating system ent
426. on The global Site Profile allows the DBA to set up SQL Plus environment defaults for all users at a particular site users cannot directly access the Site Profile The site profile file is SORACLE_HOME sqlplus admin glogin sql Ifa site profile already exists at this location it is overwritten when you install SQL Plus If SQL Plus is removed the site profile file is deleted SQL Plus also supports a User Profile executed after the Site Profile This file is generally named login sgl SOL Plus searches for the user profile in your current directory and then the directories you specify with the SOLPATH environment variable SOL Plus searches this colon separated list of directories in the order they are listed You can add any SQL commands PL SQL blocks or SOL Plus commands to your user profile When you start SOL Plus it automatically searches for your user profile and runs the commands it contains A user profile is ineffective in the SQL Plus user interface context and cannot be used to control the initial settings or behavior of an individual iSQL Plus session 3 2 SQL Plus User s Guide and Reference SQL Plus Configuration Modifying Your LOGIN File You can modify your LOGIN file just as you would any other script You may wish to add some of the following commands to the LOGIN file SET LINESIZE Followed by a number sets the number of characters as page width of the query results SET NUMFORMAT Fol
427. on can be made up of column names functions operators and constants Formulas are found in commands or SQL statements extension On some operating systems the second part of the full file specification Several standard file extensions are used to indicate the type or purpose of the file as in file extensions of SOL LOG LIS EXE BAT and DIR Called file type on some operating systems file A collection of data treated as a unit such as a list document index note set of procedures and so on Generally used to refer to data stored on magnetic tapes or disks See also filename extension and file type filename The name component of a file specification A filename is assigned by either the user or the system when the file itself is created See also extension and file type file type On some operating systems the part of the filename that usually denotes the use or purpose of the file See extension format Columns contain information in one of four types users can specify how they want a query to format information it retrieves from character number date or long columns For example they can choose to have information of type date appear as 23 11 98 or Monday Twenty third November 1998 or any other valid date format format model A clause element that controls the appearance of a value in a report column You specify predefined format models in the COLUMN TTITLE and BTITLE commands FORMAT clauses You
428. ons of available tools such as PL SQL Next SQL Plus displays the SQL Plus command prompt SQL gt The command prompt indicates that SOL Plus is ready to accept your commands Throughout this guide where you see the following keyboard icon 4 2 SQL Plus User s Guide and Reference The SQLPLUS Command in the margin it is prompting you to enter information at the command prompt line Where you see the computer screen icon H in the margin it is showing you what you should expect to see displayed on your screen If SQL Plus does not start you should see a message to help you correct the problem Shortcuts to Starting Command line SQL Plus When you start SOL Plus you can enter your username and password separated by aslash following the command SQLPLUS For example you can enter SOLPLUS HR your password and press Return You can also arrange to log in to SQL Plus automatically when you log on to your host operating system See the Oracle installation and user s guide provided for your operating system for details The SQLPLUS Command You use the SOLPLUS command at the operating system prompt to start SQL Plus SQLPLUS Options Logon Start where Options on page 4 4 has the following syntax H ELP V ERSION L OGON M ARKUP markup option R ESTRICT 11213 S ILENT and markup option has the following syntax HTML ON OFF HEAD text BODY text TABLE text E
429. ontains the SOL Plus command reference and the list of SOL Plus error messages The following chapters are covered in this section a SQL Plus Command Reference a SQL Plus Error Messages 13 SQL Plus Command Reference This chapter contains descriptions of the SOL Plus commands available in command line and iSQL Plus interfaces listed alphabetically Each description contains the following parts Syntax Shows how to enter the command and provides a brief description of the basic uses of the command Refer to Conventions in Code Examples on page xxiv for an explanation of the syntax notation Terms Describes the function of each term or clause appearing in the syntax Usage Provides additional information on uses of the command and on how the command works Examples Gives one or more examples of the command A summary table that lists and briefly describes SQL Plus commands precedes the individual command descriptions You can continue a long SOL Plus command by typing a hyphen at the end of the line and pressing Return If you wish you can type a space before typing the hyphen SQL Plus displays a right angle bracket gt as a prompt for each additional line You do not need to end a SQL Plus command with a semicolon When you finish entering the command you can just press Return If you wish however you can enter a semicolon at the end of a SOL Plus command SQL Plus Command Reference 13 1 SQL P lus Co
430. opening 13 135 Index 7 database administrator 11 2 database changes saving automatically 5 11 13 95 13 101 DATABASE clause 13 81 database files recovering 13 79 database name at startup 13 134 database tier 1 4 configuration 3 15 databases connecting to default 13 46 connecting to remote 4 21 13 46 copying data between B 2 B 5 copying data between tables on a single B 9 disconnecting without leaving SOL Plus 4 18 13 60 mounting 11 3 opening 11 3 recovering 11 5 13 79 shutting down 11 2 11 3 starting 11 2 DATAFILE clause 13 82 DATE column definition from DESCRIBE 13 53 DATE clause 13 10 DATE columns changing format 7 6 13 32 13 39 default format 7 6 date storing current in variable for titles 7 30 13 35 13 37 DB2 13 105 DBA 11 2 iSQL Plus access 10 9 mode 13 134 privilege 2 10 13 134 DBA access 10 11 DBA Login screen 2 10 DBA Work screen 2 12 DBMS APPLICATION INFO package 9 10 13 95 13 99 DECLARE command PL SQL 5 7 DECLARE command disabling 10 5 DEFAULT clause 13 11 default logins created at installation 4 17 Index 8 DEFINE command 6 17 13 49 and host system editor 6 2 13 50 and UNDEFINE command 6 18 13 144 CHAR values 13 49 SET DEFINE ONIOFF 13 96 13 105 substitution variables 6 21 13 49 define substitution variables field 6 25 DEFINE variable 6 23 13 96 13 105 DEL command 6 4 6 9 13 51 using an asterisk 6 4 13 51 DELETE command dis
431. oper organizational benefits they also offer increased functionality and database performance page A screen of displayed data or a sheet of printed data in a report parallel server Some hardware architectures for example loosely coupled processors allow multiple computers to share access to data software or peripheral devices With systems that have the parallel server option Oracle can take advantage of such hardware platforms by running multiple database instances that share a single physical database In appropriate applications the Oracle Parallel Server allows access to a single database by the users on multiple machines with increased database performance parameter A substitution variable consisting of an ampersand followed by a numeral amp 1 amp 2 and so on You use parameters in a script and pass values into them through the arguments of the START command parameter file A file used by Oracle9i Server to provide specific values and configuration settings to be used on database startup For more information about the function of the parameter file see the Oracle9i Database Administrator s Guide Glossary 17 Glossary 18 password A secondary identification word or string of alphanumeric characters associated with a username A password is used for data security and known only to its owner Passwords are entered in conjunction with an operating system login ID Oracle username or account name in order
432. or a VARCHAR vari able with character semantics is determined by the number of bytes required to store each character for the chosen character set with an upper limit of 4000 bytes The length semantics are determined by the length qualifiers CHAR or BYTE and if not explicitly stated the value of the NL5 LENGTH SEMANTICS environment variable is applied to the bind variable Explicitly stating the length semantics at variable def inition stage will always take precedence over the NL5 LENGTH SEMANTICS setting NVARCHAR2 n CLOB NCLOB Creates a variable of type NVARCHAR2 with length of up to n charac ters The maximum that n can be is determined by the number of bytes required to store each character for the chosen national character set with an upper limit of 4000 bytes The only exception to this is when a SQL Plus session is connected to a pre Oracle9i server or the SQL PLUSCOMPATIBILITY system variable is set to a version less than 9 0 0 In this case the length n can be in bytes or characters depending on the chosen national character set with the upper limit of 4000 bytes still retained Creates a variable of type CLOB Creates a variable of type NCLOB 13 146 SQL Plus User s Guide and Reference VARIABLE Usage REFCURSOR Creates a variable of type REF CURSOR Bind variables may be used as parameters to stored procedures or may be directly referenced in anonymous PL SQL blocks To display the value of
433. or an INSERT when the table exists the number of columns in the column name list is greater than the number of columns in the destination table Action Re specify the COPY command making sure that the number of columns in the column list agrees with the number in the destination table CPY0009 Fewer column list names than columns in the destination table Cause On an APPEND operation or an INSERT when the table exists the number of columns in the column name list is less than the number of columns in the destination table Action Re specify the COPY command making sure that the number of columns in the column list agrees with the number in the destination table CPY0012 Object datatypes cannot be copied Cause An attempt was made to copy an object datatype that is not supported in the COPY command Datatypes supported by the COPY command are CHAR DATE LONG NUMBER and VARCHAR2 Action Re specify the COPY command making sure that the unsupported datatype column is removed For more information see the COPY on page 13 48 command 14 46 SQL Plus User s Guide and Reference PartiV SQL Plus Appendixes This section contains the following SOL PlIus appendixes SQL Plus Limits SOL Plus COPY Command Obsolete SOL Plus Commands Commands Not Supported in iSQL Plus A SQL Plus Limits This appendix lists general SOL Plus limits The limits shown are valid for most operating systems SQL Plus Limits A 1
434. or more units of information rows each of which contains the same kinds of values columns Each column is given a column name a datatype such as CHAR NCHAR VARCHAR2 NVARCHAR2 DATE or NUMBER and a width the width may be predetermined by the datatype as in DATE Once a table is created valid rows of data can be inserted into it Table information can then be queried deleted or updated To enforce defined business rules on a table s data integrity constraints and triggers can also be defined for a table table alias A temporary substitute name for a table defined in a query and only good during that query If used an alias is set in the FROM clause of a SELECT statement and may appear in the SELECT list See also alias text editor A program run under your host computer s operating system that you use to create and edit host system files and SQL Plus scripts containing SOL commands SOL Plus commands and or PL SQL blocks timer An internal storage area created by the TIMING command title One or more lines that appears at the top or bottom of each report page You establish and format titles through the TTITLE and BTITLE commands transaction A logical unit of work that comprises one or more SQL statements executed by a single user According to the ANSI ISO SQL standard with which Oracle is compatible a transaction begins with the user s first executable SOL statement A transaction ends when it is explicit
435. ores the subprograms you enter at the SOL Plus command prompt in the SOL buffer Execute the current subprogram by issuing a RUN or slash command Likewise to execute a SOL CREATE command that creates a stored SQL Plus Basics 5 7 Running SQL P lus Commands procedure you must also enter RUN or slash A semicolon will not execute these SQL commands as it does other SQL commands SQL Plus sends the complete PL SQL subprogram to Oracle for processing as it does SQL commands See your PL SQL User s Guide and Reference for more information You might enter and execute a PL SQL subprogram as follows DECLARE x NUMBER 100 BEGIN FOR i IN 1 10 LOOP IF MOD i 2 0 THEN i is even INSERT INTO temp VALUES i x i is even ELSE INSERT INTO temp VALUES i x i is odd END IF x x 100 END LOOP END When you run a subprogram the SOL commands within the subprogram may behave somewhat differently than they would outside the subprogram See your PL SQL User s Guide and Reference for detailed information on the PL SQL language Running SQL Plus Commands You can use SOL Plus commands to manipulate SOL commands and PL SQL blocks and to format and print query results SQL Plus treats SQL Plus commands differently than SOL commands or PL SQL blocks For information on individual SQL Plus commands see Chapter 13 SOL Plus Command Reference To speed up command entry you can abbreviate many
436. otherwise you will receive a message ORA 00942 table or view does not exist Shows the current page number Shows the release number of Oracle that SQL Plus is accessing REPF OOTER Shows the current REPFOOTER definition REPH EADER SPOO L SGA SQLCODE TTI TLE USER Shows the current REPHEADER definition Shows whether output is being spooled Displays information about the current instance s System Global Area Note you need SELECT ON V_ SGA object privileges to use the SGA clause otherwise you will receive a message ORA 00942 table or view does not exist Shows the value of SOL SOLCODE the SQL return code of the most recent operation Shows the current TTITLE definition Shows the username you are currently using to access SQL Plus If you connect as AS SYSDBA then the SHOW USER command displays USER is SYS 13 126 SQL Plus User s Guide and Reference SHOW Examples p m G ca 55 To list the current LINESIZE enter SHOW LINESIZE If the current linesize is 80 characters SQL Plus will give the following response LINESIZE 80 The following example illustrates how to create a stored procedure and then show its compilation errors CONNECT SYSTEM MANAGER CREATE PROCEDURE HR PROC1 AS BEGIN P1 1 END Warning Procedure created with compilation errors SHOW ERRORS PROCEDURE PROC1 NO E
437. ou can view the spool file employee htm in your web browser It should appear something like the following SQL Plus Command Reference 13 113 SET Ele Edt View Favorites Tools Help EI FIRST NAME LASTNAME SALARY Steven King 24000 eena Kochhar 17000 Lex De Haan 17000 Michael Hartstein 13000 John Russell ai 14000 aren Partners 13500 B rows selected IE Done fj Local intranet A SET NEWP AGE 1 n NONE SET NEWPAGE is not supported in iSQL Plus Sets the number of blank lines to be printed from the top of each page to the top title A value of zero places a formfeed at the beginning of each page including the first page and clears the screen on most terminals If you set NEWPAGE to NONE SQL Plus does not print a blank line or formfeed between the report pages SET NULL text Sets the text that represents a null value in the result of aSQL SELECT command Use the NULL clause of the COLUMN command to override the setting of the NULL variable for a given column SET NUMF ORMAT format Sets the default format for displaying numbers Enter a number format for format For number format descriptions see the FORMAT clause of the COLUMN command in this chapter SET NUM WIDTH 10 n Sets the default width for displaying numbers For number format descriptions see the FORMAT clause of the COLUMN command in this chapter 13 114 SQL Plus User s Guid
438. outer most break in this case from SKIP 1 for ON SALARY toward SKIP PAGE for ON DEPARTMENT ID SQL Plus executes each action up to and including the action specified for the first occurring break encoun tered in the initial search If for example in a given row the value of JOB ID changes but the values of DEPARTMENT ID and SALARY remain the same SQL Plus skips two lines before printing the row one as a result of SKIP 1 ON SALARY and one as a result of SKIP 1 ON JOB ID Whenever you use ON column you should also use an ORDER BY clause in the SOL SELECT command Typically the columns used in the BREAK command should appear in the same order in the ORDER BY clause although all columns specified in the ORDER BY clause need not appear in the BREAK command This prevents breaks from occur ring at meaningless points in the report If the BREAK command specified earlier in this section is used the fol lowing SELECT command produces meaningful results SELECT DEPARTMENT ID JOB ID SALARY LAST NAME FROM EMP DETAILS VIEW WHERE SALARY 12000 ORDER BY DEPARTMENT ID JOB ID SALARY LAST NAME All rows with the same DEPARTMENT ID print together on one page and within that page all rows with the same JOB ID print in groups Within each group of jobs those jobs with the same SALARY print in groups Breaks in LAST NAME cause no action because LAST NAME does not appear in the BREAK command SQL Plus Command Reference 13 19
439. over your output or you may want to increase linesize for printing on wide paper You can change the line width using the LINESIZE variable of the SET command SET LINESIZE number_of_characters Example 7 25 Setting Page Dimensions To set the page size to 66 lines clear the screen or advance the printer to a new sheet of paper at the start of each page and set the linesize to 70 enter the following commands SET PAGESIZE 66 SET NEWPAGE 0 SET LINESIZE 70 Now enter and run the following commands to see the results TTITLE CENTER ACME WIDGET PERSONNEL REPORT SKIP 1 CENTER 01 JAN 2001 SKIP 2 Now run the following query COLUMN FIRST NAME HEADING FIRST NAME COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 SELECT DEPARTMENT ID FIRST NAME LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 7 32 SQL Plus User s Guide and Reference Storing and Printing Query Results C x5 E ACME WIDGET PERSONNEL REPORT 01 JAN 2001 FIRST LAST MONTHLY DEPARTMENT_ID NAME AME SALARY 90 Steven King 24 000 90 Neena Kochhar 17 000 90 Lex De Haan 17 000 80 John Russell 14 000 80 Karen Partners 13 500 20 Michael Hartstein 13 000 6 rows selected Now reset PAGESIZE NEWPAGE and LINESIZE to their default values ET PAGESIZE 24 ET NEWPAGE 1 ET LINESIZE 80 nnn To list the current values of these variables use the SHOW com
440. ows SHOW DESCRIBE DESCRIBE DEPTH 2 LINENUM OFF INDENT ON 13 58 SQL Plus User s Guide and Reference DESCRIBE DESCRIBE employee FIRST_NAME EMPADDR STREET CITY JOB_ID SALARY VARCHAR2 30 ADDRESS VARCHAR2 20 VARCHAR2 20 a NUMBER 7 2 For more information on using the CREATE TYPE command see your Oracle9i SQL Reference For information about using the SET DESCRIBE and SHOW DESCRIBE commands see the SET and SHOW commands later in this chapter SQL Plus Command Reference 13 59 DISCONNECT DISCONNECT Syntax DISC ONNECT Commits pending changes to the database and logs the current username out of Oracle but does not exit SOL Plus Usage Use DISCONNECT within a script to prevent user access to the database when you want to log the user out of Oracle but have the user remain in SQL Plus Use Logout in iSQL Plus and EXIT or QUIT in SQL Plus command line to log out of Oracle and return control to your host computer s operating system Examples Your script might begin with a CONNECT command and end with a DISCONNECT as shown below CONNECT HR your password SELECT LAST NAME DEPARTMENT NAME FROM EMP DETAILS VIEW DISCONNECT SET INSTANCE FIN2 CONNECT HR2 your password 13 60 SQL Plus User s Guide and Reference EDIT EDIT Syntax Terms Usage EDIT is not available in iSQL Plus ED IT file_namel ext Invokes a host operating system text editor on the cont
441. pacing and Summary Lines break on DEPARTMENT ID page nodup on JOB_ID skip 1 nodup Now enter the following COMPUTE command and run the current query COMPUTE SUM OF SALARY ON DEPARTMENT_ID m DEPARTMENT ID JOB ID LAST NAME SALARY 20 MK MAN Hartstein 13000 ckckckckckckckckckck kk o kk k ke ke KEK T sum 13000 DEPARTMENT ID JOB ID LAST NAME SALARY 80 SA MAN Russell 14000 Partners 13500 ckckckckckck ck ckckck kk o kkxkkkkkkk k 222222 EL sum 27500 DEPARTMENT ID JOB ID LAST NAME SALARY 0 ABLPRES King oo 24000 AD VP Kochhar 17000 De Haan 17000 ckckckckckckckckck ck kk o kk k k ke KKK Na exam sum 58000 6 rows selected To compute the sum of salaries for departments 10 and 20 without printing the compute label COLUMN DUMMY NOPRINT COMPUTE SUM OF SALARY ON DUMMY BREAK ON DUMMY SKIP 1 SELECT DEPARTMENT ID DUMMY DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE SALARY gt 12000 ORDER BY DEPARTMENT ID 7 18 SQL Plus User s Guide and Reference Clarifying Your Report with Spacing and Summary Lines DEPARTMENT ID 80 80 90 90 90 6 rows selecte LAST NAME Hartstein Russell Partners King Kochhar De Haan d SALARY To compute the salaries just at the end of the report COLUMN DUMMY N COMPUTE SUM OF BREAK ON DUMMY SELECT NULL DU FROM EMP DETAI WHERE SALARY gt 1 ORDER BY DEPAR 6 rows selecte
442. pe of value returned for functions the argument names types whether input or output and default values if any To describe the view EMP_DETAILS_VIEW enter DESCRIBE EMP_DETAILS_VIEW Name Null Type EMPLOYEE ID NOT NULL NUMBER 6 JOB ID NOT NULL VARCHAR2 10 AANAGER ID NUMBER 6 DEPARTMENT ID NUMBER 4 LOCATION ID NUMBER 4 COUNTRY ID CHAR 2 FIRST NAME VARCHAR2 20 LAST NAME NOT NULL VARCHAR2 25 SALARY NUMBER 8 2 COMMISSION PCT NUMBER 2 2 DEPARTMENT NAME NOT NULL VARCHAR2 30 JOB TITLE NOT NULL VARCHAR2 35 CERY NOT NULL VARCHAR2 30 STATE_PROVINCE VARCHAR2 25 COUNTRY_NAME VARCHAR2 40 REGION_NAME VARCHAR2 25 13 54 SQL Plus User s Guide and Reference DESCRIBE C x25 C x5 To describe a procedure called CUSTOMER LOOKUP enter DESCRIBE customer lookup PROCEDURE customer lookup Argument Name Type In Out Default CUST_ID NUMBER IN CUST_NAME VARCHAR2 OUT To create and describe the package APACK that contains the procedures aproc and bproc enter CREATE PACKAGE apack AS PROCEDURE aproc Pl CHAR P2 NUMBER PROCEDURE bproc P1 CHAR P2 NUMBER END apack Package created DESCRIBE apack PROCEDURE APROC Argument Name Type In Out Default Pl CHAR IN P2 NUMBER IN PROCEDURE BPROC Argument Name Type In Out Default P1 CHAR IN P2 NUMBER IN To create and describe the object type ADDRESS tha
443. pecify it in the BREAK command Note that SQL Plus will not skip a page at the end of a report so you cannot use BREAK ON REPORT SKIP PAGE Refer to the following list for a description of each action SKI P n Skips n lines before printing the row where the break occurred BREAK SKIP n does not work in SET MARKUP HTML ON mode or in iSQL Plus unless PREFORMAT is SET ON 13 20 SQL Plus User s Guide and Reference BREAK Usage Examples SKI P PAGE Skips the number of lines that are defined to be a page before printing the row where the break occurred The number of lines per page can be set via the PAGESIZE clause of the SET command Note that PAGE SIZE only changes the number of lines that SQL Plus considers to be a page Therefore SKIP PAGE may not always cause a physical page break unless you have also specified NEWPAGE 0 Note also that if there is a break after the last row of data to be printed in a report SQL Plus will not skip the page NODUP LICATES Prints blanks rather than the value of a break column when the value is a duplicate of the column s value in the preceding row DUPLICATES Prints the value of a break column in every selected row Enter BREAK with no clauses to list the current break definition Each new BREAK command you enter replaces the preceding one To remove the BREAK command use CLEAR BREAKS To produce a report that prints duplicate job values prints the average of SALARY a
444. plete time based recovery Use single quotes and the following format YYYY MM DD HH24 MI 8 UNTIL CHANGE Specifies an incomplete change based recovery integer is the number of the System Change Number SCN following the last change you wish to recover For example if you want to restore your database up to the transaction with an SCN of 9 you would specify UNTIL CHANGE 10 USING BACKUP CONTROLFILE Specifies that a backup of the control file be used instead of the current control file TABLESPACE Recovers a particular tablespace tablespace is the name of a tablespace in the current database You may recover up to 16 tablespaces in one statement SQL Plus Command Reference 13 81 RECOVER DATAFILE Recovers a particular datafile You can specify any number of datafiles STANDBY TABLESPACE Reconstructs a lost or damaged tablespace in the standby database using archived redo log files copied from the primary database and a control file STANDBY DATAFILE Reconstructs a lost or damaged datafile in the standby database using archived redo log files copied from the primary database and a control file UNTIL CONSISTENT WITH CONTROLFILE Specifies that the recovery of an old standby datafile or tablespace uses the current standby database control file MANAGED STANDBY DATABASE Specifies sustained standby recovery mode This mode assumes that the standby database is an active component of an overall standby d
445. plicitly archives specified redo log files or displays information about redo log files Refer to the following list for a description of each term or clause LIST Requests a display that shows the range of redo log files to be archived the current log file group s sequence number and the current archive destination specified by either the optional command text or by the ini tialization parameter LOG_ARCHIVE_DEST If you are using both ARCHIVELOG mode and automatic archiving the display might appear like ARCHIVE LOG LIST Database log mode Archive Mode Automatic archival Enabled Archive destination vobs oracle dbs arch Oldest online log sequence 221 Next log sequence to archive 222 Current log sequence 222 Since the log sequence number of the current log group and the next log group to archive are the same automatic archival has archived all log groups up to the current one If you are using ARCHIVELOG but have disabled automatic archiving the last three lines might look like Oldest online log sequence 222 Next log sequence to archive 222 Current log sequence 225 If you are using NOARCHIVELOG mode the next log sequence to archive line is suppressed SQL Plus Command Reference 13 13 ARCHIVE LOG STOP START NEXT ALL integer destination The log sequence increments every time the Log Writer begins to write to another redo log file group it does not indicate the number of logs bei
446. plicitly with the DEFINE command or implicitly with an argument to the START command Terms Refer to the following for a description of the term or clause variable Represents the name of the user variable you wish to delete One or more user variables may be deleted in the same command Examples To undefine a user variable named POS enter UNDEFINE POS To undefine two user variables named MYVAR1 and MYVAR2 enter UNDEFINE MYVAR1 MYVAR2 13 144 SQL Plus User s Guide and Reference VARIABLE VARIABLE Syntax Terms VAR IABLE variable NUMBER CHAR CHAR n CHAR BYTE NCHAR NCHAR n IVARCHAR2 n CHAR BYTE INVARCHAR2 n CLOB NCLOB REFCURSOR I Declares a bind variable that can be referenced in PL SQL For more information on bind variables see Using Bind Variables on page 6 31 For more information about PL SQL see your PL SQL User s Guide and Reference VARIABLE without arguments displays a list of all the variables declared in the session VARIABLE followed only by a variable name lists that variable Refer to the following list for a description of each term or clause variable Represents the name of the bind variable you wish to create NUMBER Creates a variable of type NUMBER with fixed length CHAR Creates a variable of type CHAR character with length one CHAR n CHAR BYTE Creates a variable of type CHAR with length n bytes or n characters The maximum that n can be is 2000 bytes and the minimum i
447. ployee ID lt H2 gt lt FORM METHOD get ACTION http machine_name domain port isqlplus gt lt INPUT TYPE hidden NAME userid VALUE hr your_password gt lt INPUT TYPE hidden NAME script VALUE http machine_ name domain port employee_id sql gt Enter employee identification number lt INPUT TYPE text NAME eid SIZE 10 gt lt INPUT TYPE submit VALUE Run Report lt FORM gt lt BODY gt T lt HTML gt Generating HTML Reports from SQL Plus 8 15 Creating Reports using iSQL Plus Replace machine_name domain with the host and domain names port with the port number of your Oracle HTTP Server and hr your_password with a valid userid and password Save the HTML file on your Oracle HTTP Server Load the HTML file in your web browser Enter an employee identification number in the text field for example 105 Click the Run Report button iSQL Plus executes the script and displays the results in your web browser 8 16 SQL Plus User s Guide and Reference 9 Tuning SQL Plus This chapter provides information about how to tune SQL Plus for better performance It discusses the following topics Tracing Statements Collecting Timing Statistics Tracing Parallel and Distributed Queries a System Variables Influencing SOL Plus Performance a iSQL Plus Server Statistics a iSQL Plus Tuning Notes For information about tuning Oracle9i see the Oracle9i Database Performance
448. pooled to the same tape If not specified in the command line the archive destination is derived from the initialization parameter LOG_ARCHIVE_DEST The com mand ARCHIVE LOG START destination causes the specified device or 13 14 SQL Plus User s Guide and Reference ARCHIVE LOG Usage Examples directory to become the new default archive destination for all future automatic or manual archives A destination specified with any other option is a temporary destination that is in effect only for the current manual archive It does not change the default archive destination for subsequent automatic archives For information about specifying archive destinations see your platform specific Oracle documentation You must be connected to an open Oracle database as SYSOPER or SYSDBA For information about connecting to the database see the CONNECT command in this chapter If an online redo log file group fills and none are available for reuse database operation is suspended The condition can be resolved by archiving a log file group For information about specifying archive destinations see your platform specific Oracle documentation Note This command applies only to the current instance To specify archiving for a different instance or for all instances in a Parallel Server use the SQL command ALTER SYSTEM For more information about using SQL commands see the Oracle9i SQL Reference To start up the archive
449. ption Recovery proceeds if necessary as if AUTORECOVERY is set to ON regardless of whether or not AUTORECOVERY is enabled If a redo log file is not found in the expected location recovery continues as if AUTORECOVERY is disabled by prompting you with the suggested location and name of the subsequent log files that need to be applied Starts the database in OPEN MIGRATE mode and sets system initializa tion parameters to specific values required to enable database upgrade or downgrade scripts to be run MIGRATE should only be used when a database is first started with a new version of the Oracle Database Server See the Oracle9i Database Migration guide for details about preparing for testing and implementing a database version migration or release upgrade or downgrade SQL Plus Command Reference 13 135 STARTUP Usage Examples When run upgrade or downgrade scripts transform an installed ver sion or release of an Oracle database into another version for example to migrate an Oracle7 database to an Oracle9i database Once the migration completes the database should be shut down and restarted normally You must be connected to a database as SYSOPER or SYSDBA You cannot be connected via a multi threaded server STARTUP with no arguments is equivalent to STARTUP OPEN STARTUP OPEN RECOVER mounts and opens the database even when recovery fails To start an instance using the standard parameter file mou
450. pty htpasswd ORACLE_HOME sqlplus admin iplus pw username In both cases you are prompted for the associated password For further information about htpasswd see the Oracle HTTP Server documentation To create a new entry in an Oracle HTTP Server authentication file on UNIX 1 Log in to the machine running the Oracle HTTP Server as the Oracle HTTP Server administrator 2 Open a terminal 10 12 SQL Plus User s Guide and Reference iSQL Plus Security Run the htpasswd utility to add users to the authentication file htpasswd is usually located in ORACLE_HOME Apache Apache bin For SYSDBA or SYSOPER users use the form htpasswd SORACLE_HOME sqlplus admin iplusdba pw username For user connections where iplus pw has been created as an empty authentication file use the form htpasswd SORACLE_HOME sqlplus admin iplus pw username In both cases you are prompted for the associated password For further information about htpasswd see the Oracle HTTP Server documentation Security Usage Notes The following notes may assist you in understanding and configuring iSQL Plus Once you have successfully logged in with SYSDBA or SYSOPER privileges and authenticated with your Oracle HTTP Server authentication username and password you may not be required to re authenticate to the Oracle HTTP Server until you restart your browser However you are still required to log in with your Oracle9i username and password The P
451. quently enter another SOL command SQL Plus overwrites the previous command in the buffer Creating Stored Procedures Stored procedures are PL SQL functions packages or procedures To create stored procedures you use SQL CREATE commands The following SQL CREATE commands are used to create stored procedures a CREATE FUNCTION a CREATE LIBRARY a CREATE PACKAGE a CREATE PACKAGE BODY a CREATE PROCEDURE a CREATE TRIGGER a CREATE TYPE Entering any of these commands places you in PL SQL mode where you can enter your PL SQL subprogram For more information see Running PL SQL Blocks When you are done typing your PL SQL subprogram enter a period on a line by itself to terminate PL SQL mode To run the SOL command and create the stored procedure you must enter RUN or slash A semicolon will not execute these CREATE commands When you use CREATE to create a stored procedure a message appears if there are compilation errors To view these errors you use SHOW ERRORS For example SHOW ERRORS PROCEDURE ASSIGNVL For more information about the SHOW command see Chapter 13 SOL PIus Command Reference 5 6 SQL Plus User s Guide and Reference Running PL SQL Blocks To execute a PL SQL statement that references a stored procedure you can use the EXECUTE command EXECUTE runs the PL SQL statement that you enter immediately after the command For example EXECUTE ID EMPLOYEE MANAGEMENT GET ID BLAKE For more
452. r SQLPLUS M HTML ON HR your password To start SQL Plus with no access to the EDIT and HOST commands during the Session enter SQLPLUS R 1 HR your password Example 6 9 Displaying the SQLPLUS syntax To display the syntax of the SOLPLUS command enter SOLPLUS H Usage SQLPLUS lt option gt lt logon gt lt start gt where option H V L M lt o gt R lt n gt S lt logon gt username password G8 connect string NOLOG start lt URL gt lt filename gt lt ext gt lt parameter gt H displays the SQL Plus version banner and usage syntax V displays the SQL Plus version banner 6 16 SQL Plus User s Guide and Reference Writing Interactive Commands L attempts logon just once M o uses HTML markup options o R n uses restricted mode n S uses silent mode Exiting from a Script with a Return Code If your script generates a SOL error while running from a batch file on the host operating system you may want to abort the script and exit with a return code Use the SQL Plus command WHENEVER SQLERROR to do this see the WHENEVER SOLERROR command on page 13 154 for more information Similarly the WHENEVER OSERROR command may be used to exit if an operating system error occurs See the WHENEVER OSERROR command on page 13 152 for more information Writing Interactive Commands The following features of SOL Plus make it possible for
453. r flow occurs when rounding a number then the negative infinity sign replaces the value HEA DING text Defines a column heading If you do not use a HEADING clause the column s heading defaults to column or expr If text contains blanks or punctuation characters you must enclose it with single or double quotes Each occurrence of the HEADSEP character by default begins a new line For example COLUMN LAST NAME HEADING Employee Name would produce a two line column heading See the HEADSEP variable of the SET command in this chapter for information on changing the HEADSEP character JUS TIFY L EFT C ENTER C ENTRE R IG HT Aligns the heading If you do not use a JUSTIFY clause headings for NUMBER columns default to RIGHT and headings for other column types default to LEFT LIKE expralias Copies the display attributes of another column or expression whose attributes you have already defined with another COLUMN com mand LIKE copies only attributes not defined by another clause in the current COLUMN command NEWLINE Starts a new line before displaying the column s value NEWLINE has the same effect as FOLD_BEFORE NEW V ALUE variable Specifies a variable to hold a column value You can reference the vari able in TTITLE commands Use NEW VALUE to display column val 13 34 SQL Plus User s Guide and Reference COLUMN ues or the date in the top title You must include the column
454. r execute local SQL scripts in iSQL Plus The iSQL Plus Extension for Windows works with SQL files and is activated by right clicking a SQL file in Windows Explorer The utility is installed during Oracle9i Database and Oracle9i Client for Windows installations After installation you can configure access to one or more iSQL Plus Servers Context Menu After you have configured an iSQL Plus Server you can use the context menu to a Run or load local scripts accessible from your workstation Select the server to use from a list of configured iSQL Plus Servers a Choose the double click file association for SQL files Choose the language to use from a list of configured languages The following shows a typical view of the context menu with iSQL Plus Servers configured T File Edit view Favorites Tools Help Back gt Qsearch Gyrolders C DX OF X x Ed Address Ea c Tmp scripts 7 p P Daily Run sql 1KB SQL File 25 02 2002 10 35 AM 1KB SQL File I 25 02 2002 10 35 AM ecute sql on EmployeeDB Uk J to Employee LA Scripts IIS Ri x nid sal Scan for Viruses Open With Configure Loads MIS Reports sqf to http Jfrodo au orade com 7778 lsc gi add to archive About iSQL Plus Extension SE Add to MIS_Reports rar Badd to Zip tS Add to MIS_Reports zip E Appearance Send To Cut Copy Create Shortcut Delete Rename Properties The h
455. r process and begin automatic archiving using the archive destination specified in LOG_ARCHIVE_DEST enter ARCHIVE LOG START To stop automatic archiving enter ARCHIVE LOG STOP To archive the log file group with sequence number 1001 to the destination specified enter ARCHIVE LOG 1001 vobs oracle dbs arch arch specifies the prefix of the filename on the destination device the remainder of the filename is dependent on the initialization parameter LOG_ARCHIVE_ FORMAT which specifies the filename format for archived redo log files SQL Plus Command Reference 13 15 ATTRIBUTE ATTRIBUTE Syntax ATTRIBUTE type name attribute name option where option represents one of the following clauses ALI AS alias CLE AR FOR MAT format LIKE type name attribute name alias ONJOFF Specifies display characteristics for a given attribute of an Object Type column such as format for NUMBER data Also lists the current display characteristics for a single attribute or all attributes Terms Enter ATTRIBUTE followed by type name attribute name and no other clauses to list the current display characteristics for only the specified attribute Enter ATTRIBUTE with no clauses to list all current attribute display characteristics Refer to the following list for a description of each term or clause type name attribute name Identifies the data item typically the name of an attribute within the set of attributes
456. r titles 7 31 13 35 EWLINE clause 13 34 EWPAGE command C 2 C 4 EWPAGE variable 7 32 13 97 13 114 EXT clause 13 14 LS 12 2 12 3 LS_DATE_FORMAT 13 10 13 39 OAUDIT command disabling 10 5 OLIST clause 13 66 OLOG 4 11 NOLOG option 4 11 OMOUNT clause 13 135 ONE clause WHENEVER OSERROR 13 153 ZZ LZLLAZLZ ZZ WHENEVER SQLERROR 13 155 NOPRINT clause 7 17 7 29 13 35 NOPROMPT clause 13 11 NORMAL mode 13 129 NULL clause 13 35 null values setting text displayed 13 35 13 97 13 114 NULL variable 13 97 13 114 NUMBER column definition from DESCRIBE 13 53 NUMBER clause 6 30 13 10 VARIABLE command 13 145 NUMBER columns changing format 7 4 13 32 default format 7 4 13 33 number formats 7 5 0 7 5 9 7 5 comma 7 5 setting default 13 97 13 114 NUMBER function 7 17 NUMFORMAT clause in LOGIN SQL 3 3 NUMFORMAT variable 13 97 13 114 NUMWIDTH variable 13 97 13 114 effect on NUMBER column format 7 4 13 33 NVARCHAR2 columns changing format 7 6 13 31 default format 7 6 13 31 O objects describing 13 106 obsolete commands BTITLE C 3 COLUMN command DEFAULT clause C 3 DOCUMENT C 2 C 3 NEWPAGE C 2 C 4 SET command BUFFER variable C 4 SET command CLOSECURSOR variable C 2 C 5 SET command DOCUMENT variable C 2 C 5 SET command MAXDATA variable C 2 C 6 SET command SCAN variable C 2 C 6 Index 13 obsolete commands continued SET com
457. rameter LOG_ARCHIVE_DEST or LOG_ARCHIVE_DEST_1 Do not specify FROM if you have set a file with SET LOGSOURCE Continues media recovery by applying the specified redo log file In interactive recovery mode AUTORECOVERY OFF if a bad log name is entered errors for the bad log name are displayed and you are prompted to enter a new log name TEST ALLOW integer CORRUPTION CONTINUE In the event of logfile corruption specifies the number of corrupt blocks that can be tolerated while allowing recovery to proceed During nor mal recovery integer cannot exceed 1 Continues multi instance recovery after it has been interrupted to dis able a thread 13 80 SQL Plus User s Guide and Reference RECOVER CONTINUE DEFAULT Continues recovery using the redo log file generated automatically by Oracle if no other logfile is specified This is equivalent to specifying AUTOMATIC except that Oracle does not prompt for a filename CANCEL Terminates cancel based recovery STANDBY DATABASE Recovers the standby database using the control file and archived redo log files copied from the primary database The standby database must be mounted but not open DATABASE Recovers the entire database UNTIL CANCEL Specifies an incomplete cancel based recovery Recovery proceeds by prompting you with suggested filenames of archived redo log files and recovery completes when you specify CANCEL instead of a filename UNTIL TIME Specifies an incom
458. re are no attributes If text includes spaces it must be enclosed in quotes SQL Plus does not test this free text entry for HTML validity You must ensure that the text you enter is valid for the HTML lt BODY gt tag This gives you the flexibility to customize output for your browser or special needs TABLE text The TABLE text option allows you to enter attributes for the lt TABLE gt tag You can use TABLE text to set HTML TABLE tag attributes such as BORDER CELLPADDING CELLSPACING and WIDTH By default the TABLE WIDTH attribute is set to 90 and the BORDER attribute is set to 1 If text includes spaces it must be enclosed in quotes SOL Plus does not test this free text entry for HTML validity You must ensure that the text you enter is valid for the HTML lt TABLE gt tag This gives you the flexi bility to customize output for your browser or special needs ENTMAP ONJOFF ENTMAP ON or OFF specifies whether or not SQL Plus replaces spe cial characters and amp with the HTML entities amp lt amp gt amp quot and amp amp respectively ENTMAP is set ON by default 4 6 SQL Plus User s Guide and Reference The SQLPLUS Command You can turn ENTMAP ON and OFF as required during a session For example with ENTMAP OFF SQL Plus screen output is SQL gt SELECT DEPARTMENT_ID CITY 1 FROM EMP DETAILS VIEW 2 WHERE SALARY 12000 With ENTMAP ON SQL Plus screen output is SQL amp gt SELECT DEPARTME
459. reak column SKIP n To skip a page use the command in this form BREAK ON break column SKIP PAGE Formatting SQL Plus Reports 7 13 Clarifying Your Report with Spacing and Summary Lines E Example 7 11 Inserting Space when a Break Column s Value Changes To place one blank line between departments enter the following command BREAK ON DEPARTMENT ID SKIP 1 Now rerun the query DEPARTMENT ID LAST NAME SALARY 20 Hartstein 13000 80 Russell 14000 Partners 13500 90 King 24000 Kochhar 17000 De Haan 17000 6 rows selected Inserting Space after Every Row You may wish to insert blank lines or a blank page after every row To skip n lines after every row use BREAK in the following form BREAK ON ROW SKIP n To skip a page after every row use BREAK ON ROW SKIP PAGE Note SKIP PAGE does not cause a physical page break character to be generated unless you have also specified NEWPAGE 0 Using Multiple Spacing Techniques Suppose you have more than one column in your ORDER BY clause and wish to insert space when each column s value changes Each BREAK command you enter replaces the previous one Thus if you want to use different spacing techniques in one report or insert space after the value changes in more than one ordered column you must specify multiple columns and actions in a single BREAK command 7 14 SQL Plus User s Guide and Reference Clarifying Your Report with Sp
460. rect Do you need more examples What features did you like most If you find any errors or have any other suggestions for improvement please indicate the document title and part number and the chapter section and page number if available You can send com ments to us in the following ways Electronic mail sqlplus oracle com FAX telephone number Attn SOL Plus Documentation Manager Postal service SQL Plus Documentation Manager Australian Product Development Centre Oracle Corporation Australia Pty Ltd 324 St Kilda Road Melbourne VIC 3004 Australia If you would like a reply please give your name address telephone number and optionally elec tronic mail address If you have problems with the software please contact your local Oracle Support Services XV xvi Preface The SQL Plus pronounced sequel plus User s Guide and Reference introduces the SQL Plus program and its uses It also provides a detailed description of each SOL Plus command This preface contains these topics Intended Audience Documentation Accessibility Documentation Structure Related Documentation Conventions xvii Intended Audience The SQL Plus User s Guide and Reference is intended for business and technical users and system administrators who perform the following tasks a Enter edit store retrieve and run SOL commands and PL SQL blocks Format calculate on store print and create web output of quer
461. reens have the iSQL Plus DBA logo to clearly distinguish this administrative session from standard iSQL Plus sessions See Also iSQL Plus DBA Login Screen on page 2 10 iSQL Plus Extension for Windows The iSQL Plus Extension for Windows provides a context menu to load or execute local SQL scripts in iSQL Plus The iSQL Plus Extension for Windows works with SQL files and is activated by right clicking a SQL file in Windows Explorer After you have configured an iSQL Plus Server you can use the context menu to a Run or load local scripts accessible from your workstation Select the server to use from a list of configured iSQL Plus Servers a Choose the double click file association for SQL files Choose the language to use from a list of configured languages Language Support in SQL Plus Extension for Windows On Windows XP Windows 2000 and Windows NT the iSQL Plus Extension for Windows supports the following languages Brazilian Portuguese English French Canadian French German Italian Japanese Korean Simplified Chinese Spanish LA Spanish Traditional Chinese On Windows 98 the iSQL Plus Extension for Windows is only available in English See Also iSQL Plus Extension for Windows on page 2 16 xxxiii Upgrading SQL Plus Server from 9 0 1 to 9 2 XXXIV There are some changes between iSQL Plus in Release 9 0 1 and 9 2 iSQL Plus URL The default Oracle HTTP Server installation now specifies a port numb
462. riable named HIRED with the format dd mm yyyy and a default of 01 01 2001 enter ACCEPT hired DATE FORMAT dd mm yyyy DEFAULT 01 01 2001 PROMPT Enter date hired SQL Plus Command Reference 13 11 APPEND APPEND Syntax Terms Examples E E APPEND is not available in iSQL Plus A PPEND text Adds specified text to the end of the current line in the SOL buffer Refer to the following for a description of the term or clause text Represents the text to append To separate text from the preceding char acters with a space enter two spaces between APPEND and text To APPEND text that ends with a semicolon end the command with two semicolons SQL Plus interprets a single semicolon as an optional command terminator To append a comma delimiter a space and the column name CITY to the first line of the buffer make that line the current line by listing the line as follows 1 1 SELECT DEPARTMENT_ID Now enter APPEND APPEND CITY 1 1 SELECT DEPARTMENT_ID CITY To append a semicolon to the line enter APPEND SQL Plus appends the first semicolon to the line and interprets the second as the terminator for the APPEND command 13 12 SQL Plus User s Guide and Reference ARCHIVE LOG ARCHIVE LOG Syntax Terms ARCHIVE LOG LIST STOP START NEXT ALL integer TO destination Starts or stops automatic archiving of online redo log files manually ex
463. riable of the SET command in this chapter SQL Plus Command Reference 13 61 EDIT Note The default file AFIEDT BUF may have a different name on some operating systems If you do not specify a filename and the buffer is empty EDIT returns an error message To leave the editing session and return to SOL Plus terminate the editing session in the way customary for the text editor When you leave the editor SOL Plus loads the contents of the file into the buffer Examples To edit the file REPORT with the extension SQL using your host operating system text editor enter EDIT REPORT 13 62 SQL Plus User s Guide and Reference EXECUTE EXECUTE Syntax Terms Usage Examples EXEC UTE statement Executes a single PL SQL statement The EXECUTE command is often useful when you want to execute a PL SQL statement that references a stored procedure For more information on PL SQL see your PL SQL User s Guide and Reference Refer to the following for a description of the term or clause statement Represents a PL SQL statement If your EXECUTE command cannot fit on one line because of the PL SQL statement use the SQL Plus continuation character a hyphen The length of the command and the PL SQL statement cannot exceed the length defined by SET LINESIZE If the variable n has been defined with VARIABLE n NUMBER The following EXECUTE command assigns a value to the bind variable n
464. ripts Databases on other computers or databases on your host computer other than your default database are called remote databases You can access a remote database if it has Oracle Net configured and both databases have compatible network drivers You can connect to a remote database in two ways a As you start SQL Plus Using the CONNECT command Connecting to a Remote Database as You Start SQL Plus To connect to a remote database when you start iSQL Plus enter the Oracle Net service name in your Login screen Connection identifier field Leave the field blank to use the default Oracle database if one exists otherwise enter an Oracle Net alias to specify a remote database you want to connect to If you use an Oracle Net alias it must be defined on the machine running the iSQL Plus Server which may not be the same machine from which you run your web browser To connect to a remote database when you start command line SQL Plus include the Oracle Net service name in your SOLPLUS command in the following form SQLPLUS HR your password8 connect identifier You can also use the full connection identifier for example DESCRIPTION ADDRESS PROTOCOL TCP HOST2www oracle com PORT21521 CONNECT DATA SERVICE NAME orashop us acme com You must use a username and password valid for the remote database and substitute the appropriate service name for the remote database Command line SQL Plus prompts you for a username and pass
465. rmission to the file except for temporary testing or tracing purposes Some abnormal errors may be written to the Oracle HTTP Server log file These may include errors generated if the iSQL Plus Server cannot be started These errors are written even if iSQLPlusLogLevel is OFF When iSQLPlusLogLevel is set to debug then process tracing information is logged You can edit the iSQL Plus configuration file isglplus conf to change the log level The syntax of the line to change in the configuration file is FastCgiServer initial env iSQLPlusLogLevel off warn debug Setting the jSQL Plus Time Out Parameter Timing out iSQL Plus sessions helps to reduce machine load and to maximize resources The time out interval is set by the iSQLPlusTimeOut Interval initialization parameter It defines the time a session can be idle before it is expired You can edit the iSQL Plus configuration file isglplus conf to change the timeout interval The syntax of the line to change in the configuration file is FastCgiServer initial env iSQLPlusTimeOutInterval n Where n is the number of whole minutes of idle time before the session times out iSQLPlusTimeOut Interval has a default of 30 minutes It can be set to any value from 1 to 1440 minutes It should not be set so small that users do not get a chance to enter their scripts When a user tries to use a timed out iSQL Plus session the Login screen is displayed and the user is prompted to lo
466. roduct User Profile PUP tables are per user per database as for SOL Plus client server installations See PRODUCT USER PROFILE Table for more information about PUP tables The global configuration file glogin sql is read from the middle tier machine as for a client server installation No user login sgl file is read SQL Plus Security 10 13 iSQL Plus Security 10 14 SQL Plus User s Guide and Reference 11 Database Administration with SQL Plus This chapter provides a brief overview of the database administration tools available in SQL Plus and discusses the following topics a Overview Introduction to Database Startup and Shutdown Redo Log Files Database Recovery This chapter is intended for use by database administrators In order to access the functionality of the commands mentioned in this chapter database administrator privileges are necessary For more information on database administration see the Oracle9i Database Concepts manual Database Administration with SQL Plus 11 1 Overview Overview Special operations such as starting up or shutting down a database are performed by a database administrator DBA The DBA has certain privileges that are not assigned to normal users The commands outlined in this chapter would normally be used by a DBA For more information about security and roles in SQL Plus see Chapter 10 SQL Plus Security Introduction to Database Startup and Shutdown
467. roes A zero 0 is displayed for a value of zero 0999 Displays a leading zero or a value of zero in this position as 9990 9999 Prefixes value with dollar sign B9999 Displays a zero value as blank regardless of 0 s in the format model 9999MI Displays after a negative value For a positive value a trailing space is displayed 89999 Returns for positive values and for negative values in this position 9999PR Displays a negative value in angle brackets For a positive value a leading and trailing space is displayed 99D99 Displays the decimal character in this position separating the integral and fractional parts of a number 96999 Displays the group separator in this position C999 Displays the ISO currency symbol in this position 13 32 SQL Plus User s Guide and Reference COLUMN Table 13 1 Number Formats Element Examples Description L L999 Displays the local currency symbol in this position comma 9 999 Displays a comma in this position period 99 99 Displays a period decimal point in this position separating the integral and fractional parts of a number V 999V99 Multiplies value by 10 where n is number of 9 s after V EEEE 9 999EEEE Displays value in scientific notation format must contain exactly four E s RNorrn RN Displays upper or lowercase Roman numerals Value can be an integer between 1 and 3999 DATE DATE Displays value as a date in MM DD YY format u
468. rror Messages 14 19 SQL Plus Error Messages SP2 0501 Error in SELECT statement Oracle_database_error_message Cause Invalid SELECT statement found in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0513 Misplaced CREATE keyword Cause The CREATE keyword was in the wrong position in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0514 Misplaced REPLACE keyword Cause The REPLACE keyword was in the wrong position in the COPY command Action Check the syntax of the COPY command for the correct options SP2 0515 Maximum number of columns max_num_columns exceeded Cause The maximum number of columns was exceeded in the COPY command Action Reduce the number of columns and try again SP2 0516 Invalid command_name name NULL encountered Cause An invalid or null column name was specified in either the COLUMN or the ATTRIBUTE command Action Retry the operation with a valid column name SP2 0517 Missing comma or right parenthesis Cause A missing right parenthesis was identified in the COPY command Action Retry the operation with a comma or right parenthesis SP2 0518 Missing USING clause Cause USING keyword is missing in the USING clause of the COPY command Action Specify the USING keyword before the USING clause of the COPY command 14 20 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0519
469. s This chapter explains how to format your query results to produce a finished report This chapter does not discuss HTML output but covers the following topics Formatting Columns Clarifying Your Report with Spacing and Summary Lines Defining Page and Report Titles and Dimensions a Storing and Printing Query Results Read this chapter while sitting at your computer and try out the examples shown Before beginning make sure you have access to the HR sample schema described in Chapter 1 SOL Plus Overview Formatting SQL Plus Reports 7 1 Formatting Columns Formatting Columns Through the SQL Plus COLUMN command you can change the column headings and reformat the column data in your query results Changing Column Headings When displaying column headings you can either use the default heading or you can change it using the COLUMN command The following sections describe how default headings are derived and how to alter them using the COLUMN command See the COLUMN command on page 13 29 for more details Default Headings SQL Plus uses column or expression names as default column headings when displaying query results Column names are often short and cryptic however and expressions can be hard to understand Changing Default Headings You can define a more useful column heading with the HEADING clause of the COLUMN command in the following format COLUMN column_name HEADING column_heading Example 7 1 Cha
470. s 1 byte or 1 character The maximum 7 for a CHAR variable with character semantics is determined by the number of bytes required to store each character for the chosen character set with an upper limit of 2000 bytes The length semantics are determined by the length qualifiers CHAR or BYTE and if not explicitly stated the value of the NL5 LENGTH SEMANTICS environment variable is applied to the bind variable Explicitly stating the length semantics at variable definition stage will always take precedence over the NL5 LENGTH SEMANTICS setting NCHAR Creates a variable of type NCHAR national character with length one SQL Plus Command Reference 13 145 VARIABLE NCHAR n Creates a variable of type NCHAR with length n characters The maxi mum that n can be is determined by the number of bytes required to store each character for the chosen national character set with an upper limit of 2000 bytes The only exception to this is when a SQL Plus ses sion is connected to a pre Oracle9i server or the SOLPLUSCOMPATI BILITY system variable is set to a version less than 9 0 0 In this case the length n can be in bytes or characters depending on the chosen national character set with the upper limit of 2000 bytes still retained VARCHAR2 n CHAR BYTE Creates a variable of type VARCHAR2 with length of up to n bytes or n characters The maximum that n can be is 4000 bytes and the mini mum is 1 byte or 1 character The maximum n f
471. s SQL Plus user guide and tutorial content scripts writing information and SQL Plus tuning security database administration and globalization information Chapter 5 SQL Plus Basics Explains how to enter and execute commands You learn by following step by step examples using sample tables Xix XX Chapier 6 Using Scripts in SQL Plus Contains further examples to help you learn to write and edit scripts containing SQL Plus SOL and PL SQL statements and commands Chapter 7 Formatting SQL Plus Reports Uses examples to explain how you can format your query results to produce a finished report It does not discuss HTML output Chapter 8 Generating HTML Reports from SQL Plus Explains how to generate a HTML report containing your query results Chapter 9 Tuning SQL Plus Explains how to obtain and use statistics and other mechanisms to obtain optimal performance from SQL Plus Chapter 10 SQL Plus Security Explains how to restrict access to databases and to certain SOL Plus and SOL commands Chapter 11 Database Administration with SQL Plus Explains basic database administration features in SOL Plus for Database Administrators DBAs Chapter 12 SQL Plus Globalization Support Explains how to configure globalization support in command lineSQL Plus and iSQL Plus user interfaces PART Ill SQL Plus Reference Contains SOL Plus Command Reference and Error Messages Chapter 13 SQL Plus Command Reference
472. s interprets text after the ampersand character amp as a substitution variable and prompts for the value of the variable You can SET DEFINE OFF to prevent scanning for the substitution character For more information on substitution and termination characters see DEFINE SOLTERMINATOR and SOLBLANKLINES in the SET command on page 13 95 Using Scripts in SQL Plus 6 13 Running Scripts Running Scripts E The START command retrieves a script and runs the command s it contains Use START to run a script containing SOL commands PL SQL blocks and SQL Plus commands You can have many commands in the file Follow the START command with the name of the file START file name If the file has the extension SQL you need not add the period and the extension SQL to the filename Example 6 7 Running a Script To retrieve and run the command stored in SALES SQL enter START SALES SQL Plus runs the commands in the file SALES and displays the results of the commands on your screen formatting the query results according to the SQL Plus commands in the file LAST NAME MONTHLY SALARY COMMISSION Russell 14 000 0 40 Partners 13 500 0 30 Errazuriz 12 000 0 30 Cambrault 11 000 0 30 Zlotkey 10 500 0 20 To see the commands as SQL Plus enters them you can set the ECHO variable of the SET command to ON The ECHO variable controls the listing of the commands in scripts run with the START and commands Setting th
473. s that display shift characters as a visible character for example a space or a colon INVISIBLE is the opposite and does not display any shift characters To enable the display of shift characters on a terminal that supports them enter SET SHIFTINOUT VISIBLE SELECT LAST NAME JOB ID FROM EMP DETAILS VIEW WHERE SALARY 12000 SQL Plus Command Reference 13 117 SET LAST_NAME JOB_ID JJOO AABBCC AA abc DDEE e where visible shift character uppercase represents multibyte characters lowercase represents singlebyte characters SET SHOW MODE ON OFF SET SHOWMODE is not supported in iSQL Plus Controls whether SQL Plus lists the old and new settings of a SOL Plus system variable when you change the setting with SET ON lists the settings OFF suppresses the listing SHOWMODE ON has the same behavior as the obsolete SHOWMODE BOTH SET SQLBL ANKLINES ON QFF Example ca SET SQLBLANKLINES is not supported in iSQL Plus Controls whether SQL Plus allows blank lines within a SQL command or script ON interprets blank lines and new lines as part of a SOL command or script OFF the default value does not allow blank lines or new lines in a SOL command or script or script Enter the BLOCKTERMINATOR to stop SOL command entry without running the SQL command Enter the SOLTERMIN ATOR character to stop SOL command entry and run the SOL statement To allow blank lines in a SOL statement enter
474. s will not affect queries you run in a given file 7 22 SQL Plus User s Guide and Reference Defining Page and Report Titles and Dimensions Defining Page and Report Titles and Dimensions The word page refers to a screen full of information on your display or a page of a spooled printed report You can place top and bottom titles on each page set the number of lines per page and determine the width of each line The word report refers to the complete results of a query You can also place headers and footers on each report and format them in the same way as top and bottom titles on pages Setting the Top and Bottom Titles and Headers and Footers As you have already seen you can set a title to display at the top of each page of a report You can also set a title to display at the bottom of each page The TTITLE command defines the top title the BTITLE command defines the bottom title You can also set a header and footer for each report The REPHEADER command defines the report header the REPFOOTER command defines the report footer A TTITLE BTITLE REPHEADER or REPFOOTER command consists of the command name followed by one or more clauses specifying a position or format and a CHAR value you wish to place in that position or give that format You can include multiple sets of clauses and CHAR values TTITLE position_clause s char_value position_clause s char_value BTITLE position clause s char value position_
475. sed to format NUMBER columns that represent Julian dates The MI and PR format elements can only appear in the last position of a number format model The S format element can only appear in the first or last position If a number format model does not contain the MI S or PR format ele ments negative return values automatically contain a leading negative sign and positive values automatically contain a leading space A number format model can contain only a single decimal character D or period but it can contain multiple group separators C or com mas A group separator or comma cannot appear to the right of a decimal character or period in a number format model SQL Plus formats NUMBER data right justified A NUMBER column s width equals the width of the heading or the width of the FORMAT plus one space for the sign whichever is greater If you do not explic itly use FORMAT then the column s width will always be at least the value of SET NUMWIDTH SQL Plus may round your NUMBER data to fit your format or field width SQL Plus Command Reference 13 33 COLUMN If a value cannot fit within the column width SOL Plus indicates over flow by displaying a pound sign in place of each digit the width allows If a positive value is extremely large and a numeric overflow occurs when rounding a number then the infinity sign replaces the value Likewise if a negative value is extremely small and a numeric ove
476. service name depends upon the Oracle Net protocol your computer uses For more information see CONNECT on page 13 46 and the Oracle Net guide appropriate for your protocol or contact your DBA Note Do not confuse the symbol of the connect identifier with the command used to run a script 4 22 SQL Plus User s Guide and Reference Part Il Using SQL Plus This section helps you learn how to use SQL Plus how to tune SQL Plus for better performance how to restrict access to tables and commands and provides overviews of database administration tools and globalization support The following chapters are covered in this section SQL Plus Basics Using Scripts in SQL Plus Formatting SQL Plus Reports Generating HTML Reports from SQL Plus Tuning SQL Plus SQL Plus Security Database Administration with SQL Plus SQL Plus Globalization Support 9 SQL Plus Basics This chapter helps you learn the basics of using SOL Plus including the following topics Entering and Executing Commands Running SOL Commands Running PL SQL Blocks Running SQL Plus Commands System Variables that Affect How Commands Run Saving Changes to the Database Automatically Stopping a Command while it is Running Running Host Operating System Commands Getting Help Listing a Table Definition Listing PL SQL Definitions Controlling the Display Interpreting Error Messages SQL Plus Basics 5 1 Entering and Executing Comm
477. sh table collisions since startup Interpreting Active Statistics The cumulative count of active HTTP requests since the iSQL Plus server was started The number of minutes rounded down until the next expiry process The number of times the expiry process has run since the iSQL Plus Server started The number of active sessions that currently have a hash table collision Compare this with Sessions active to see if there is a current problem with collisions The cumulative count of the sessions that have had a hash table collision since the iSQL Plus Server started Compare this with Sessions since startup to see if there is a problem with collisions The following notes provide some interpretation of the active statistics Increasing Number of Threads If users have more idle time compared to active time then a higher value of iSQLPlusNumberOfThreads may be needed Each thread can handle one user request A request begins when a user clicks a button or follows a command link in iSQL Plus and finishes when all results have been returned to the user Active time is when a user request is in progress and a thread to process it is consumed Idle time is when a user request has been processed and the associated processing thread is available for use by another iSQL Plus session Note that if iSQLPlusHashTableSize is not specified in the isqlplus conf its value will increase when iSQLPlusNumberOfThreads is increased Incre
478. spec or the next LEFT CENTER RIGHT or COL command CEN TER and RIGHT use the SET LINESIZE value to calculate the position of the data item that follows BOLD Prints data in bold print SOL Plus represents bold print on your termi nal by repeating the data on three consecutive lines On some operat ing systems SQL Plus may instruct your printer to print bold text on three consecutive lines instead of bold FORMAT text Specifies a format model that determines the format of following data items up to the next FORMAT clause or the end of the command The format model must be a text constant such as A10 or 999 See the COL UMN FORMAT command for more information on formatting and valid format models If the datatype of the format model does not match the datatype of a given data item the FORMAT clause has no effect on that item If no appropriate FORMAT model precedes a given data item SQL Plus prints NUMBER values using the format specified by SET 13 142 SQL Plus User s Guide and Reference TTITLE Usage Examples n NUMFORMAT or if you have not used SET NUMFORMAT the default format SQL Plus prints DATE values according to the default format Refer to the FORMAT clause of the COLUMN command in this chap ter for more information on default formats Enter TTITLE with no clauses to list the current TTITLE definition If you do not enter a printspec clause before the first occurrence of text T TITL
479. specified keyword SP2 0019 Invalid numeric argument to option name option Cause An invalid numeric argument was used in the specified option Action Correct the argument and try again 14 2 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0020 No storage available for column_name Cause An error has occurred SQL Plus was unable to allocate memory for a BREAK command Action Allocate more memory by closing some applications SP2 0022 Cannot allocate space to modify the buffer_name buffer variable Cause An internal error occurred Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0023 String not found Cause The search string specified was not found Action Check the search string to make sure that it is valid SP2 0024 Nothing to change Cause There was nothing in the SQL buffer when using the CHANGE command Action Make sure the SQL buffer is not empty before using the CHANGE command SP2 0025 Invalid change string Cause An invalid option was used in the CHANGE command Action Check the syntax of the CHANGE command for the correct options SP2 0026 No lines to delete Cause There was nothing in the SQL buffer when using the DEL command Action Make sure the SQL buffer is not empty before using the DEL command SP2 0027 Input is too long gt max_characters ch
480. specify the type function procedure package package body trigger view type type body dimension or java class and the name of the PL SQL stored procedure SQL Plus shows errors for that stored procedure For more information on compilation errors see your PL SQL User s Guide and Reference schema contains the named object If you omit schema SHOW ERRORS assumes the object is located in your current schema SHOW ERRORS output displays the line and column number of the error LINE COL as well as the error itself ERROR LINE COL and ERROR have default widths of 8 and 65 respectively You can alter these widths using the COLUMN command Shows the current line number the position in the current page of the display and or spooled output PARAMETERS parameter name Displays the current values for one or more initialization parameters You can use a string after the command to see a subset of parameters whose names include that string For example if you enter SHOW PARAMETERS COUNT db file multiblock read count integer 12 Spin count integer 0 The SHOW PARAMETERS command without any string following the command displays all initialization parameters Your output may vary depending on the version and configuration of the Oracle database server to which you are connected You need SQL Plus Command Reference 13 125 SHOW PNO REL EASE SELECT ON V_ PARAMETER object privileges to use the PARAME TERS clause
481. ssseeeeeeeeee eene nnne 7 9 Listing and Resetting Column Display Attributes sssssssssseeeenee 7 9 Suppressing and Restoring Column Display Attributes sss 7 10 Printing a Line of Characters after Wrapped Column Values 2 5 7 10 Clarifying Your Report with Spacing and Summary Lines sees 7 12 Suppressing Duplicate Values in Break Columns esses 7 12 Inserting Space when a Break Column s Value Changes sss 7 13 Inserting Space after Every ROW ssis isei sss eene nnne 7 14 Using Multiple Spacing Techniques esessssseseeeeeeeee ee eene 7 14 Listing and Removing Break Definitions eese eee ne 7 16 Computing Summary Lines when a Break Column s Value Changes 7 16 Computing Summary Lines at the End of the Report sees 7 20 Computing Multiple Summary Values and Lines sss 7 20 Listing and Removing COMPUTE Definitions eee eee eee nen 7 22 Defining Page and Report Titles and Dimensions sse 7 23 Setting the Top and Bottom Titles and Headers and Footers sess 7 23 Displaying System Maintained Values in Titles sss 7 27 Listing Suppressing and Restoring Page Title Definitions sss 7 29 vii Displaying Column Values in Titles sse ee
482. st for a description of each term or clause FILE Keyword to specify that the following argument is the name you want to give to the saved script This optional keyword is usually omitted If you want to save the script with the name file because it is a com mand keyword you need to put the name file in single quotes file name ext Specifies the script in which you wish to save the buffer s contents CREATE Creates a new file with the name specified This is the default behavior REP LACE Replaces the contents of an existing file If the file does not exist REPLACE creates the file APP END Adds the contents of the buffer to the end of the file you specify If you do not specify an extension SQL Plus assumes the default command file extension normally SQL For information on changing this default extension see the SUFFIX variable of the SET command in this chapter If you wish to SAVE a file under a name identical to a SAVE command clause CREATE REPLACE or APPEND you must specify a file extension When you SAVE the contents of the SOL buffer SAVE adds a line containing a slash to the end of the file SQL Plus Command Reference 13 93 SAVE Examples To save the contents of the buffer in a file named DEPTSALRPT with the extension SQL enter SAVE DEPTSALRPT To save the contents of the buffer in a file named DEPTSALRPT with the extension OLD enter SAVE DEPTSALRPT OLD 13 94 SQL Plus User s Guide and
483. st line Lists the current line n Lists the current line through line n LAST Lists the current line through the last line LAST Lists the last line Enter LIST with no clauses to list all lines The last line or only line listed becomes the new current line marked by an asterisk To list the contents of the buffer enter LIST You will see a listing of all lines in the buffer similar to the following example SELECT LAST NAME DEPARTMENT ID JOB ID 2 FROM EMP DETAILS VIEW WHERE JOB ID SH CLERK ORDER BY DEPARTMENT ID 4 The asterisk indicates that line 4 is the current line SQL Plus Command Reference 13 73 LIST To list the second line only enter LIST 2 The second line is displayed 2 FROM EMP_DETAILS_VIEW To list the current line now line 2 to the last line enter LIST LAST You will then see this 2 FROM EMP DETAILS VIEW 3 WHERE JOB ID SH CLERK 4 ORDER BY DEPARTMENT ID 13 74 SQL Plus User s Guide and Reference PASSWORD PASSWORD PASSWORD is not available in iSQL Plus In iSQL Plus use the Password screen Syntax PASSW ORD username Allows you to change a password without echoing it on an input device Terms Refer to the following for a description of the clause or term username Specifies the user If omitted username defaults to the current user Usage To change the password of another user you must have been grant
484. sword 4 10 SQL Plus User s Guide and Reference The SQLPLUS Command it could be viewable by anyone on your system Some operating sys tems have monitoring tools that list all executing commands and their arguments If you omit username and password SQL Plus prompts you for them If you omit only password SQL Plus prompts you for password When prompting SQL Plus does not display password on your terminal screen In silent mode username and password prompts are not visible your username will appear as you type it but not your password connect identifier Consists of an Oracle Net connect identifier The exact syntax depends upon the Oracle Net communications protocol your Oracle installation uses For more information refer to the Oracle Net manual appropriate for your protocol or contact your DBA Represents a default logon using operating system authentication You cannot enter a connect identifer if you use a default logon In a default logon SQL Plus typically attempts to log you in using the username OPS name where name is your operating system username Note that the prefix OPS can be set to any other string of text For example you may wish to change the settings in your INIT ORA parameters file to LOGONname or USERIDname See the Oracle9i Database Administra tor s Guide for information about operating system authentication AS SYSOPER SYSDBA INOLOG The AS clause allows privileged connections by users w
485. sword in either the COPY FROM clause or the COPY TO clause SOL Plus will prompt you for it SOL Plus suppresses the dis play of your password response B 2 SQL Plus User s Guide and Reference COPY Command Syntax APPEND CREATE INSERT REPLACE You must include the connect_identifier clause which consists of an Ora cle Net connection string to specify the source or destination database The exact syntax depends upon the Oracle Net communications proto col your Oracle installation uses For more information refer to the Ora cle Net manual appropriate for your protocol or contact your DBA Inserts the rows from query into destination_table if the table exists If destination_table does not exist COPY creates it Inserts the rows from query into destination_table after first creating the table If destination_table already exists COPY returns an error Inserts the rows from query into destination_table If destination_table does not exist COPY returns an error When using INSERT the USING query must select one column for each column in the destination_table Replaces destination_table and its contents with the rows from query If destination_table does not exist COPY creates it Otherwise COPY drops the existing table and replaces it with a table containing the copied data destination_table Represents the table you wish to create or to which you wish to add data column column column USING query
486. t lt td gt lt input type text name script value employee sql size 40 gt lt td gt lt tr gt lt tr gt lt td gt lt input type submit value Run it amp nbsp input type reset value Reset Form gt lt td gt td amp nbsp lt td gt lt tr gt lt table gt lt form gt lt body gt lt html gt Perl Script for CGI Example In this example the CGI script is a Perl script but it could be a shell script a Java class or any other language supported by your web server Create the following Perl CGI script and save it as plus pl in the cgi bin directory of your web server usr local bin perl w 8 8 SQL Plus User s Guide and Reference Creating Reports using Command line SQL P lus Copyright c Oracle Corporation 1999 2002 All Rights Reserved NAME plus pl DESCRIPTION This is a demonstration program to run a SQL Plus report via CGI It is provided as is with no warranty implied or expressed Users are strongly recommended to understand error handling and security issues before implementing CGI scripts NOTES This demostration requires that SQL Plus 9 2 0 or later is installed on your web server and the web server is configured to run CGI programs The database may be on another machine but must have Oracle Net access configured This demonstration consists of three files plus html Sample HTML form that you open in your web browser It calls plus pl to run employee sql plus pl
487. t authenticate with the Oracle HTTP Server and have Oracle SYSDBA or SYSOPER privileges from the Oracle instance To connect with either SYSDBA or SYSOPER privileges your username and password must be added to the Oracle HTTP Server authentication file See Enabling DBA Access on page 10 9 Because of possible HTTP network timeouts it is recommended that you use command line SQL Plus for long running DBA operations To log in with SYSDBA or SYSOPER privileges you must enter the iSQL Plus DBA URL in the Location Address field of your web browser The iSQL Plus DBA URL is in the form http machine name domain port isqlplusdba The following dialog box is displayed prompting you to enter your Oracle HTTP Server authentication username and password Enter Network Password x qe Please type your user name and password Site rooster au oracle cam Realm iSQL Plus DBA UserName freva Password freee Save this password in your password list OK Cancel User Name Enter a valid Oracle HTTP Server authentication username This may not be the same as your Oracle9i username Password Enter a valid Oracle HTTP Server authentication password for the username This may not be the same as your Oracle9i password After you have successfully authenticated the iSQL Plus DBA Login screen is displayed 2 10 SQL Plus User s Guide and Reference iSQL P lus User Interface I File Edt V
488. t text graphics data and computations break An event such as a change in the value of an expression that occurs while SQL Plus processes a query or report You can direct SQL Plus to perform various operations such as printing subtotals whenever specified breaks occur break column A column in a report that causes a break when its value changes and for which the user has defined break operations break group A group containing one or more break columns break hierarchy The order in which SQL Plus checks for the occurrence of breaks and triggers the corresponding break operations break order Indicates the order in which to display a break column s data Valid options are Ascending and Descending break report A report that divides rows of a table into sets based on a common value in the break column Glossary 3 Glossary 4 buffer An area where the user s SQL statements or PL SQL blocks are temporarily stored The SQL buffer is the default buffer You can edit or execute commands from multiple buffers however SOL Plus does not require the use of multiple buffers byte A group of eight sequential bits that represents a letter number or symbol that is a character Treated as a unit of data by a computer CGI script See Common Gateway Interface CHAR datatype An Oracle datatype provided for ANSI ISO compatibility A CHAR column is a fixed length column and can contain any printable characters
489. t COMPATIBILITY to V7 for Oracle7 or to V8 for Oracle8 or later COMPATIBILITY always defaults to NATIVE COMPATIBILITY should be correctly set for the version of Oracle SQL syntax you want to use on the database to which you are connected otherwise you may be unable to run any SQL commands 13 104 SQL Plus User s Guide and Reference SET Example To run a script SALARY SQL created with Oracle7 SQL syntax enter SET COMPATIBILITY V7 START SALARY After running the file reset compatibility to NATIVE to run scripts created for Oracle9i SET COMPATIBILITY NATIVE Alternatively you can add the command SET COMPATIBILITY V7 to the beginning of the script and reset COMPATIBILITY to NATIVE at the end of the file SET CON CAT c ON OFF Sets the character used to terminate a substitution variable reference when SQL Plus would otherwise interpret the next character as a part of the variable name SQL Plus resets the value of CONCAT to a period when you switch CONCAT on SET COPYC OMMIT 0n Controls the number of batches after which the COPY command commits changes to the database COPY commits rows to the destination database each time it copies n row batches Valid values are zero to 5000 You can set the size of a batch with the ARRAYSIZE variable If you set COPYCOMMIT to zero COPY performs a commit only at the end of a copy operation SET COPYTYPECHECK ON OFF Sets the suppression of the comparison of datatypes
490. t contains the attributes STREET and CITY enter CREATE TYPE ADDRESS AS OBJECT STREET VARCHAR2 20 CITY VARCHAR2 20 i Type created DESCRIBE address SQL Plus Command Reference 13 55 DESCRIBE n Name Null Type STREET VARCHAR2 20 CITY VARCHAR2 20 To create and describe the object type EMPLOYEE that contains the attributes LAST NAME EMPADDR JOB ID and SALARY enter CREATE TYPE EMPLOYEE AS OBJECT LAST NAME VARCHAR2 30 EMPADDR ADDRESS JOB ID VARCHAR2 20 SALARY NUMBER 7 2 Type created DESCRIBE employee Name Null Type LAST_NAME VARCHAR2 30 EMPADDR ADDRESS JOB_ID VARCHAR2 20 SALARY NUMBER 7 2 To create and describe the object type addr_type as a table of the object type ADDRESS enter CREATE TYPE addr_type IS TABLE OF ADDRESS Type created DESCRIBE addr_type addr_type TABLE OF ADDRESS Name Null Type STREET VARCHAR2 20 CITY VARCHAR2 20 13 56 SQL Plus User s Guide and Reference DESCRIBE E To create and describe the object type addr_varray as a varray of the object type ADDRESS enter CREATE TYPE addr_varray AS VARRAY 10 OF ADDRESS Type created DESCRIBE addr_varray addr_varray VARRAY 10 OF ADDRESS Name Null Type STREET VARCHAR2 20 CITY VARCHAR2 20 To create and describe the table department that contains
491. t in the DESCRIBE command Action Remove the column specification in the DESCRIBE command and try again SP2 0568 No bind variables declared Cause There are no bind variables declared Action No action required SQL Plus Error Messages 14 23 SQL Plus Error Messages SP2 0570 Usage SET SERVEROUTPUT ON OFF SIZE SIZE n FOR MAT WRA PPED WOR D_WRAPPED TRU NCATED Cause An invalid option was used in the SET SERVEROUTPUT command Action Specify a valid option SP2 0575 Use of Oracle SOL feature not in SOL92 Entry Intermediate Full Level Cause A SQL statement was attempted that is not FIPS compliant This error may also occur if a SOL Plus feature for example SET AUTOTRACE that uses SQL specific to Oracle was turned on when using FIPS flagging Action Use SET FLAGGER and turn FIPS compliance checking OFF or rewrite the statement SP2 0577 Usage SET FLAGGER OFF ENTRY INTERMEDIATE FULL Cause An invalid option was specified in the SET FLAGGER command Action Specify a valid option SP2 0581 Object object name is a package use DESCRIBE package procedure Cause A attempt was made to describe a package as stand alone no sub object such as a procedure was supplied Action Use the DESCRIBE command to describe a sub object within a package SP2 0582 Usage EXIT QUIT SUCCESS FAILURE WARNING n variable lt bindvariable gt COMMIT ROLLBACK Cause An option to
492. ta in an existing table or create a new table if the destination table does not exist APPEND specifies the following actions Ifthe destination table already exists COPY inserts the copied data in the destination table a Ifthe table does not already exist COPY creates the table and then inserts the copied data in it Example B 1 Copying from a Remote Database to Your Local Database Using CREATE To copy HR from a remote database into a table called EMPLOYEE COPY on your own database enter the following command SQL Plus COPY Command B 7 Copying Data from One Database to Another E E Note See your DBA for an appropriate username password and service name for a remote computer that contains a copy of EMPLOYEE_COPY COPY FROM HR your_password BOSTONDB CREATE EMPCOPY USING SELECT FROM HR Array fetch bind size is 15 arraysize is 15 Will commit when done copycommit is 0 Maximum long size is 80 long is 80 SQL Plus then creates the table EMPLOYEE COPY and copies the rows Table SALESMAN created 5 rows selected from HR BOSTONDB 5 rows inserted into SALESMAN 5 rows committed into SALESMAN at DEFAULT HOST connection In this COPY command the FROM clause directs COPY to connect you to the database with the specification D BOSTON MFG as HR with the password your password Notice that you do not need a semicolon at the end of the command COPY is
493. tabase to another remote database most systems Note In general the COPY command was designed to be used for copying data between Oracle and non Oracle databases You should use SQL commands CREATE TABLE AS and INSERT to copy data between Oracle databases Understanding COPY Command Syntax You enter the COPY command in the following form COPY FROM database TO database action destination table column name column name column name USING query Here is a sample COPY command COPY FROM HR your_password BOSTONDB TO TODD your_password CHICAGODB CREATE NEWDEPT DEPARTMENT ID DEPARTMENT NAME CITY USING SELECT FROM EMP DETAILS VIEW To specify a database in the FROM or TO clause you must have a valid username and password for the local and remote databases and know the appropriate Oracle Net service names COPY obeys Oracle security so the username you specify must have been granted access to tables for you to have access to tables For information on what databases are available to you contact your DBA When you copy to your local database from a remote database you can omit the TO clause When you copy to a remote database from your local database you can omit the FROM clause When you copy between remote databases you must include SQL Plus COPY Command B 5 Copying Data from One Database to Another both clauses However including both clauses increases the readability of your scripts
494. tart the Oracle HTTP Server by entering apache k start On UNIX do the following steps 1 Openaterminal Configuring SQL Plus 3 13 iSQL Plus Configuration 2 Change directory to the Oracle HTTP Server home bin directory by entering cd SORACLE HOME Apache Apache bin 3 Stop the running Oracle HTTP Server by entering apachectl stop 4 Start the Oracle HTTP Server by entering apachectl start Warning If the Oracle HTTP Server is started by a user who is a member of the dba or oper groups on UNIX or who is a member of the ORA DBA ORA OPER ORA SID DBA or ORA SID OPER groups on Windows the iSOL Plus DBA URL is automatically authenticated for Oracle9i by the operating system To avoid this start the Oracle HTTP Server as a user who is not a member of these operating system groups Users of the iSQL Plus DBA URL can authenticate for Oracle9i using as sysdba or as sysoper Enabling or Disabling iSQL Plus You can edit the Oracle HTTP Server configuration file to disable iSQL Plus To disable iSOL Plus 1 Stop the Oracle HTTP Server 2 Change directory to the Oracle HTTP Server configuration directory by entering On Windows cd SORACLE_HOME Apache Apache conf On UNIX cd SORACLE HOME Apache Apache conf 3 Open the oracle apache conf configuration file 4 Comment out the isglplus conf include line by inserting a at the beginning of the line as follows 3 14 SQL
495. te trennen nenne 9 12 Interpreting Active Statistics eee enne e nennen 9 13 ISOLE Plus Turing NOtes enema rete e ne rene re eed er ete te 9 14 10 SQL Plus Security PRODUCT USER PROFILE Table ee eter tee ie cle ede ere deve Eee ERN 10 2 Creating the PUP Table ee eret ere rette eee tere petente 10 2 PUP TableStr cture eet tete demie etia t ce pd ut tege dn 10 3 Description and Use of PUP Columns sese eee eee nennen 10 3 PUR Table Administration iet ren e e ee Le p qe RS e ee Sead ee enh ie ne etel 10 4 Disabling SQL Plus SOL and PL SQL Commands eee 10 4 viii 11 12 Creating and Controlling Roles miasa a asi nennen nennen 10 6 Disabling SEF ROME cs 45d uo teet tei eret i tecta Notes Pete etp bete Eee d 10 7 Disabling User Roles einn onte ete te d e bred ee E iet ee 10 7 Disabling Commands with SOLPLUS RESTRICT eee ene 10 8 iSOL Plus Security een daa He eetlee aleman o oe E TS 10 9 Administration Privileges ie red ee ra ed e pene ne rene re reed 10 9 Enabling Server Authentication for Users sees ee eee 10 10 Enabling or Disabling Restricted Database ACCESS ssssssseseeeee eee 10 10 Enabling DBA ACCeSS e teh t mie i igncm nce Hon pratis nid eee iu 10 11 Adding Entries to an Oracle HTTP Server Authentication File sss 10 12 Security Usage NOLES ise ti ee t eret ier eedem ern E
496. tement or by recoding the query to select fewer records SP2 0055 Out of room while allocating portion of new definition_name Old definition if any retained Cause Unable to allocate memory to store the new definition Action Free up additional memory by closing applications not required reducing the size of the command or statement or by recoding the query to select fewer records SP2 0080 No COMPUTES currently defined Cause No COMPUTE definition Action Define a COMPUTE Check the syntax of the COMPUTE command for the correct options SQL Plus Error Messages 14 5 SQL Plus Error Messages SP2 0081 Maximum of number COMPUTE functions allowed at a time Cause The maximum number of COMPUTE functions has been exceeded Action Reduce the number of COMPUTE functions SP2 0082 No COMPUTE functions requested Cause No COMPUTE functions requested Action No action required SP2 0083 Warning COMPUTE option function_name specified number times Cause A label or a function was specified more than once Action Remove the unnecessary labels or functions SP2 0084 COMPUTE ON keyword specified already Cause The ON keyword was specified more than once Action Specify the ON keyword once in the command SP2 0085 COMPUTE OF keyword specified already Cause The OF keyword was specified more than once Action Specify the OF keyword once in the command SP2 0087 No room to allocate COMPUTE control block for colum
497. ter displaying each screen of a query or report For more information refer to the SET command on page 13 95 Interpreting Error Messages n If SQL Plus detects an error in a command it displays an error message See Chapter 14 SOL Plus Error Messages for a list of SOL Plus error messages Example 5 6 Interpreting an Error Message If you attempt to execute a file that does not exist or is unavailable by entering START EMPLYYES SQL An error message indicates that the table does not exist SP2 0310 unable to open file emplyyes sql You will often be able to figure out how to correct the problem from the message alone If you need further explanation take one of the following steps to determine the cause of the problem and how to correct it a Ifthe error is a numbered error beginning with the letters SP2 look up the SQL Plus message in Chapter 14 SOL Plus Error Messages of this guide Ifthe error is a numbered error beginning with the letters CPY look up the SQL Plus COPY command message in Chapter 14 SQL Plus Error Messages of this guide a If the error is a numbered error beginning with the letters ORA look up the Oracle message in the Oracle9i Database Error Messages guide or in the Oracle installation and user s guides provided for your operating system If the error is unnumbered look up correct syntax for the command that generated the error in Chapter 13 SQL Plus Command Refere
498. terminates abnor mally Does not wait for current calls to complete or users to disconnect from the database Further connects are prohibited The database is closed and dis mounted The instance is shutdown and no instance recovery is required on the next database startup NORMAL is the default option which waits for users to disconnect from the database Further connects are prohibited The database is closed and dis mounted The instance is shutdown and no instance recovery is required on the next database startup SQL Plus Command Reference 13 129 SHUTDOWN Usage Examples TRANSACTIONAL LOCAL Performs a planned shutdown of an instance while allowing active transactions to complete first It prevents clients from losing work with out requiring all users to log off No client can start a new transaction on this instance Attempting to start a new transaction results in disconnection After completion of all transactions any client still connected to the instance is disconnected Now the instance shuts down just as it would if a SHUTDOWN IMME DIATE statement was submitted The next startup of the database will not require any instance recovery procedures The LOCAL mode specifies a transactional shutdown on the local instance only so that it only waits on local transactions to complete not all transactions This is useful for example for scheduled outage main tenance SHUTDOWN with no arguments
499. th the EDIT command follow the word EDIT with the name of the file For example to edit an existing file named PROFIT that has the extension SQL enter the following command EDIT PROFIT Remember that EDIT assumes the file extension SQL if you do not specify one Using Scripts in SQL Plus 6 3 Editing Scripts in SQL P lus Editing Scripts in SQL Plus Because SQL Plus does not store SQL Plus commands in the buffer you edit a SQL Plus command entered directly at the command prompt by using Backspace or by re entering the command You can use a number of SQL Plus commands to edit the SQL command or PL SQL block currently stored in the buffer Alternatively you can use a host operating system editor to edit the buffer contents Table 6 1 lists the SQL Plus commands that allow you to examine or change the command in the buffer without re entering the command Table 6 1 SQL Plus Editing Commands Command Abbreviation Purpose APPEND text CHANGE old new CHANGE text CLEAR BUFFER PUT PUT text LIST LIST n LIST 6 4 SQL Plus User s Guide and Reference A text C old new C text CL BUFF text L nor n adds text at the end of a line changes old to new in a line deletes text from a line deletes all lines deletes the current line deletes line n deletes the current line deletes line n through the current line deletes the last line deletes a range of lines m to n delet
500. the FORMAT clause of the COLUMN command on page 13 29 Left justification is the default for datatypes Changing the Default Display You can change the displayed width of a datatype or DATE by using the COLUMN command with a format model consisting of the letter A for alphanumeric followed by a number representing the width of the column in characters Within the COLUMN command identify the column you want to format and the model you want to use COLUMN column name FORMAT model If you specify a width shorter than the column heading SQL Plus truncates the heading See the COLUMN command on page 13 29 for more details 7 6 SQL Plus User s Guide and Reference Formatting Columns Example 7 5 Formatting a Character Column To set the width of the column LAST_NAME to four characters and rerun the current query enter COLUMN LAST_NAME FORMAT A4 Zlot MONTHLY SALARY COMMISSION 14 000 4 13 500 3 12 000 E MONTHLY SALARY COMMISSION 11 000 53 10 500 2 If the WRAP variable of the SET command is set to ON its default value the employee names wrap to the next line after the fourth character as shown in Example 7 5 If WRAP is set to OFF the names are truncated cut off after the fourth character The system variable WRAP controls all columns you can override the setting of WRAP for a given column through the WRAPPED WORD_WRAPPED and TRUNCATED clauses of the COLUMN command See the COLU
501. the columns DEPARTMENT_ID PERSON and LOC enter CREATE TABLE department DEPARTMENT_ID NUMBER PERSON EMPLOYEE LOC NUMBER i Table created DESCRIBE department ame Null Type DEPARTMENT ID NUMBER PERSON EMPLOYEE LOC NUMBER To create and describe the object type rational that contains the attributes NUMERATOR and DENOMINATOR and the METHOD rational order enter CREATE OR REPLACE TYPE rational AS OBJECT NUMERATOR NUMBER DENOMINATOR NUMBER MAP MEMBER FUNCTION rational order RETURN DOUBLE PRECISION PRAGMA RESTRICT REFERENCES rational order RNDS WNDS RNPS WNPS SQL Plus Command Reference 13 57 DESCRIBE see FF a e FF CREATE OR REPLACE TYPE BODY rational AS OBJECT MAP MEMBER FUNCTION rational order RETURN DOUBLE PRECISION IS BEGIN RETURN NUMERATOR DENOMINATOR END END DESCRIBE rational UMERATOR NUMBER DENOMINATOR NUMBER AP MEMBER FUNCTION RATIONAL ORDER RETURNS NUMBER To create a table which contains a column of XMLType and describe it enter CREATE TABLE PROPERTY Price NUMBER Description SYS XMLTYPE Table created DESCRIBE PROPERTY Name Null Type PRICE NUMBER DESCRIPTION SYS XMLTYPE To format the DESCRIBE output use the SET command as follows SET LINESIZE 80 SET DESCRIBE DEPTH 2 SET DESCRIBE INDENT ON SET DESCRIBE LINE OFF To display the settings for the object use the SHOW command as foll
502. the file You can include multiple SOL commands and PL SQL blocks 6 2 SQL Plus User s Guide and Reference Modifying Scripts Example 6 1 Using a System Editor to Write a SQL Script Suppose you have composed a query to display a list of salespeople and their commissions You plan to run it once a month to keep track of how well each employee is doing To compose and save the query using your system editor you must invoke your editor and create a file to hold your script EDIT SALES You can enter SOL Plus SOL and PL SQL statements and commands Enter each of the following lines in your editor Do not forget to include the semicolon at the end of the SOL statement COLUMN LAST NAME HEADING LAST NAME COLUMN SALARY HEADING MONTHLY SALARY FORMAT 99 999 COLUMN COMMISSION PCT HEADING COMMISSION FORMAT 90 90 SELECT LAST NAME SALARY COMMISSION PCT FROM EMP DETAILS VIEW WHERE JOB ID SA MAN The zero in the format model for the column COMMISSION PCT tells SOL Plus to display an initial zero for decimal values and a zero instead of a blank when the value of COMMISSION PCT is zero for a given row Format models and the COLUMN command are described in more detail in Chapter 5 SQL Plus Basics and in the Oracle9i SQL Reference Now use your editor s save command to store your query in a file called SALES SQL Modifying Scripts You can modify an existing script using the EDIT command To edit an existing script wi
503. the link in the Script column to load a script into the Work Screen Script M selectemployee id from emp details view T selectjob id from emp details view select from emp details view Load Delete Cancel i l Connected as SYSTEMGicjones2 ffi Local intranet Script Shows the current list of scripts in History They are in most recently executed order with the most recent at the top You click the script text to load it into the Input area Scripts are displayed verbatim so be careful if you have included items like CONNECT commands which include passwords Load Loads the selected scripts into the Input area of the Work screen Delete Deletes the selected scripts from History Cancel Cancels the History screen without making further changes or loading a script from History SQL Plus User Interface 2 7 iSQL Plus User Interface iSQL Plus Preferences Screen The Preferences screen allows you to set interface options and system variables and to change your password Be Edit View Favorites Tools Help EJ B ORACLE E A A B Ta ISOL Plus Logout New History Preferences Help EE Session Work Screen Preferences Preferences Set interface options Gg Set system variables Gg Change your password Gg Cancel zi l Connected as SYSTEM cjones2 Fi Local intranet Set interface options Click Set interface options or the adjacent Go button to
504. ting system editor 6 2 13 61 file loading into buffer 13 66 running commands from SQL Plus 5 12 13 69 HTML 8 2 clause 4 5 entities 8 12 option 4 5 running dynamic reports 8 13 spooling to file 4 8 tag 82 htpasswd adding username password file entries 10 12 HTTP HTTPS security 10 9 security 10 9 HTTP Server adding authentication entries 10 12 authentication 2 10 10 10 authentication username password entries 3 11 configuring 3 12 configuring globalization support 12 4 enabling DBA 10 11 testing configuration file 3 12 httpd conf 3 12 testing httpd conf edits 3 15 hyphen continuing SOL Plus command 5 9 13 1 idle timeout parameter 9 14 IMMEDIATE mode 13 129 infinity sign 13 34 initialization parameters displaying 13 125 INIT ORA file parameter file 13 134 input accepting Return 6 30 accepting values from the user 6 27 13 10 inputarea 2 6 editing 5 2 INPUT command 6 4 6 7 13 71 entering severallines 13 71 INSERT clause B 3 B 7 INSERT command disabling 10 5 installation default users created 4 17 INSTANCE variable 13 97 13 110 instances shutting down 13 129 starting 13 134 Interface options screen 2 9 iplus css 3 11 iplusdba pw 10 11 iplus pw 10 10 iSQL Plus 2 3 access modes 10 9 cascading style sheet 3 11 Change Password screen 4 19 configuring 3 5 configuring extension for windows 3 15 configuring globalization support 12 3 configuring HTTP S
505. tion is not valid in this command Action Check the syntax of the command you used for the correct options SP2 0187 Error in variable assignment Cause The assignment for the specified variable was incorrect Action Check the syntax of the ACCEPT command for the correct options SP2 0223 No lines in buffer_name buffer Cause There are no lines stored in the buffer Action Enter SQL statements into the buffer SP2 0224 Invalid starting line number Cause The line number specified was incorrect Action Check that the line number is correct and try again SP2 0225 Invalid ending line number Cause The line number specified was incorrect Action Check that the line number is correct and try again SP2 0226 Invalid line number current_line_number Cause Invalid line number was specified Action Re enter with a valid line number SP2 0232 Input too long Must be less than number_of_characters characters Cause The input value was too long Action Reduce the size of the value and re enter SQL Plus Error Messages 14 11 SQL Plus Error Messages SP2 0233 Unable to obtain userid after number_of_attempts attempts Retry command Cause SQL Plus was unable to login after three attempts Action Make sure the userid and password is correct and try again SP2 0240 Enter value for variable_name Cause SQL Plus was unable to find a value for a substitution variable Action Enter a value for the substitution vari
506. tion LABEL label name OF column ON break column If you include multiple columns after OF and before ON COMPUTE calculates and prints values for each column you specify Example 7 16 Computing Multiple Summary Lines on the Same Break Column To compute the average and sum of salaries for the sales department first enter the following BREAK and COMPUTE commands BREAK ON DEPARTMENT ID COMPUTE AVG SUM OF SALARY ON DEPARTMENT ID Formatting SQL Plus Reports 7 21 Clarifying Your Report with Spacing and Summary Lines Now enter and run the following query SELECT DEPARTMENT ID LAST NAME SALARY FROM EMP DETAILS VIEW WHERE DEPARTMENT ID 30 ORDER BY DEPARTMENT ID SALARY jn DEPARTMENT ID LAST NAME SALARY 30 Colmenares 2500 Himuro 2600 Tobias 2800 Baida 2900 Khoo 3100 Raphaely 11000 De ese Wok RM Re avg 4150 sum 24900 6 rows selected Listing and Removing COMPUTE Definitions You can list your current COMPUTE definitions by entering the COMPUTE command with no clauses COMPUTE Example 7 17 Removing COMPUTE Definitions To remove all COMPUTE definitions and the accompanying BREAK definition enter the following commands CLEAR BREAKS breaks cleared CLEAR COMPUTES computes cleared n You may wish to place the commands CLEAR BREAKS and CLEAR COMPUTES at the beginning of every script to ensure that previously entered BREAK and COMPUTE command
507. tion clause for the SQLPLUS command may need to be contained in quotes HTML ONJOFF HTML is a mandatory MARKUP argument which specifies that the type of output to be generated is HTML The optional HTML argu ments ON and OFF specify whether or not to generate HTML output The default is OFF MARKUP HTML ON generates HTML output using the specified MARKUP options or in the case of SET MARKUP options set by previ ous SET MARKUP HTML commands in the current session You can turn HTML output ON and OFF as required during a session The default is OFF Starting SQL Plus 4 5 The SQLPLUS Command You enable the writing of HTML output with the MARKUP option SPOOL ON and you subsequently initiate writing output to a spool file with the SQL Plus command SPOOL filename See SPOOL ON OFF below and the SPOOL command in Chapter 13 SQL Plus Command Reference for more information HEAD text The HEAD text option allows you to specify content for the lt HEAD gt tag By default text is lt TITLE gt SQL Plus Report lt TITLE gt If text includes spaces it must be enclosed in quotes SOL PIus does not test this free text entry for HTML validity You must ensure that the text you enter is valid for the HTML lt HEAD gt tag This gives you the flexi bility to customize output for your browser or special needs BODY text The BODY text option allows you to specify attributes for the BODY tag By default the
508. tion required SP2 00920 HTTP error message on attempt to open URL Cause An HTTP error occurred while attempting to fetch the contents of a URL The URL may have been renamed removed or be temporarily unavailable Action Check that the URL is spelled correctly and that it is available from the requested server SP2 0921 The value specified for the keyword action must be either EXECUTE or LOAD Cause The value entered for the specified keyword was invalid Action Re enter the command using a valid value for the specified keyword Valid values for the keyword action are EXECUTE or LOAD SQL Plus Error Messages 14 43 iSQL Plus Error Messages SP2 0922 Unable to determine Windows version Cause Cannot determine version of Windows using the get version API Action No action required SP2 0923 AS SYSDBA or AS SYSOPER login not allowed through the iSOL Plus URL Cause An attempt was made to log in through the iSQL Plus URL with AS SYSDBA or AS SYSOPER privilege Action AS SYSDBA or AS SYSOPER privileged login is only permitted through the iSQL Plus DBA URL Remove the AS SYSDBA or AS SYSOPER arguments from the login request or log in through the iSOL Plus DBA URL SP2 0924 Supplied connect string has duplicate or incorrect keyword Cause The login details supplied in the connect string may contain a duplicate keyword an incorrect keyword or an out of sequence keyword Action Check the syntax of the connect stri
509. tution 13 105 variables SET SPACE SET COLSEP see Sets the text to be printed between SELECTed 13 104 columns SET TRUNCATE SET WRAP see Controls whether SOL Plus truncates a SELECTed 13 123 row if itis too long for the current line width SHOW LABEL none Obsolete TTITLE TTITLE see 13 141 Places and formats a title at the top of each report old form page or lists the current TTITLE definition C 2 SQL Plus User s Guide and Reference DOCUMENT BTITLE old form Purpose Displays a title at the bottom of each report page Syntax BTI TLE text Usage Notes The old form of BTITLE offers formatting features more limited than those of the new form but provides compatibility with UFI a predecessor of SQL Plus The old form defines the bottom title as an empty line followed by a line with centered text Refer to TTITLE old form in this appendix for more details COLUMN DEFAULT Purpose Resets the display attributes for a given column to default values Syntax COL UMN column expr DEF AULT Usage Notes Has the same effect as COLUMN CLEAR DOCUMENT Purpose Begins a block of documentation in a script Syntax DOC UMENT Obsolete SQL Plus Commands C 3 NEWPAGE NEWPAGE Usage Notes For information on the current method of inserting comments in a script refer to the section Placing Comments in Scripts on page 6 10 and to the REMARK command on page 13 86 After you type DOCUMENT and enter Return
510. umn names database TABLES data dictionary view objects and structures usernames and roles You can back up the database by using the BACKUP command Use the DBMS_STATS GENERATE_STATS procedure xxiii Convention Meaning Example lowercase Lowercase monospace typeface indicates Enter sqlplus to open SQL Plus monospace executables filenames directory names the password is specified in the orapwd file fixed width and sample user supplied elements Such font elements include computer and database Back up the datafiles and control files in the names net service names and connect disk1 oracle dbs directory identifiers as well as user supplied database objects and structures column names packages and classes usernames and roles program units and parameter values Set the QUERY REWRITE ENABLED initialization parameter to true The department id department name and location id columns are in the hr departments table Note Some programmatic elements use a mixture of UPPERCASE and lowercase Connect as oe user Paice tite se clement as spo The JRepUtil class implements these methods lowercase Lowercase monospace italic font You can specify the parallel_clause monospace represents placeholders or variables fixed width font italic Run Uold_release SQL where old_ release refers to the release you installed prior to upgrading Conventio
511. un a script from a URL The script is uploaded using the HTTP POST protocol and must be available through HTTP HTTPS or FTP iSQL Plus executes the script using any HTML form field values as parameters and returns the results in a new web browser window You are not prompted for undefined variables You should take care that there are no variables that have not been defined in your script or explicitly passed as parameters You can also include username and password information in the request You should carefully consider the security implications of including usernames and passwords in HTML files If you do not include a username or password iSQL Plus prompts you to enter login information when you run the script If you want to use the SET MARKUP command to change the HEAD or BODY options for a report put the SET MARKUP command before the first command that generates output Example 8 4 Creating a Dynamic Report Create and save the following script to a file called script sql on your Oracle HTTP Server SET PAGESIZE 200 SELECT FROM EMP DETAILS VIEW ORDER BY LAST NAME EMPLOYEE ID Create an HTML file which contains lt HTML gt lt HEAD gt lt TITLE gt iSQL Plus Dynamic Report lt TITLE gt lt HEAD gt lt BODY gt lt H1 gt lt em gt i lt em gt SQL Plus Report Hl lt A HREF http machine_name domain port isqlplus script http machine_ name domain port script sql gt Run Employee Report lt A gt
512. urposes only Action Make sure that all environment variables or registry entries needed to run SQL Plus are set The variables are platform specific but may include ORACLE HOME ORACLE SID NLS LANG and LD LIBRARY PATH Also check that the file sp1XX msb is in the SORACLE HOME sglplus mesg or YORACLE_HOME sqlplus mesg directory The XX stands for the country prefix associated with your NLS LANG environment variable SQL Plus reads only one of the sp1XX msb files For example sp1ja msb is read if NLS LANG is JAPANESE JAPAN JA16EUC If NLS LANG is not set then the default English language splus msb is used Check that the appropriate file is of non zero size and that the file permissions allow it to be read Note that msb files are binary The contents may be meaningless when viewed or printed If you are unsure which language file is being used unset NLS LANG and run SQL Plus to verify it can read the splus msb file SP2 0751 Unable to connect to Oracle Exiting SOL Plus Cause No connection to an Oracle server could be made Action Normally occurs after other errors showing that the database is not running or that the username and password were invalid SP2 0753 STARTUP with MIGRATE only valid with Oracle 9 2 or greater Cause STARTUP MIGRATE was used to try to startup an Oracle server for a release prior to 9 2 Action Check the platform specific environment to verify that you are connecting to an Oracle server that is at
513. us will not exit on a SQL Plus error EXIT SUCCESS FAILURE WARNING n variable BindVariable Directs SOL Plus to exit as soon as it detects a SOL command or PL SQL block error but after printing the error message SOL Plus will not exit on a SOL Plus error The EXIT clause of WHENEVER SOLERROR follows the same syntax as the EXIT command See EXIT in this chapter for details CONTINUE Turns off the EXIT option COMMIT Directs SOL PlIus to execute a COMMIT before exiting or continuing and save pending changes to the database ROLLBACK Directs SOL PlIus to execute a ROLLBACK before exiting or continuing and abandon pending changes to the database SQL Plus User s Guide and Reference WHENEVER SQLERROR Usage Examples E x25 C NONE Directs SQL Plus to take no action before continuing The WHENEVER SQLERROR command is triggered by SQL command or PL SQL block errors and not by SQL Plus command errors The commands in the following script cause iSQL Plus to stop processing the current script and return focus to the Input area on the Work screen The commands in the following script cause SQL Plus to exit and return the SQL error code if the SQL UPDATE command fails WHENEVER SQLERROR EXIT SQL SQLCODE UPDATE EMP_DETAILS_VIEW SET SALARY SALARY 1 1 The following SQL command error causes iSQL Plus to stop processing the current script and return focus to the Input area
514. use in COPY command B 3 B 7 in SAVE command 13 93 reports autotrace 9 2 breaks 13 18 clarifying with spacing and summary lines 7 12 columns 13 30 creating bottom titles 7 23 13 23 C 2 creating dynamic 8 13 creating footers 13 87 creating headers 13 89 creating headers and footers 7 23 creating master detail 7 29 13 35 creating top titles 7 23 13 141 C 2 displaying 13 96 13 102 embedded CGI example 8 7 formatting column headings 7 2 13 29 formatting columns 7 4 7 6 13 29 interactive HTML example 8 3 8 6 onthe web 8 2 running from a URL 8 13 SILENT mode 8 12 starting on anew page 13 107 title 13 141 C 2 RESTRICT 4 9 10 8 13 134 restricted database access 10 10 return code specifying 6 17 13 65 13 155 retype new password field 4 19 REVOKE command 10 2 disabling 10 5 RIGHT clause 7 26 13 90 13 142 roles 10 6 disabling 10 7 re enabling 10 8 ROLLBACK clause 13 65 WHENEVER OSERROR 13 152 WHENEVER SQLERROR 13 154 ROWID column definition from DESCRIBE 13 53 rows performing computations on 7 16 13 40 setting number retrieved at one time 9 10 13 95 13 100 setting the number after which COPY commits 13 105 RUN command 5 7 13 92 disabling 10 5 executing current PL SOL block 5 7 executing current SOL command or PL SOL block 5 7 making lastline current 6 6 similar to slash command 5 7 13 92 S sample tables access to 1 8 creating 1 8 removing 1 8 unl
515. use a connection identifier to specify the database you want to connect to The connection identifier is an argument to the SQLPLUS command you use to start a command line connection or it is entered in the Connection Identifier field on the iSQL Plus Login Screen If you omit the connection identifier you are connected to the default database You must use a connection identifier to specify any database other than the default database The DBA is responsible for creating the databases you use and giving you the connection identifiers that allow you to connect to those databases In the iSQL Plus user interface the database administrator can provide a restricted list of connection 4 20 SQL Plus User s Guide and Reference Database Connection Identifier identifiers These are accessed through a dropdown list which replaces the usual Connection Identifier field on the Login Screen The default database is configured at an operating system level by setting operating system environment variables symbols or possibly by editing an Oracle specific configuration file Refer to the Oracle documentation for your operating system for more information In the command line interface it is possible to start SOL Plus without connecting to a database by using the NOLOG argument of the SQLPLUS command This is useful for performing some database administration tasks writing transportable scripts or to use the editing commands to write or edit sc
516. use the DEFINE command to view the CONNECT IDENTIFIER definition in the same way as you view other DEFINE definitions using the DEFINE command with no arguments or with the specific argument you wish to display for example DEFINE or DEFINE _CONNECT_IDENTIFIER You can use UNDEFINE to remove the CONNECT_IDENTIFIER definition and make it unavailable See Also Defining User Variables on page 6 17 Cause Action Text for SP2 Error Messages There is new Cause and Action documentation for SP2 error messages The UNIX oerr script now recognizes SP2 error prefixes to display the Cause and Action text See Also Chapter 14 SOQL Plus Error Messages URL Support The URL syntax is now supported on all platforms Use URL to run a script on any platform not just Windows See Also at sign double at sign and START in Chapter 13 SOL Plus Command Reference xxxi New Features in SQL Plus 9 2 xxxii There are changes to the functionality of the iSQL Plus user interface and to its look and feel UNIX Support The iSQL Plus Server is supported on UNIX platforms Set System Variables There is a new iSQL Plus System Variables screen This screen provides a graphical interface to the system variables applicable to iSQL Plus It allows you to view current settings and to change one or more settings from a single screen The default system variable settings are used each time you start a new iSQ
517. used for internal processing When Oracle needs to make a change to these tables it internally generates an internal SOL statement which in turn generates a recursive call db block gets Number of times a CURRENT block was requested consistent gets Number of times a consistent read was requested for a block physical reads Total number of data blocks read from disk This number equals the value of physical reads direct plus all reads into buffer cache redo size Total amount of redo generated in bytes 9 4 SQL Plus User s Guide and Reference Tracing Statements E Database Statistic Name Description bytes sent via SOL Net Total number of bytes sent to the client from the to client foreground processes bytes received via Total number of bytes received from the client over SOL Net from client Oracle Net SOL Net roundtrips Total number of Oracle Net messages sent to and to from client received from the client sorts memory Number of sort operations that were performed completely in memory and did not require any disk writes sorts disk Number of sort operations that required at least one disk write rows processed Number of rows processed during the operation Example 9 4 Tracing Statements for Performance Statistics and Query Execution Path If the SOL buffer contains the following statement SELECT E LAST NAME E SALARY J JOB TITLE FROM EMPLOYEES E JOBS J WHERE E JOB ID J JOB ID AND
518. users who have been granted SYSOPER or SYSDBA system privileges You can use either of these privileged connections with the default logon For information about system privileges see the Oracle9i Database Administrator s Guide CONNECT commits the current transaction to the database disconnects the current username from Oracle and reconnects with the specified username If you log on or connect as a user whose account has expired SQL Plus prompts you to change your password before you can connect If an account is locked a message is displayed and connection into that account as that user is not permitted until the account is unlocked by your DBA For more information about user account management refer to the CREATE USER ALTER USER and the CREATE PROFILE commands in the Oracle9i SQL Reference To connect across Oracle Net with username HR and password HR to the database known by the Oracle Net alias as FLEETDB enter CONNECT HR your_password FLEETDB To connect as user HR letting SOL PIus prompt you for the password enter CONNECT HR For more information about setting up your password file refer to the Oracle9i Database Administrator s Guide To use a password file to connect to an instance on the current node as a privileged user named HR with the password HR enter CONNECT HR your password AS SYSDBA To connect to an instance on the current node as a privileged default user enter CONNECT AS SYSDBA In the
519. uses the following error message SP2 0544 invalid command SELECT 4 Todelete this row and remove the restriction from the user HR CONNECT again with SYSDBA privileges as SYSTEM and enter DELETE FROM PRODUCT USER PROFILE WHERE USERID HR Creating and Controlling Roles You can use SQL commands to create and control access to roles to provide security for your database tables By creating a role and then controlling who has access to it you can ensure that only certain users have access to particular database privileges Roles are created and used with the SOL CREATE GRANT and SET commands a Tocreate a role you use the CREATE command You can create roles with or without passwords To grant access to roles you use the GRANT command In this way you can control who has access to the privileges associated with the role a To access roles you use the SET ROLE command If you created the role with a password the user must know the password in order to access the role For more information about roles see your Oracle9i SQL Reference your Oracle9i Database Administrator s Guide and your Oracle9i Database Concepts manual 10 6 SQL Plus User s Guide and Reference Creating and Controlling Roles Disabling SET ROLE From SQL Plus users can submit any SQL command In certain situations this can cause security problems Unless you take proper precautions a user could use SET ROLE to access privileges obtained via an
520. ut of iSQL Plus If this is not the behavior you want then use a single ampersand as the prefix for variables in your script You are always prompted for value substitution for variables created with a single ampersand prefix If you use DEFINE to define variable values in your script in this mode the defined values override values entered in the Variable Substitution screen Enter SET DEFINE OFF to set iSQL Plus to never prompt for substitution variables before running any further scripts Click the Execute button to execute the command Enter your script Ensure that you include SET DEFINE OFF as the last command in your script to make sure that iSQL Plus does not prompt for variable values when the script is executed again Enter SET DEFINE ON and DEFINE all variables with amp or amp amp before they are referenced You can also use COLUMN new value or COLUMN old value to instantiate substitution variables Click the Execute button to execute the script iSQL Plus does not prompt you for values for substitution variables In this usage be aware that iSQL Plus substitutes a NULL value for any variable you do not DEFINE in the script 6 24 SQL Plus User s Guide and Reference Writing Interactive Commands iSQL Plus Substitution Variables Screen When iSQL Plus executes a script containing substitution variables the Substitution Variables screen is displayed For example when you enter BREAK ON amp SORTCOL SELECT
521. utable name On Windows use SENV ORACLE_HOME bin sqlplus for the executable Set up the SQL Plus environment SENV ORACLE_SID Ora9i Your SID goes here SENV ORACLE HOME oracle Your Oracle Home directory goes here SENV TNS ADMIN var opt oracle plusexe SENV ORACLE HOME bin sqlplus Extract parameters and values from data entered through web browser Si lt gt Qin split amp i foreach i 0 S in key val split in i 2 Change encoding to machine character set key s A Fa f0 9 2 pack c hex 1 ge Sval s A Fa f0 9 2 pack c hex 1 ge Store the value Sin Skey val Construct the connection string from values passed in Sconnstr in username Sin password Sconnstr Sconnstr Sin db if Sin db Construct the SQL script to be run Sscript Sin script Force output to be flushed S 1 Print mime type print Content Type text html n n if Sdebug print lt html gt lt body gt n print plusexe connstr script n print body html Mn exit Call SQL Plus with the parameters entered from the web browser system Splusexe r 3 s m html on Sconnstr script exit 8 10 SQL Plus User s Guide and Reference Creating Reports using Command line SQL P lus SQL Script for CGI Example Create the follow
522. ve lines instead of bold FORMAT text Specifies a format model that determines the format of data items up to the next FORMAT clause or the end of the command The format model must be a text constant such as A10 or 999 See COLUMN FORMAT for more information on formatting and valid format models If the datatype of the format model does not match the datatype of a given data item the FORMAT clause has no effect on that item If no appropriate FORMAT model precedes a given data item SQL Plus prints NUMBER values according to the format specified by SET NUMFORMAT or if you have not used SET NUMFORMAT the default format SOL Plus prints DATE values using the default format 13 90 SQL Plus User s Guide and Reference REPHEADER Usage Examples x5 Refer to the FORMAT clause of the COLUMN command in this chap ter for more information on default formats Enter REPHEADER with no clauses to list the current REPHEADER definition If you do not enter a printspec clause before the text or variables REPHEADER left justifies the text or variables You can use any number of constants and variables in a printspec SQL Plus displays the constants and variables in the order you specify positioning and formatting each constant or variable as specified by the printspec clauses that precede it To define EMPLOYEE LISTING REPORT as a report header on a separate page and to center it enter REPHEADER PAGE CEN
523. w lines after the current line in the buffer LIST 13 73 Lists one or more lines of the buffer PASSWORD 13 75 Allows a password to be changed without echoing the password on an input device PAUSE 13 76 Displays the specified text then waits for the user to press Return PRINT 13 77 Displays the current value of a bind variable PROMPT 13 78 Sends the specified message to the user s screen QUIT 13 64 Terminates SQL Plus and returns control to the operating system QUIT is identical to EXIT RECOVER 13 79 Performs media recovery on one or more tablespaces one or more datafiles or the entire database REMARK 13 86 Begins a comment in a script REPFOOTER 13 87 Places and formats a specified report footer at the bottom of each report or lists the current REPFOOTER definition REPHEADER 13 89 Places and formats a specified report header at the top of each report or lists the current REPHEADER definition SQL Plus Command Reference 13 3 SQL P lus Command Summary Command Page Description RUN 13 92 Lists and runs the SOL command or PL SQL block currently stored in the buffer SAVE 13 93 Saves the contents of the buffer in a host operating system file a script SET 13 95 Sets a system variable to alter the SQL Plus environment for your current session SHOW 13 124 Shows the value of a SQL Plus system variable or the current SQL Plus environment SHUTDOWN 13 129 Shuts down a currently running Oracle instance SPOOL 1
524. word as needed The database you connect to is used until you CONNECT to another database DISCONNECT or exit SQL Plus Starting SQL Plus 4 21 Database Connection Identifier If you log on or connect as a user whose account has expired SQL Plus prompts you to change your password before you can connect If an account is locked a message is displayed and connection as this user is not permitted until the account is unlocked by your DBA Connecting to a Remote Database Using the CONNECT Command To connect to a remote database using the CONNECT command include an Oracle Net connection identifier in the CONNECT command in the following form CONNECT HR your_password connect_identifier For more information see the Oracle Net guide appropriate for your protocol or contact your DBA Command line SQL Plus prompts you for a password as needed and connects you to the specified database In iSQL Plus you are not prompted but must supply the username and password with the CONNECT command If you log on or connect as a user whose account has expired SOL Plus prompts you to change your password before you can connect If an account is locked a message is displayed and connection as this user is not permitted until the account is unlocked by your DBA When you connect to a remote database in this manner you can use the complete range of SOL and SQL Plus commands and PL SQL blocks on the database The exact string you enter for the
525. x of the command you used for the correct options SP2 0044 For a list of known commands enter HELP and to leave enter EXIT Cause An unknown command was entered Action Check the syntax of the command you used for the correct options SP2 0045 No column_name defined Cause No columns have been defined Action No action required 14 4 SQL Plus User s Guide and Reference SQL Plus Error Messages SP2 0046 column_name not defined Cause The column name specified was not defined Action Retry again with a valid column name SP2 0047 Invalid number for option_name option Cause An invalid number was used for this option Action Re try the operation with a valid number SP2 0051 Switch value is switch_value and is not handled properly Cause An internal error occurred Action Note the message and number and contact Oracle Support Services SP2 0052 Like column_name column_name not defined Cause The column which the format is based on was not defined Action Use the COLUMN command to make sure the column the format is based on is defined first SP2 0053 column_name not defined Cause The column name specified was not defined Action Retry again with a valid column name SP2 0054 No room to allocate definition_name definition Ignored Cause Unable to allocate memory to process the COLUMN command Action Free up additional memory by closing applications not required reducing the size of the command or sta
526. xpression An expression in a SELECT statement that defines which database column s are retrieved It may be a column name or a valid SOL expression referencing a column name column heading A heading created for each column appearing in a report command An instruction to or request of a program application operating system or other software to perform a particular task Commands may be single words or may require additional phrases variously called arguments options parameters and qualifiers Unlike statements commands execute as soon as you enter them ACCEPT CLEAR and COPY are examples of commands in SQL Plus command file See script command line A line on a computer display on which typed in commands appear An example of a command line is the area next to the DOS prompt on a personal computer See also prompt command prompt The text by default SOL with which SQL Plus requests your next command comment A language construct for the inclusion of explanatory text in a program the execution of which remains unaffected commit To make permanent changes to data inserts updates deletes in the database Before changes are committed both the old and new data exist so that changes can be stored or the data can be restored to its prior state Glossary 5 Glossary 6 Common Gateway Interface The Common Gateway Interface CGI describes a part of a web server that allows user interaction typically via
527. y results a List column definitions for any table Send messages to and accept responses from an end user Perform database administration This document requires a basic understanding of the SOL language If you do not have any familiarity with this database tool refer to the Oracle9i SQL Reference If you plan to use the PL SQL database language in conjunction with SOL Plus refer to the PL SQL User s Guide and Reference for information on using PL SQL Documentation Accessibility xviii Our goal is to make Oracle products services and supporting documentation accessible with good usability to the disabled community To that end our documentation includes features that make information available to users of assistive technology This documentation is available in HTML format and contains markup to facilitate access by the disabled community Standards will continue to evolve over time and Oracle Corporation is actively engaged with other market leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers For additional information visit the Oracle Accessibility Program Web site at http www oracle com accessibility Accessibility of Code Examples in Documentation JAWS a Windows screen reader may not always correctly read the code examples in this document The conventions for writing code require that closing braces should appear on an otherwise empty line
528. yntax Terms Usage HOST is not available in iSQL Plus HOIST command Executes a host operating system command without leaving SOL Plus Refer to the following for a description of the term or clause command Represents a host operating system command Enter HOST without command to display an operating system prompt You can then enter multiple operating system commands For information on returning to SQL Plus refer to the Oracle installation and user s manual s provided for your operating system Note Operating system commands entered from a SQL Plus session using the HOST command do not effect the current SQL Plus session For example setting an operating system environment variable does not effect the current SQL Plus session it only effects SQL Plus sessions started subsequently You can suppress access to the HOST command For more information about suppressing the HOST command see Chapter 10 SQL Plus Security With some operating systems you can use a VMS UNIX or another character instead of HOST See the Oracle installation and user s manual s provided for your operating system for details You may not have access to the HOST command depending on your operating system See the Oracle installation and user s manual s provided for your operating system or ask your DBA for more information SQL Plus removes the SOLTERMINATOR a semicolon by default before the HOST comman
529. yword keyword not recognised by iSOL Plus Cause An attempt was made to request a service from iSQL Plus by manually typing the URL but the value specified for a keyword was not recognized Action Refer to the iSQL Plus documentation for the syntax and types of service that can be manually entered in a URL 14 42 SQL Plus User s Guide and Reference iSQL Plus Error Messages SP2 0915 Cookies may have been disabled Cause After logging in iSQL Plus can only process further requests if cookies are enabled on your browser Action Enable cookies on your browser and log in again SP2 0916 Scheme scheme not supported Cause iSQL Plus only supports HTTP HTTPS and FTP Action Change the scheme to one that is supported SP2 0917 User requested cancel Cause The iSQL Plus script that was running has been cancelled by the user It may have been cancelled by clicking the Cancel button by re executing the script or by clicking any other button or link on the Work screen Action No action required SP2 0918 HTTP error number on attempt to open URL Cause An HTTP error occurred while attempting to fetch the contents of a URL The URL may have been renamed removed or be temporarily unavailable Action Check that the URL is spelled correctly and that it is available from the requested server SP2 0919 Unknown OS Cause Cannot determine the operating system platform from the retrieved OS version information Action No ac

Download Pdf Manuals

image

Related Search

Related Contents

iPratico POS Manuale utente  Repeater/ Router client WF2412 WF2420 User Manual    LANCOM Public Spot Option  電子書籍版PDF、ダウンロード、本を読みます  

Copyright © All rights reserved.
Failed to retrieve file