HP (Hewlett-Packard) 544530-001 Manuale Utente

Pagina di 142
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 FIRST_NAME      LAST_NAME      DEPTNUM JOBCODE SALARY
------ --------------- -------------- ------- ------- --------
     1 ROGER           GREEN             9000     100  175500.00
    23 JERRY           HOWARD            1000     100  137000.10
    29 JANE            RAYMOND           3000     100  136000.00
    32 THOMAS          RUDLOFF           2000     100  138000.40
...
--- 61 row(s) selected.
Launching Neoview Script From a Perl or Python Program
You can execute an SQL statement by invoking the Neoview Script Perl or Python wrapper script
in a Perl or Python program. You can pass only one SQL statement at a time in a perl or python
command. To execute an SQL statement in a Perl or Python program, follow these instructions:
Setting the Login Environment Variables
To invoke the Perl or Python wrapper script in a Perl or Python program, you must set the login
environment variables. For more information, see
.
Using SQL Statements in a Perl or Python Program
In a Perl or Python program, each SQL statement that you invoke with the Perl or Python wrapper
script 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
For examples, see
and
.
Example of a Perl Program (example.pl)
#########################################################################
#   Example Perl program that maintains a database using hpnvs.pl       #
#########################################################################
#----------------------------------------------------------------------------
$reorgtable="REORG TABLE neo.persnl.employee";
$updatestats="UPDATE STATISTICS FOR TABLE neo.persnl.employee ".
             "ON EVERY COLUMN";
$selecttable="SELECT COUNT(*) FROM neo.persnl.employee";
print "\n";
76
Running Neoview Script From Perl or Python