HP Neoview Script Guide HP Part Number: 544530-001 Published: May 2007 Edition: HP Neoview Release 2.
© Copyright 2007 Hewlett-Packard Development Company, L.P. Legal Notice Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor’s standard commercial license. The information contained herein is subject to change without notice.
Table of Contents About This Document.......................................................................................................15 Intended Audience................................................................................................................................15 New and Changed Information in This Edition...................................................................................15 Document Organization.......................................................................
Presetting the Optional Launch Parameters....................................................................................45 Logging In to the Database Platform....................................................................................................45 Default Login...................................................................................................................................45 Login Parameters...................................................................................
SPOOL log-file or LOG log-file Command................................................................................64 Using the CLEAR Option...........................................................................................................64 Logging Concurrent Neoview Script Sessions...........................................................................64 Stopping the Logging Process.........................................................................................................
Examples..........................................................................................................................................84 DISCONNECT Command....................................................................................................................84 Syntax..............................................................................................................................................84 Considerations.............................................................
Considerations...............................................................................................................................100 Example.........................................................................................................................................100 RUN Command..................................................................................................................................100 Syntax....................................................................
Syntax.............................................................................................................................................114 Considerations...............................................................................................................................114 Examples........................................................................................................................................114 SHOW HISTOPT Command................................................
SHOW SQLTERMINATOR Command...............................................................................................124 Syntax.............................................................................................................................................124 Considerations...............................................................................................................................124 Example....................................................................................
List of Figures 1-1 Neoview Script Within a Neoview Platform Network.................................................................
List of Tables 2-1 Locations of Neoview Script Software Files..................................................................................
About This Document This manual describes how to use the Neoview Script command-line interface on a client workstation to manage a database on a Neoview data warehousing platform. Neoview Script enables you to perform daily administrative tasks by running SQL statements interactively or from script files. Intended Audience This manual is intended for database administrators and support personnel who are maintaining and monitoring a Neoview database.
Chapter 6: Running Neoview Script From Perl or Python Describes how to run Neoview Script from Perl or Python. Appendix A: Neoview Script Interface Commands Provides syntax, considerations, and examples for Neoview Script interface commands. Appendix B: Supported SQL Statements Lists the SQL statements that Neoview Script supports. Appendix C: Connectivity Service Provides syntax, considerations, and examples for connectivity service commands.
| Vertical Line A vertical line separates alternatives in a horizontal list that is enclosed in brackets or braces. For example: {expression | NULL} … Ellipsis An ellipsis immediately following a pair of brackets or braces indicates that you can repeat the enclosed sequence of syntax items any number of times. For example: ATTRIBUTE[S] attribute [, attribute]... {, sql-expression}...
Neoview Customer Library This manual is part of the Neoview customer library: • • • Administration Neoview Database Administrator’s Guide Information about how to load and manage the Neoview database by using the Neoview DB Admin and other tools. Neoview DB Admin Online Help Context-sensitive help topics that describe how to use the HP Neoview DB Admin management interface.
Neoview Hardware Installation and Support Guide Installation and replacement procedures. Neoview Management Dashboard Support Guide Information on managing and configuring Dashboard from the Dashboard Server and Client, including starting and running Dashboard, using Discrete Object Thresholds (DOTs), using Dashboard Command Interpreter commands, using the Entity Definition Language (EDL), and using Dashboard data definitions and record declarations.
1 Introduction to Neoview Script Neoview Script is a command-line interface that you download and install on a client workstation that has the Neoview JDBC Type 4 Driver installed. Operating systems that support the JDBC driver include Windows, Linux, and UNIX. The JDBC driver connects Neoview Script on a client workstation to a Neoview database on a Neoview data warehousing platform.
2 Installing Neoview Script NOTE: If you are manually installing Neoview Script on a Linux platform that has the Neoview data loader installed, use the services or sysadmin ID instead of root, which has been frozen for the loader. The best way to install Neoview Script on the loader platform is by using the Neoview Loader Supplemental executive (Installsuppkt). For more information, see the Neoview Migration and Upgrade Guide. To install Neoview Script, follow these procedures: 1.
After installing the Java version, proceed with “Verifying the Java Version” (page 24). Verifying the Java Version To display the Java version of the client workstation on the screen, enter: java -version For example: C:\>java -version java version "1.4.2_10" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03) Java HotSpot(TM) Client VM (build 1.4.
4.
5. Place the cursor at the beginning of the Variable Value field and type the path of the Java bin directory, ending with a semicolon (;): For example: "C:\Program Files\Java\j2re1.4.2_10\bin"; NOTE: Check that no space is after the semicolon (;) in the path. If there are spaces in the directory name, delimit the entire directory path in double quotes (") before the semicolon. 6. 7. 8. Click OK. Verify that the updated Path appears under System variables, and click OK.
1. Change the directory to the lib directory, which contains the JDBC driver JAR file: • On Windows, enter this command: cd jdbc-installation-directory\lib jdbc-installation-directory is the directory where you installed the JDBC driver. • On Linux or UNIX, enter this command: cd jdbc-installation-directory/lib jdbc-installation-directory is the directory where you installed the JDBC driver. 2. Enter this command to return version information: java -jar hpt4jdbc.
1. 2. Locate or create a directory or folder for the installer file anywhere on the client workstation. On the client workstation, start a Web browser and navigate to the download site: http://www.software.hp.com 3. 4. 5. Enter “Neoview Script” in the search box in the upper right corner of the Software Depot home page. Click the HP Neoview Script link that appears in the search results. Follow instructions to download HP Neoview Script, which includes the hpnvsInstaller.
5. At a command prompt, change to the directory where you downloaded the installer: cd installer-directory installer-directory is the directory where you downloaded the installer file, hpnvsInstaller.jar. 6. Launch the Installer Wizard by entering: java -jar hpnvsInstaller.jar 7. Proceed to “Using the Installer Wizard” (page 29). Using the Installer Wizard When you execute hpnvsInstaller.jar, the Installer Wizard appears: 1.
3. Select hpt4jdbc.
4. To find an installation location for Neoview Script, click Browse next to HP Neoview Script installation directory: 5.
The Installer Wizard displays the directory where the Neoview Script will be installed. 6.
The Installation Status dialog box appears on the screen, indicating how many files are installed in the installation directory: The number of files that are extracted and installed is 15. All these files are stored in the nvscript subdirectory within the installation directory. 7. Click OK, and proceed with “Verifying the Installed Software Files” (page 34). Command-Line Installation Steps 1.
4. Enter an existing directory where you would like to install Neoview Script: HP Neoview Script -------------------------------------Enter the installation directory: c:\install The installation status appears, indicating how many files are installed in the installation directory: HP Neoview Script -------------------------------------Enter the installation directory: c:\install Extracted 15 files from the /C:/download/hpnvsInstaller.jar archive into the c:\install directory. Installation Complete.
Table 2-1 Locations of Neoview Script Software Files (continued) Directory 1 Files Description sample-beta.pl Beta version of sample Perl program1 sample-beta.py Beta version of sample Python program1 Neoview Script provides a beta version of enhanced support for Perl and Python programs. This functionality enables multiple SQL statements to run in one database connection from a Perl or Python program. For more information, see the README in the Neoview Script samples directory.
execute in the Neoview Script interface. Each look-and-feel type accepts all the SQL statements, commands, and syntax that Neoview Script currently supports. Supported Look-and-Feel Types Currently, Neoview Script supports the SQLPlus and Teradata look-and-feel types, in addition to the default look and feel, Neoview SQL. The default look and feel, Neoview SQL, appears as shown below: Welcome to the HP Neoview Script Interface 2.1 (c) Copyright 2006, 2007 Hewlett-Packard Development Company, LP.
If you do not set a look and feel, the default is Neoview SQL. Setting the Look and Feel at a Command-Line Prompt To set the _JAVA_OPTIONS environment variable for each session at a command-line prompt: • On Windows, enter this command: set _JAVA_OPTIONS=-DhpnvsLF=look-and-feel-type look-and-feel-type is one of the “Supported Look-and-Feel Types” (page 36).
3. If _JAVA_OPTIONS does not appear among the environment variables, click New under System or User variables. If _JAVA_OPTIONS already exists, click Edit. 4. Type _JAVA_OPTIONS for the Variable Name and the -DhpnvsLF property value for the Variable Value, and click OK. The Variable Value must include: -DhpnvsLF=look-and-feel-type look-and-feel-type is one of the “Supported Look-and-Feel Types” (page 36). For example: -DhpnvsLF=SQLPlus 5.
6. In the System Properties dialog box, click OK to accept the changes. To return to the default look and feel, Neoview SQL, set the -DhpnvsLF property value to nvs. Setting the Look and Feel in the User Profile on Linux or UNIX 1. Open the user profile (.profile or .bash_profile for the Bash shell) in the /home directory. For example: vi .profile 2. Add this export command (or a setenv command for the C shell) to the user profile.
2. 40 If you cannot connect to the database, verify that: 1. The database platform is available and running, the port number is correct for the database platform, and you are authorized to log in to that database platform. To create a user ID to log in to the database, see the Neoview Database Administrator’s Guide. 2. The version of the Neoview JDBC Type 4 Driver is compatible with the Java Runtime Environment (JRE) of the workstation.
3 Launching the Neoview Script Interface This chapter describes how to launch the Neoview Script interface from the Windows, Linux, or UNIX environment: • • • • • • “Launching the Neoview Script Interface on Windows” (page 41) “Launching the Neoview Script Interface on Linux or UNIX” (page 44) “Logging In to the Database Platform” (page 45) “Using Optional Launch Parameters” (page 46) “Launching Neoview Script Without Connecting to the Database” (page 49) “Exiting the Neoview Script Interface” For informa
2. Type the location of hpnvs.cmd within double quotes (“) or click Browse to locate that file, and then click Next: For the location of the Neoview Script software files, see Table 2-1 (page 34). 3.
4. If desired, specify optional launch parameters for the shortcut: a. Right-click the shortcut icon and select Properties: b. c. Click the Shortcut tab. In the Target box, insert a space after "...\nvscript\bin\hpnvs.
For more information, see “Using Optional Launch Parameters” (page 46). d. 5. Click OK. To launch Neoview Script, double-click the shortcut icon. The Neoview Script interface appears. If you did not set the optional launch parameters, the Neoview Script interface prompts you to enter the host name or IP address of the database platform, your user name, password, and a data source name. See “Logging In to the Database Platform” (page 45).
hpnvs-installation-directory is the directory where you installed the Neoview Script software files. For more information, see Table 2-1 (page 34). Check that no space is after the colon (:) in the path. NOTE: 3. In the C shell, use the setenv command instead of export. To activate the changes, either log out and log in again or execute the user profile. For example: . .profile 4. On the command line, execute the hpnvs.sh file to launch Neoview Script: hpnvs.
3. 4. Enter your password. Enter the name of a data source that is available and running (that is, started). If you do not enter a data source, Neoview Script connects to Admin_Load_DataSource by default. Admin_Load_DataSource is the recommended data source for Neoview Script connections. If Admin_Load_DataSource (or any data source that you specify) is not started, Neoview Script returns an error and prompts you to close the session.
Launch Parameter Description {-q | -sql} "command" Specifies that an SQL statement or a Neoview Script interface command be run when launching the Neoview Script interface. You cannot specify this parameter at the same time as the -s or -script parameter. For more information, see “Running a Command When Launching Neoview Script” (page 47). {-s | -script} script-file-name Specifies that a script file be run when launching the Neoview Script interface.
Although you can run any of the Neoview Script interface commands with -q or -sql, the @, OBEY, and PRUN commands are the most useful. For a list of supported SQL statements, see Appendix B (page 133). Example of Running an SQL Statement With -q or -sql Use -q or -sql with the CREATE SCHEMA statement to create a schema when launching the Neoview Script interface: • On Windows, in the Command Prompt window, enter: cd hpnvs-installation-directory\nvscript\bin hpnvs.
DISCONNECT command. To quit the interface immediately after executing a script file, include the EXIT, QUIT, or DISCONNECT command at the end of the script file. Example of a Script File You can create a script file that contains SET commands that customize a session when you launch Neoview Script: For more information, see “Creating a Script File” (page 67).
Example of Launching Neoview Script File With -noconnect • On Windows, in the Command Prompt window, enter: cd hpnvs-installation-directory\nvscript\bin hpnvs.cmd -noconnect • On Linux or UNIX, in the terminal window, enter: cd hpnvs-installation-directory/nvscript/bin ./hpnvs.
4 Running Commands Interactively in the Neoview Script Interface After launching the Neoview Script interface, you can run SQL statements and Neoview Script interface commands in the interface.
You can continue any SQL statement over multiple lines, breaking that statement at any point except within a word, a numeric literal, or a multicharacter operator (for example, <=). To break a string literal in a DML statement, use a concatenation operator (||). For more information, see the concatenation operator in the Neoview SQL Reference Manual. To terminate an SQL statement that spans multiple lines, use the SQL terminator for the session.
SCHEMA SERVER SQLTERMINATOR TIME TIMING USER USR neo0101.acme.com:18650 ; OFF OFF role.dba SQL> For more information, see the “ENV Command” (page 85) or “SHOW SESSION Command” (page 122). Setting and Showing the Idle Timeout Value for the Session The idle timeout value of a session determines when the session expires after a period of inactivity. To set the idle timeout value of a session, enter the SET IDLETIMEOUT command.
20:32:26 SQL ENTER>set time off SQL ENTER> For more information, see the “SET TIME Command” (page 112). Setting and Showing the SQL Terminator The SQL terminator symbolizes the end of an SQL statement. By default, the SQL terminator is a semicolon (;). To change the SQL terminator, enter the SET SQLTERMINATOR command. For example, this SET TERMINATOR command sets the SQL terminator to a period (.): SQL>set sqlterminator . SQL>insert into sales.custlist +>(select * from invent.supplier +>where suppnum=8).
SQL> For more information, see the “SET TIMING Command” (page 113). Setting and Showing the Current Schema By default, the schema of the session is USR. The SQL statement, SET SCHEMA, allows you to set the schema for the Neoview Script session. For example, this SET SCHEMA statement changes the default schema to PERSNL for the session: SQL>set schema persnl; --- SQL operation complete. SQL>delete from employee +>where first_name='TIM' and +>last_name='WALKER'; --- 1 row(s) deleted.
• • “Showing the Views in a Schema” (page 57) “Showing the Synonyms in a Schema” (page 57) Showing the Schemas The SHOW SCHEMAS command displays the schemas that exist in the default catalog: SQL>show schemas SCHEMA NAMES ----------------------------------------------------------------------------DBA001 DBA082 DBMGR DBSCRIPT_SALES DEFINITION_SCHEMA_VERSION_1200 DEMOSCH DEMOSCH1 DEMOSCH2 DEMO_SCH DEV060525 DS_SCH D_SALES HMGR HPNVS HPNVSSCH HPNVS_SAMPLE HPNVS_SAMPLE INVENT ODBC_INVENT ODBC_PERSNL ODBC_SALE
SQL> For more information, see the “SHOW TABLE Command” (page 125). Showing the Views in a Schema The SHOW VIEWS command displays the views that exist in the current schema. For example, this SHOW VIEWS command displays all the views in the current schema, INVENT: SQL>set schema invent; --- SQL operation complete.
For more information, see the “SHOW SYNONYMS Command” (page 124). Displaying Executed Commands To display commands that were recently executed in the Neoview Script session, enter the HISTORY command. The HISTORY command associates each command with a number that you can use to reexecute or edit the command with the FC command. See “Editing and Reexecuting a Command” (page 58).
Running SQL Statements In the Neoview Script interface, you can run SQL statements interactively. For a list of SQL statements that you can run interactively, see Appendix B (page 133). This subsection shows examples of: • • • “Executing an SQL Statement” (page 59) “Repeating an SQL Statement” (page 59) “Preparing and Executing SQL Statements” (page 60) To run SQL statements from script files in the Neoview Script interface, see Chapter 5 (page 67).
SQL> For more information, see the “/ Command” (page 82), “RUN Command” (page 100), or “REPEAT Command” (page 98). Preparing and Executing SQL Statements You can prepare, or compile, an SQL statement by using the PREPARE statement and later execute the prepared SQL statement by using the EXECUTE statement.
Setting Parameters In a Neoview session, you can set a parameter of an SQL statement (either prepared or not) by using the SET PARAM command. NOTE: The parameter name is case-sensitive. If you specify it in lowercase in the SET PARAM command, you must specify it in lowercase in other statements, such as DML statements or EXECUTE.
dn 1500 sal 80000.00 SQL> For the syntax of the RESET PARAM command, see the “RESET PARAM Command” (page 99). Executing a Prepared SQL Statement To execute a prepared SQL statement, use the EXECUTE statement. For example, this EXECUTE statement executes the prepared empsal statement, which does not have any parameters: SQL>execute empsal; SALARY ---------137000.10 90000.00 75000.00 138000.40 56000.00 136000.00 80000.00 70000.00 175500.00 90000.00 118000.00 --- 11 row(s) selected.
TED PETER MARK HEIDI ROCKY SUE MARTIN HERBERT JESSICA MCDONALD SMITH FOLEY WEIGL LEWIS CRAMER SCHAEFFER KARAJAN CRINER 2000 3300 4000 3200 2000 1000 3200 3200 3500 --- 35 row(s) selected.
hpnvs-installation-directory is the directory where you installed the Neoview Script software files. For more information, see Table 2-1 (page 34). • On Linux or UNIX: hpnvs-installation-directory/nvscript/bin/sqlspool.lst hpnvs-installation-directory is the directory where you installed the Neoview Script software files. For more information, see Table 2-1 (page 34). For example, this SPOOL ON command starts logging the session in the sqlspool.
For information about error messages that might appear in the log file, see the Neoview Messages Manual.
5 Running Scripts in the Neoview Script Interface In the Neoview Script interface, you can run script files.
the section name in the @ or OBEY command. For more information, see the“@ Command” (page 81) or the “OBEY Command” (page 93). Example of a Script File This script file creates tables in the inventory schema: Running a Script File To run a script file in the Neoview Script interface, use the @ or OBEY command. The @ and OBEY commands run one script file at a time in the Neoview Script interface.
NOTE: If the script file is outside the directory of the hpnvs.cmd or hpnvs.sh file (by default, the Neoview Script bin directory), you must specify the full path of the script file in the @ or OBEY command. For the Neoview Script bin directory, see Table 2-1 (page 34). SQL>@C:\ddl_scripts\sch_invent.sql SQL>-- CREATE SCHEMA SQL>CREATE SCHEMA INVENT; --- SQL operation complete. SQL>-- CREATE TABLES/VIEWS in SCHEMA INVENT SQL>SET SCHEMA INVENT; --- SQL operation complete. SQL>CREATE TABLE INVENT.
NOTE: Starting with the 2.1 release, the PRUN command can be run in non-interactive mode. The PRUN command now allows options to be specified on the command line, which enables PRUN to be run in script and/or obey files. The PRUN command is most useful for running sets of data definition language (DDL) statements simultaneously, which speeds up the process of creating large databases. Put all dependent or related DDL statements in the same script file.
6 Running Neoview Script From Perl or Python You can execute an SQL statement in Perl or Python by invoking the Neoview Script Perl or Python wrapper script.
set HPNVS_PASSWORD=password set HPNVS_DATASOURCE=data-source-name Setting Login Environment Variables in the System Properties 72 1. Right-click the My Computer icon on your desktop, and then select Properties: 2. 3. In the System Properties dialog box, click the Advanced tab.
4. In the Environment Variables dialog box, click New under System or User variables, whichever you prefer. 5. In the New User Variable dialog box, type the name of the login environment variable for the Variable Name and the required value for the Variable Value, and then click OK: 6. 7. 8. Verify that the environment variable appears under System or User variables. Repeat Step 4 to Step 6 for each login environment variable.
export export export export HPNVS_SERVER=host-name:port-number HPNVS_USER=user-name HPNVS_PASSWORD=password HPNVS_DATASOURCE=data-source-name At each command prompt in the C shell, enter one of these commands: setenv setenv setenv setenv HPNVS_SERVER=host-name:port-number HPNVS_USER=user-name HPNVS_PASSWORD=password HPNVS_DATASOURCE=data-source-name Setting Login Environment Variables in the User Profile To set the login environment variables in the user profile: 1. Open the user profile (.profile or .
You can pass only one SQL statement at a time on the Perl or Python command line. The SQL statement must: • • • Be enclosed in double quotes (") without the SQL terminator (;) Contain fully qualified database object names (for example, neo.schema-name.obj-name) Contain the syntax of one of the supported SQL statements. See Appendix B (page 133). See “Perl and Python Commands on Windows” (page 75) and “Perl and Python Commands on Linux or UNIX” (page 75).
For example: >cd /usr/local/hp/nvscript/bin >perl hpnvs.pl "POPULATE INDEX neo.persnl.xempname >ON neo.persnl.employee" • On the Python command line, enter: cd hpnvs-installation-directory/nvscript/bin python hpnvs.py "sql-statement-string" For example: >cd /usr/local/hp/nvscript/bin >python hpnvs.py "SELECT * FROM neo.persnl.employee" The command returns this output: EMPNUM -----1 23 29 32 ...
#-----Reorganize the table -------------------------------------------------$status=`perl /usr/local/hp/nvscript/bin/hpnvs.pl "$reorgtable"`; print "Reorg status :".$status; print "\n"; #----------Update the statistics of the table-------------------------------$status=`perl /usr/local/hp/nvscript/bin/hpnvs.pl "$updatestats"`; print "Update statistics status :".$status; print "\n"; #--------------Fetch results------------------------------------------------@resultrows=`perl /usr/local/hp/nvscript/bin/hpnvs.
hpnvs-installation-directory is the directory where you installed the Neoview Script software files. For more information, see Table 2-1 (page 34). To run a Perl program, enter the perl command at a command prompt, as this example shows: >perl example.pl To run a Python program, enter the python command at a command prompt, as this example shows: >python example.
A Neoview Script Interface Commands Neoview Script supports these commands in the Neoview Script interface or in script files that you run in the Neoview Script interface. For a list of Neoview Script interface commands that are available only to HP support, see the Neoview Database Support Guide. Command Description Syntax @ Runs the SQL statements and See the “@ Command” (page 81). Neoview Script interface commands contained in a specified script file. / Runs the previously executed SQL statement.
Command Description Syntax RUN Runs the previously executed SQL statement. See the “RUN Command” (page 100). SAVEHIST Saves the session history in a user-specified file. See the “SAVEHIST Command” (page 101). SESSION Displays attributes of the current Neoview Script session. See the “SHOW SESSION Command” (page 122). SET COLSEP Sets the column separator and allows See the “SET COLSEP Command” you to control the formatting of the (page 101). result displayed for SQL queries.
Command Description Syntax SHOW MVGROUPS Displays all or a set of the See the “SHOW MVGROUPS materialized view groups in the Command” (page 116). current schema of the Neoview Script session. SHOW MVS Displays all or a set of the See the “SHOW MVS Command” materialized views in the current (page 117). schema of the Neoview Script session. SHOW PARAM Displays the parameters that are set in the current session.
script-file (section-name) is the name of an ASCII text file that contains SQL statements, Neoview Script interface commands, and comments. If the script file exists outside the local directory where you launch Neoview Script (by default, the Neoview Script bin directory), specify the full directory path of the script file. is the name of a section within the script-file to execute.
SQL>/ (EXPR) -------------------62 --- 1 row(s) selected. SQL> CLEAR Command The CLEAR command clears the interface window so that only the prompt appears at the top of the window. CLEAR does not clear the log file or reset the settings of the session. Syntax CLEAR Considerations In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator.
If Neoview Script was invoked with the -noconnect launch parameter, Neoview Script prompts you for the values. Currently, none of the commands work with the -noconnect option. Examples These commands create a new connection to the Neoview platform from the current or existing Neoview Script interface: SQL>connect User Name: super.services Password: Connected to DataSource TDM_Default_DataSource. SQL>connect super.services/password Connected to DataSource TDM_Default_DataSource. SQL>connect super.
ENV Command ENV displays attributes of the current Neoview Script session. You can also use the SESSION and SHOW SESSION commands to perform the same function. Syntax ENV Considerations • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. ENV displays these attributes: COLSEP Current column separator, which is used to control how query results are displayed. For more information, see “SET COLSEP Command” (page 101).
TIMING Current setting (on or off) of the elapsed time. By default, the elapsed time is off. For more information, see “Displaying the Elapsed Time” (page 54) and “SET TIMING Command” (page 113). USER User name that you entered when logging in to the database platform. For more information, see “Logging In to the Database Platform” (page 45).
error-code is an integer that represents an error condition of the previously executed command. If the previously executed command returns this error code, the Neoview Script interface disconnects and exits. Commands that execute successfully in the Neoview Script interface have an error code of zero (0). Interface commands that do not perform SQL operations and that fail to execute have an error code of -1. A failed SQL operation has a specific SQL error code associated with the error condition.
Considerations • • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. You cannot execute this command in a script file. You can execute this command only at a command prompt. As each line of the command is displayed, you can modify the line by entering these editing commands (in uppercase or lowercase letters) on the line below the displayed command line: D Deletes the character immediately above the letter D.
SQL>select * from persnl.employee; .... Pressing Enter executes the corrected SELECT statement. • Correct an SQL statement that you entered incorrectly by using more than one editing command: SQL>selt * fromm persnl.employee; *** ERROR[15001] A syntax error occurred at or before: selt * fromm persnl.employee; ^ *** ERROR[8822] The statement was not prepared. SQL>fc SQL>selt * fromm persnl.employee; .... iec// d SQL>select * from persnl.employee; ....
SQL>where jobcode=450; .... Pressing Enter lists the employee number and last names of all employees whose job code is 450: EMPNUM LAST_NAME -----180 215 216 225 232 -------------------CONRAD LANCASTER JONES HELMSTED SPINNER --- 5 row(s) selected. SQL> HELP Command The HELP command displays help text for the interface commands that are supported in the current operating mode. Syntax HELP [command-name] command-name is the name of an interface command that is supported in the current operating mode.
Syntax HISTORY [number] number is the number of commands to display. The default number is 10. The maximum number is 100. Considerations • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. You can use the FC command to edit and reexecute a command in the history buffer, or use the REPEAT command to reexecute a command without modifying it. See the “FC Command” (page 87) or the “REPEAT Command” (page 98).
Considerations • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. Use a unique name for each log file to avoid writing information from different Neoview Script sessions into the same log file. Examples • This command starts the logging process and records information to the sqlspool.
• MODE and SHOW MODE • SET COLSEP and SHOW COLSEP • SET HISTOPT and SHOW HISTOPT • SET IDLETIMEOUT and SHOW IDLETIMEOUT • SET MARKUP and SHOW MARKUP • SET PROMPT • SET TIME and SHOW TIME • SET TIMING and SHOW TIMING • VERSION All other interface commands are disallowed in CS mode. Considerations • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator.
Considerations • • • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. Put a space between OBEY and the first character of the file name. You can execute this command in a script file. You can specify only one script file at a time using the OBEY command. To run multiple script files in parallel, see “Running Scripts in Parallel” (page 69).
+> CNO VARCHAR(3) +> CNAME VARCHAR(22) +> CDESCP VARCHAR(25) +> CRED INT, +> CLABFEE NUMERIC(5,2), +> CDEPT VARCHAR(4) +> primary key (cno) +>) ; NOT NULL, NOT NULL, NOT NULL, NOT NULL, --- SQL Operation complete. To run only the commands in the insert section, execute the following : SQL>obey C:\Scripts\course.sql (insert) SQL>?section insert SQL>INSERT INTO COURSE VALUES +> ('C11', 'INTRO TO CS','FOR ROOKIES',3, 100, 'CIS'); --- 1 row(s) inserted.
Considerations • • • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. You can execute this command only in SQL mode. If the PRUN command is executed without any arguments, Neoview Script prompts for the PRUN arguments. If one or more options are specified, the PRUN command runs without prompting for more input. In the non-interactive mode, if any options are not specified then the default value of is used.
Total connections .........................5 Total connection failures..................0 You can execute this command only in SQL mode. • PRUN can be started in non-interactive mode using the –q parameter, thus requiring no input: hpnvs.cmd -h arc0101.caclab.cac.cpqcorp.net -dsn TDM_Default_DataSource -u super.services -p host1 -q "prun –sd c:/_nvs/prun -o y -c 3" • PRUN can be started in non-interactive mode from an obey file: SQL>obey startPrun.
log c:\errorCode.log select * from employee; quit if errorcode=4082 log off These results are logged when error code 4082 occurs: SQL>select * from employee; *** ERROR[4082] Table, view or stored procedure NEO.USR.EMPLOYEE does not exist or is inaccessible. *** ERROR[8822] The statement was not prepared. SQL>quit if errorcode=4082 RECONNECT Command The RECONNECT command creates a new connection to the Neoview platform using the login credentials of the last successful connection.
Considerations • • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. To reexecute the immediately preceding command, enter REPEAT without specifying a number. If you enter more than one command on a line, the REPEAT command reexecutes only the last command on the line.
Syntax RESET PARAM [param-name] param-name is the name of the parameter for which you specified a value. Parameter names are case-sensitive. For example, the parameter ?pn is not equivalent to the parameter ?PN. param-name can be preceded by a question mark (?), such as ?param-name. If you do not specify a parameter name, all of the parameter values in the current session are cleared. Considerations • • • In the Neoview Script interface, you must enter the command on one line.
-------------------62 --- 1 row(s) selected. SQL> SAVEHIST Command The SAVEHIST command saves the session history in a user-specified file. The session history consists of a list of the commands that were executed in the Neoview Script session before the SAVEHIST command. Syntax SAVEHIST file-name [CLEAR] file-name CLEAR is the name of a file into which Neoview Script stores the session history.
to use for separating columns in each row of the results. The default delimiter is “ ”(white space). Syntax SET COLSEP [separator] Considerations In the Neoview Script interface, you must enter the command on one line. The SET COLSEP command can be executed only in SQL mode. The SET COLSEP command has no effect if the markup is set to HTML, XML, or CSV.
--- SQL operation complete. SQL> INSERT INTO COURSE1 VALUES +> ('C11', 'INTRO TO CS','FOR ROOKIES',3, 100,'CIS'); --- 1 row(s) inserted. SQL> INSERT INTO COURSE1 VALUES +> ('C55', 'COMPUTER ARCH.','VON NEUMANN''S MACH.',3, 100, 'CIS'); --- 1 row(s) inserted. SQL> history; 1> show histopt 2> obey e:\scripts\nobey\insert2.sql This SET HISTOPT command shows all the commands added to the history buffer. SQL> set histopt all SQL> obey e:\scripts\nobey\insert2.sql ?section insert SQL> set schema neo.
Considerations • • • In the Neoview Script interface, you must enter the command on one line. The command does not require an SQL terminator. If you execute this command in a script file, it affects the session in which the script file runs. You can specify this command in PRUN script files. However, running this command from a PRUN script file does not affect the idle timeout value for the current session.
STEVENS SUPPLY | 700510 | 2003-06-01 | 3333 | NATIONAL UTILITIES | 600480 | 2003-05-12 |
7777 | SLEEP WELL HOTELS | 100250 | 2003-01-23 |
SQL>select c.custnum, c.custname,ordernum,order_date, +>from customer c, orders o where c.custnum=o.custnum;