Page 1
HP Neoview SQL Reference Manual HP Part Number: 544582–001 Published: August 2007 Edition: HP Neoview Release 2.2...
Page 2
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
READ WRITE..........................36 Transaction Isolation Levels......................36 READ UNCOMMITTED......................36 READ COMMITTED........................36 SERIALIZABLE or REPEATABLE READ .................36 Transaction Rollback Mode......................37 ANSI Compliance and Neoview SQL Extensions................37 ANSI-Compliant Statements......................37 Statements That Are Neoview SQL Extensions................38 ANSI-Compliant Functions......................38 Neoview SQL Error Messages......................39 Table of Contents...
Page 4
2 SQL Statements......................41 Categories.............................41 Data Definition Language (DDL) Statements.................41 Data Manipulation Language (DML) Statements................42 Transaction Control Statements.......................42 Resource Control and Optimization Statements................42 Control Statements..........................43 Object Naming Statements......................43 Trigger Statements...........................43 Stored Procedure Statements......................43 ALTER MATERIALIZED VIEW Statement..................44 Syntax Description of ALTER MATERIALIZED VIEW..............44 Considerations for ALTER MATERIALIZED VIEW...............44 ALTER MVGROUP Statement......................45 Considerations for ALTER MVGROUP..................45...
Page 5
Limits for Tables..........................74 Calculating Row Size........................75 Creating Partitions Automatically....................75 Record Format..........................75 Generating Unique Values For a Column..................75 Neoview SQL Extensions to CREATE TABLE................77 DISK POOL............................77 Considerations for DISK POOL....................77 Restrictions for DISK POOL.......................78 Examples of CREATE TABLE......................78 Examples of CREATE TABLE AS....................79 CREATE TRIGGER Statement......................81...
Page 6
Restrictions on Triggers......................84 Recompilation and Triggers.......................84 Triggers and Primary Keys......................84 Examples of CREATE TRIGGER.....................85 Before and After Triggers......................85 CREATE VIEW Statement........................87 Syntax Description of CREATE VIEW.....................87 Considerations for CREATE VIEW....................88 Reserved View Names.......................88 Effect of Adding a Column on View Definitions...............88 Authorization and Availability Requirements................88 Updatable and Non-Updatable Views..................88 Examples of CREATE VIEW......................89...
Page 7
Syntax Description of DROP VIEW....................100 Considerations for DROP VIEW....................100 Authorization and Availability Requirements.................100 Example of DROP VIEW.......................100 EXECUTE Statement...........................101 Syntax Description of EXECUTE....................101 Considerations for EXECUTE......................102 Scope of EXECUTE........................102 Examples of EXECUTE........................102 EXPLAIN Statement..........................104 Syntax.............................104 Considerations..........................105 Case Considerations.........................105 Number Considerations......................105 Formatted [OPTIONS 'f'] Considerations................105 Normal User [OPTIONS 'n'] Considerations................106 Expert User [OPTIONS 'e'] Considerations................108...
Page 8
Examples of LOCK TABLE......................128 MERGE INTO Statement........................129 Syntax Description of MERGE INTO....................129 Considerations for MERGE INTO....................129 Upsert Using Single Row......................129 Restrictions..........................130 Upsert Using Rowsets......................130 Example..........................130 MERGE From One Table Into Another..................130 Example..........................131 Reflexive Updates.......................131 PREPARE Statement...........................132 Syntax Description of PREPARE....................132 Considerations for PREPARE......................132 Availability of a Prepared Statement..................132 Examples of PREPARE........................132...
Page 9
Considerations for UNION......................154 Characteristics of the UNION Columns..................154 ORDER BY Clause and the UNION Operator.................155 GROUP BY Clause, HAVING Clause, and the UNION Operator ..........155 UNION ALL and Associativity....................155 Access Modes and the UNION Operator.................155 Examples of SELECT........................156 Examples for Embedded INSERT....................161 SET SCHEMA Statement........................163 Syntax Description of SET SCHEMA....................163 Consideration for SET SCHEMA....................163...
Page 10
MAINTAIN MVGROUP........................184 Examples of MAINTAIN.......................184 POPULATE INDEX Utility.........................186 Syntax Description of POPULATE INDEX..................186 Considerations for POPULATE INDEX..................186 Examples of POPULATE INDEX....................186 PURGEDATA Utility...........................187 Syntax Description of PURGEDATA.....................187 Considerations for PURGEDATA....................187 Examples of PURGEDATA......................187 4 SQL Language Elements...................189 Character Sets............................190 Columns..............................191 Column References........................191 Derived Column Names........................191 Column Default Settings........................191...
Page 11
Examples of Numeric Value Expressions.................219 Identifiers............................220 Regular Identifiers.........................220 Delimited Identifiers........................220 Examples of Identifiers........................220 Indexes..............................221 SQL Indexes...........................221 Keys..............................222 Clustering Keys..........................222 Index Keys.............................222 SQL Index Keys........................222 Primary Keys..........................222 Literals..............................223 Character String Literals........................223 Considerations for Character String Literals................224 Examples of Character String Literals..................224 Datetime Literals..........................225 Examples of Datetime Literals....................225 Interval Literals..........................226...
Page 12
Considerations for Search Condition....................248 Order of Evaluation........................248 Column References........................248 Subqueries..........................248 Examples of Search Condition.......................249 Subquery.............................250 SELECT Form of a Subquery......................250 Using Subqueries to Provide Comparison Values.................250 Nested Subqueries When Providing Comparison Values.............250 Correlated Subqueries When Providing Comparison Values............251 Tables..............................252 Base Tables and Views........................252 Example of a Base Table........................252 Triggers..............................253 Views..............................254...
Page 13
ASCII Function............................289 Example of ASCII..........................289 ASIN Function.............................290 Examples of ASIN..........................290 ATAN Function...........................291 Examples of ATAN........................291 ATAN2 Function..........................292 Example of ATAN2........................292 AVG Function............................293 Considerations for AVG.........................293 Data Type of the Result......................293 Operands of the Expression.....................293 Nulls............................293 Examples of AVG...........................293 CASE (Conditional) Expression......................295 Considerations for CASE.......................296 Data Type of the CASE Expression..................296 Character Data Type.........................296...
Page 14
Operands of the Expression.....................310 Nulls............................310 Examples of COUNT........................310 CURRENT Function..........................312 Example of CURRENT........................312 CURRENT_DATE Function........................313 Examples of CURRENT_DATE.....................313 CURRENT_ROLE Function........................314 Example of CURRENT_ROLE.......................314 CURRENT_TIME Function.........................315 Example of CURRENT_TIME.......................315 CURRENT_TIMESTAMP Function....................316 Example of CURRENT_TIMESTAMP...................316 CURRENT_USER Function........................317 Example of CURRENT_USER.......................317 DATE_ADD Function.........................318 Examples of DATE_ADD.......................318 DATE_SUB Function...........................319 Examples of DATE_SUB........................319...
Page 15
Examples of DIFF2.........................336 EXP Function............................338 Examples of EXP..........................338 EXPLAIN Function..........................339 Considerations for EXPLAIN Function..................339 Using a Statement Pattern......................339 Result of the EXPLAIN Function.....................339 Examples of EXPLAIN Function....................341 EXTRACT Function..........................342 Examples of EXTRACT........................342 FLOOR Function..........................343 Examples of FLOOR........................343 HOUR Function..........................344 Example of HOUR.........................344 INSERT Function..........................345 Examples of INSERT........................345 ISNULL Function..........................346...
Page 16
Example of MOD...........................364 MONTH Function..........................365 Example of MONTH........................365 MONTHNAME Function........................366 Example of MONTHNAME......................366 MOVINGAVG Function........................367 Example of MOVINGAVG......................367 MOVINGCOUNT Function........................368 Considerations for MOVINGCOUNT...................368 No DISTINCT Clause.......................368 Example of MOVINGCOUNT.......................368 MOVINGMAX Function........................370 Example of MOVINGMAX......................370 MOVINGMIN Function........................371 Example of MOVINGMIN......................371 MOVINGSTDDEV Function.......................372 Example of MOVINGSTDDEV......................372 MOVINGSUM Function........................374 Example of MOVINGSUM......................374...
Page 17
Examples of RUNNINGSTDDEV....................389 REPEAT Function..........................390 Example of REPEAT........................390 REPLACE Function..........................390 Example of REPLACE........................391 RIGHT Function..........................391 Examples of RIGHT........................391 ROUND Function..........................392 Examples of ROUND........................392 ROWS SINCE Function........................392 Considerations for ROWS SINCE....................393 Counting the Rows........................393 Examples of ROWS SINCE......................393 ROWS SINCE CHANGED Function....................394 Considerations for ROWS SINCE CHANGED................394 Counting the Rows........................394 Examples of ROWS SINCE CHANGED..................394...
Page 18
STDDEV Function..........................409 Considerations for STDDEV......................409 Definition of STDDEV......................409 Data Type of the Result......................409 Operands of the Expression.....................409 Nulls............................409 FLOAT(54) and DOUBLE PRECISION Data................409 Examples of STDDEV........................410 SUBSTRING/SUBSTR Function......................411 Alternative Forms..........................411 Considerations for SUBSTRING/SUBSTR..................411 Requirements for the Expression, Length, and Start Position..........411 Examples of SUBSTRING/SUBSTR....................411 SUM Function.............................413 Considerations for SUM........................413...
Page 19
A Quick Reference......................435 B Reserved Words......................437 Reserved Neoview SQL Identifiers ....................437 C Limits...........................441 D Standard SQL and Neoview SQL................443 ANSI SQL Standards...........................443 ISO Standards............................443 Neoview SQL Compliance........................444 Neoview SQL Extensions to Standard SQL..................447 Character Set Support.........................448 Index..........................449 Table of Contents...
Page 21
List of Tables Concurrent DDL/Utility Operation and File Access Modes............33 Concurrent DDL/Utility and DML Operations................34 Concurrent DML and DDL Operations ..................34 Operations Effect on Table Timestamps ..................35 Maximum Row Sizes Available.....................74 EXPLAIN Statement Options......................104 Plan Summary Information......................106 Node Listing Information ......................106 Cost Factors of DETAIL_COST column..................111 One-to-One Uppercase and Titlecase to Lowercase Mappings ..........354 One-to-One UCS2 Mappings ......................419...
This manual describes reference information about the syntax of SQL statements, functions, and other SQL language elements supported by the Neoview database software. The Neoview SQL statements and utilities are entered interactively or from script files using the client-based utility, Neoview Script. For information on Neoview Script, see the Neoview Script Guide.
New function. Document Organization • Chapter 1 (page 29), introduces Neoview SQL and covers topics such as database security, data consistency and integrity, transaction management, and ANSI compliance. • Chapter 2 (page 41), describes the SQL statements supported by Neoview SQL.
Page 25
myfile.sh Bold Text Bold text in an example indicates user input typed at the terminal. For example: ENTER RUN CODE ?123 CODE RECEIVED: 123.00 The user must press the Return key after typing the input. [ ] Brackets Brackets enclose optional syntax items. For example: DATETIME [start-field TO] end-field A group of items enclosed in brackets is a list from which you can choose one item or none.
For example: match-value [NOT] LIKE pattern [ESCAPE esc-char-expression] Related Documentation This manual is part of the HP Neoview customer library. 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.
544505–001 May 2007 544582–001 HP Encourages Your Comments HP encourages your comments concerning this document. We are committed to providing documentation that meets your needs. Send any errors found, suggestions for improvement, or compliments to: pubs.comments@hp.com Include the document title, part number, and any comment, error found, or suggestion for improvement you have concerning this document.
Security The services ID is intended to be used only to support the database without having access to the data itself. The services ID cannot manage user accounts. Only HP support has access to the super ID. User IDs and Role The system setup scripts perform initial configuration of services IDs.
Data Consistency and Access Options Access options for DML statements affect the consistency of the data that your query accesses. For any DML statement, you specify access options by using the FOR option ACCESS clause and, for a SELECT statement, by using this same clause, you can also specify access options for individual tables referenced in the FROM clause.
To protect the integrity of the database, Neoview SQL provides locks on data. For example, Neoview SQL locks a row when an executing process accesses a row to modify it. The lock ensures that no other process simultaneously modifies the same row.
Lock mode is sometimes determined by Neoview SQL. SQL ensures that an exclusive lock is in effect for write operations and usually acquires a shared lock for operations that access data without modifying it. You choose lock mode in these instances: •...
AUTOCOMMIT is an option that can be set in a SET TRANSACTION statement. It specifies whether Neoview SQL will commit automatically, or roll back if an error occurs, at the end of statement execution. This option applies to any statement for which the system initiates a transaction.
Page 34
Table 1-2 Concurrent DDL/Utility and DML Operations DML Operation in Progress DDL Operations You SELECT SELECT SHARE SELECT EXCLUSIVE UPDATE/ INSERT/ Can Start UNCOMMITTED DELETE ALTER TABLE Allowed Allowed Allowed Allowed attributes ALTER TABLE other Allowed Waits Waits Waits CREATE INDEX with Allowed Allowed Waits...
Table 1-3 Concurrent DML and DDL Operations (continued) DML Operations You Can Start REVOKE Allowed Allowed Waits Waits UPDATE Allowed Allowed Allowed Allowed STATISTICS DDL operation aborts the DML operation. Allowed except during commit phase. Table 1-4 describes the effect of various DDL and utility operations on table timestamps: Table 1-4 Operations Effect on Table Timestamps Alter Operation Timestamp Updated...
“READ COMMITTED”, “SERIALIZABLE or REPEATABLE READ ”. The Neoview SQL implementation for REPEATABLE READ and SERIALIZABLE is equivalent. SERIALIZABLE is used for purposes of illustration. You can set the isolation level of a transaction explicitly by using a SET TRANSACTION statement.
For these situations, Neoview SQL raises an error during compilation. When Rollback Mode is set to OFF, Neoview SQL sets the auto abort interval for the transaction to 0, indicating that this transaction should never abort for exceeding a predefined time interval.
Neoview SQL Error Messages Neoview SQL reports error messages and exception conditions When an error condition occurs, Neoview SQL returns a message number and a brief description of the condition. For example, Neoview SQL might display this error message: *** ERROR[1000] A syntax error occurred.
• “Stored Procedure Statements” Data Definition Language (DDL) Statements Use these DDL statements to define, delete, or modify the definition of a Neoview SQL schema, or object, or the authorization to use an object. “ALTER MATERIALIZED VIEW Statement” (page 44) Changes materialized views.
Resource Control and Optimization Statements Use these statements to control access to a Neoview SQL table and its indexes on remote segments: “EXECUTE Statement” (page 101) Executes and SQL statement previously compiled by a PREPARE statement.
Control Statements Use these statements to control the execution default options, plans, and performance of DML statements: “SET TABLE TIMEOUT Statement” (page 164) Specifies a dynamic timeout value in the run-time environment of the current session. Object Naming Statements Use these statements to specify default ANSI names for the schema: “SET SCHEMA Statement”...
ALTER MATERIALIZED VIEW Statement • “Syntax Description of ALTER MATERIALIZED VIEW” (page 44) • “Considerations for ALTER MATERIALIZED VIEW” (page 44) The ALTER MATERIALIZED VIEW statement changes a materialized view.. See “Database Object Names” (page 196). ALTER {MATERIALIZED VIEW | MV} name mv-alter-action mv-alter-action is: MVATTRIBUTES[S] mv-attribute | {ADD | REMOVE} IGNORE CHANGES ON simple-table [,simple-table]..]...
ALTER MVGROUP Statement • “Syntax Description of ALTER MATERIALIZED VIEW” • “Considerations for ALTER MATERIALIZED VIEW” The ALTER MVGROUP statement allows you to add or remove a member from the materialized view group (MVGROUP). The ADD clause should be used when adding one or more MVs to the MVGROUP.
ALTER SYNONYM alternate-name TO object; alternate-name specifies the name of the synonym. See “Database Object Names” (page 196). object specifies Neoview SQL tables, views, and materialized views. See “Database Object Names” (page 196). Considerations • When the object being referenced by the synonym is dropped, then the synonym is also dropped.
“Syntax Description of ALTER TABLE” • “Considerations for ALTER TABLE” • “Example of ALTER TABLE”\ The ALTER TABLE statement adds a column to a Neoview SQL table. See “Database Object Names” (page 196). ALTER TABLE name alter-action ATTRIBUTE {NO INSERTLOG | INSERTLOG}...
Page 48
SQL identifier. column-name must be unique among column names in the table. If the column name is a Neoview SQL reserved word, you must delimit it by enclosing it in double quotes. For example: "sql".myview. See “Identifiers”...
SQL identifier. column must be unique among column names in the table. If the name is a Neoview SQL reserved word, you must delimit it by enclosing it in double quotes. Such delimited parts are case-sensitive. For example: "join".
ALTER TRIGGER Statement • “Syntax Description of ALTER TRIGGER” • “Considerations for ALTER TRIGGER” The ALTER TRIGGER statement is used to enable or disable triggers, individually or by SQL tables. ALTER TRIGGER { ENABLE trigger-name ENABLE ALL OF table-name | DISABLE trigger-name DISABLE ALL OF table-name};...
ALTER VIEW Statement • “Syntax Description of ALTER VIEW” • “Example of ALTER VIEW” The ALTER VIEW statement adds a column to a Neoview SQL table. See “Database Object Names” (page 196). ALTER VIEW name alter-action alter-action is: RENAME TO new name...
BEGIN WORK and ends with the next COMMIT or ROLLBACK statement. See “Transaction Management” (page 32). BEGIN WORK is a Neoview SQL extension. BEGIN WORK Examples of BEGIN WORK • Group three separate statements—two INSERT statements and an UPDATE statement—that update the database within a single transaction: --- This statement initiates a transaction.
“Identifiers” (page 220). If you do not fully qualify the procedure name, Neoview SQL qualifies it according to the schema of the current session. argument-list accepts arguments for IN, INOUT, or OUT parameters. The arguments consist of SQL expressions, including dynamic parameters, separated by commas: SQL-expression[{, SQL-expression}...]...
Stored Procedures in Java. Data Conversion of Parameter Arguments Neoview SQL performs an implicit data conversion when the data type of a parameter argument is compatible with but does not match the formal data type of the stored procedure. For stored procedure input values, the conversion is from the actual argument value to the formal parameter type.
COMMIT WORK Statement • “Considerations for COMMIT WORK” • “Example of COMMIT WORK” The COMMIT WORK statement commits any changes to objects made during the current transaction, releases all locks on objects held by the transaction, and ends the transaction. See “Transaction Management”...
• “Example of CREATE INDEX” The CREATE INDEX statement creates a Neoview SQL index based on one or more columns of a table. The CREATE VOLATILE INDEX statement creates a Neoview SQL index with a lifespan that is limited to the SQL session that the index is created. Volatile indexes are dropped automatically when the session ends.
186). Authorization and Availability Requirements To create a Neoview SQL index, you must be the owner of the underlying table or be the services When the POPULATE option is specified, CREATE INDEX locks out INSERT, DELETE, and UPDATE operations on the table being indexed. If other processes have rows in the table locked when the operation begins, CREATE INDEX waits until its lock request is granted or timeout occurs.
CREATE MATERIALIZED VIEW Statement • “Syntax Description of CREATE MATERIALIZED VIEW” • “Considerations for CREATE MATERIALIZED VIEW” • “Example of CREATE MATERIALIZED VIEW” The CREATE MATERIALIZED VIEW statement creates a materialized view. CREATE {MATERIALIZED VIEW | MV} mv-name [column-name-list] { RECOMPUTE | REFRESH refresh-type } { INITIALIZE ON REFRESH | INITIALIZE ON CREATE } file-options AS query-expr...
Page 61
column-name-list specifies names for the columns in the materialized view, as well as headings for the columns. Column names in the list correspond directly to columns in the query-expr. If you omit this clause, columns in the materialized view will have the same names as the corresponding columns in the query-expr.
• Materialized views cannot be created on views. Types of Materialized Views Neoview SQL defines the following three types of materialized views: • Materialized Join View (MJV): A materialized join view that holds the results of a join query with inner equi-joins of several tables. Outer joins and cross joins are not supported. These tables can be base tables or other MVs.
These indexes are not created for underlying tables with INSERTLOG attribute or those tables that are included in the MV's IGNORE CHANGES clause. Neoview SQL tries to minimize the number of secondary indexes created by the system based on the equal predicates in the query expression.
Joins • An inner equi-join query is a query where rows from each table are matched to specific rows in other tables using equal predicates. • Outer joins include LEFT OUTER JOIN or FULL OUTER JOIN. • In a cross join, not all predicates are given so each row of a table is matched with all the rows of the other table.
Page 65
TOTAL_AVAIL FROM PUBSCH.DETAIL_TABLE WHERE PUBSCH.DETAIL_TABLE.ORDERNUM > 1 GROUP BY PUBSCH.DETAIL_TABLE.ORDERNUM; • This is an example of an MJV: CREATE MATERIALIZED VIEW sales_store REFRESH ON REQUEST INITIALIZE ON REFRESH AS SELECT price, partkey, timekey, store.nam FROM sales, store WHERE sales.storekey = store.storekey; •...
CREATE MVGROUP Statement The CREATE MVGROUP statement groups together materialized views that are defined on a common table to preserve database consistency. For information on MVGROUPS, see “MVGROUPs ” (page 254)and “MAINTAIN MVGROUP” (page 184). CREATE MVGROUP mv-group-name mv-group-name specifies the materialized view group name to create. Example of CREATE MVGROUP •...
CREATE SYNONYM alternate-name FOR object; alternate-name specifies the name of the synonym. See “Database Object Names” (page 196). object specifies Neoview SQL tables, views, and materialized views can be specified. See “Database Object Names” (page 196). Considerations • When the object being referenced by the synonym is dropped, the synonym is also dropped.
The CREATE TABLE statement creates a Neoview SQL table. The CREATE VOLATILE TABLE statement creates a Neoview SQL table in a SQL session. Volatile tables are dropped automatically when the session ends. The CREATE TABLE AS statement creates a table based on the data...
Page 70
attributes of a SELECT query and populates the table using the data returned by the SELECT query. See “Database Object Names” (page 196). CREATE [VOLATILE] TABLE table (table-element [,table-element]...) | table-spec | like-spec } [NO PARTITION | HASH PARTITION BY (partitioning-column, partitioning-column...)] [MAX TABLE SIZE megabytes] [DISK POOL number]...
default is: literal | NULL | CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP column-constraint is: NOT NULL | PRIMARY KEY [ASC[ENDING] | DESC[ENDING]] | CHECK (condition) column-list is: column-name [,column-name]... table-constraint is: PRIMARY KEY (key-column-list) |CHECK (condition) [NOT CASESPECIFIC] key-column-list is: column-name [ASC[ENDING] | DESC[ENDING]] [,column-name [ASC[ENDING] | DESC[ENDING]]]...
Page 72
SQL identifier. column must be unique among column names in the table. If the name is a Neoview SQL reserved word, you must delimit it by enclosing it in double quotes. Such delimited parts are case-sensitive. For example: "join".
You can specify PRIMARY KEY only once on any CREATE TABLE statement. Neoview SQL uses the primary key as the clustering key of the table in order to avoid creating a separate, unique index to implement the primary key constraint.
LIKE specification are defined as if the new table is created explicitly by the current user. If the source table has any unique or droppable primary key constraints, Neoview SQL creates indexes for them on the target table. Other indexes on the source table are not created on the target table.
If this clause is not specified, Neoview SQL will decide. If the table is partitioned then the table is automatically partitioned across all the disk volumes on the system.
Page 76
RULES • Only one IDENTITY column can be used in a table. • Values for the IDENTITY column are generated by default. If you specify a value for the IDENTITY column, the system uses that value and does not generate a unique value for that row.
NOTE: In Neoview SQL, the partitioning key must be a subset of the clustering key. In the case of a table with a single column clustering key, the partitioning key must be the same as the clustering key.
• By default, tables are assigned to disk pools in a round robin fashion. • The default number of partitions created are as many number of disks in a disk pool. • A non partitioned table can be created within a disk pool using the NO PARTITION clause. Restrictions for DISK POOL DISK POOL cannot be used with volatile tables, materialized views, indexes, and CREATE TABLE LIKE.
• A row is not returned in this example. Constant ‘A’ is case sensitive, whereas column ‘a’ is insensitive. SELECT * FROM T WHERE a = ‘A’; • The row is returned in this example. Both sides are case sensitive. SELECT * FROM T WHERE a = ‘A’...
Page 80
create table t(a int, b) as select c,d from t1 An error is returned. This section shows the file attributes, such as partitioning information and clustering keys, which can be specified for the table being created. All the file options that can be specified during a regular CREATE statement can be specified during a CREATE TABLE AS statement.
CREATE TRIGGER Statement • “Syntax Description of CREATE TRIGGER” • “Considerations for CREATE TRIGGER” • “Examples of CREATE TRIGGER” The CREATE TRIGGER statement is used to create triggers on SQL tables. A trigger is a mechanism that sets up the database system to perform certain actions automatically in response to the occurrence of specified events.
old-new-alias is the list of correlation name of table aliases used by a trigger. correlation-name is the name of the old or new row acted upon by the trigger. table-alias is the name of the old or new table acted upon by the trigger. search-condition is the condition that, when true, activates this trigger.
Page 83
BEFORE triggered statements Triggering statement AFTER triggered statements Execution of a statement is considered to be complete only when all cascaded triggers are complete. When multiple triggers are activated by the same event (that is, a conflict set), the next trigger from the original conflict set is considered only after the execution of cascaded triggers of a specific trigger is complete (depth-first execution).
Restrictions on Triggers • The trigger feature does not allow the use of: — Positioned deletes and updates as triggered statements. — Subqueries in search-condition for AFTER triggers (but they are allowed in search-condition for BEFORE triggers.) • To create a trigger on a given table, the name of the table should be at least six characters less than the maximum length of a valid table name (128 characters).
Examples of CREATE TRIGGER Before and After Triggers Suppose that you have a database to record patients’ vital signs and drugs prescribed for them. The database consists of these tables: • vital_signs, which records vital signs at each visit • prescription, which records prescriptions written for each patient •...
Page 86
record.vital_id), (SELECT record.id FROM record WHERE sample.id = record.vital_id), CURRENT_DATE, 'POUND OFF', '200 mg', '1 pill 1 hour before each meal', 0, 'Free sample no refills' SQL Statements...
column-name specifies the name for a column in the view. column-name is an SQL identifier. column-name must be unique among column names in the view and cannot be a reserved word. It can contain a reserved word if it is delimited. If you do not specify this clause, columns in the view have the same names as the columns in the select list of query-expr.
To define an updatable view, a query expression must also meet these requirements: • It cannot contain a JOIN, UNION, or EXCEPT clause. • It cannot contain a GROUP BY or HAVING clause. • It cannot directly contain the keyword DISTINCT. •...
DELETE Statement • “Syntax Description of DELETE” • “Considerations for DELETE” • “Examples of DELETE” The DELETE statement is a DML statement that deletes a row or rows from a table or an updatable view. Deleting rows from a view deletes the rows from the table on which the view is based. DELETE does not remove a table or view, even if you delete the last row in the table or view.
Page 91
A scalar subquery in expression cannot refer to the table being updated. If expression refers to columns being updated, Neoview SQL uses the original values to evaluate the expression and determine the new value.
Considerations for DELETE Authorization Requirements DELETE requires authority to read and write to the table or view being deleted from and authority to read tables or views specified in subqueries used in the search condition. Transaction Initiation and Termination The DELETE statement automatically initiates a transaction if no transaction is active. Otherwise, you can explicitly initiate a transaction with the BEGIN WORK statement.
To drop an index, you must be the owner of the schema. Indexes That Support Constraints Neoview SQL uses indexes to implement some constraints. If you use the DROP CONSTRAINT option in an ALTER TABLE statement, Neoview SQL drops indexes that it created to implement that constraint. Example of DROP INDEX •...
DROP MATERIALIZED VIEW Statement • “Syntax Description of DROP MATERIALIZED VIEW” • “Example of DROP MATERIALIZED VIEW” The DROP MATERIALIZED VIEW statement drops a materialized view. You cannot drop a materialized view that is used by other materialized views or by regular views unless the CASCADE option is used.
DROP MVGROUP Statement • “Considerations for DROP MVGROUP” • “Example of DROP MVGROUP” The DROP MVGROUP statement allows you to drop materialized view groups. For information on MVGROUPS, see “MVGROUPs ” (page 254). DROP MVGROUP mv-group-name mv-group-name specifies the materialized view group name to drop. Considerations for DROP MVGROUP •...
• “Syntax Description of DROP SCHEMA” • “Considerations for DROP SCHEMA” • “Example of DROP SCHEMA” The DROP SCHEMA statement deletes a Neoview SQL schema. See“Schemas” (page 247). DROP SCHEMA schema Syntax Description of DROP SCHEMA schema is the name of the schema to drop.
DROP SYNONYM Statement • “Syntax Description of DROP SYNONYM ” • “Considerations” • “Versioning Considerations” • “Example of DROP SYNONYM” The DROP SYNONYM statement allows you to drop synonyms for tables, views, or materialized views that can be used in queries. You can write queries that reference the synonym and later alter the synonym to point to a different object with the same structure.
“Syntax Description of DROP TABLE” • “Considerations for DROP TABLE” • “Example of DROP TABLE” The DROP TABLE statement deletes a Neoview SQL table and its dependent objects such as indexes and constraints. See “Database Object Names” (page 196). DROP [VOLATILE] TABLE table...
DROP TRIGGER Statement • “Syntax Description of DROP TRIGGER” • “Considerations for DROP TRIGGER” • “Examples of DROP TRIGGER” The DROP TRIGGER statement is used to drop a trigger on an SQL table. DROP TRIGGER trigger-name; Syntax Description of DROP TRIGGER trigger-name specifies the name of the trigger to be dropped, of the form: [[catalog-name.]schema-name.]trigger-name...
• “Syntax Description of DROP VIEW” • “Considerations for DROP VIEW” • “Example of DROP VIEW” The DROP VIEW statement deletes a Neoview SQL view. See “Views” (page 254). DROP VIEW view Syntax Description of DROP VIEW view is the name of the view to drop.
If there are fewer parameter values in the USING clause than there are unnamed parameters in the PREPARE statement, Neoview SQL returns an error. If there are more parameter values in the USING clause than there are unnamed parameters in the PREPARE statement, Neoview SQL ignores the extra parameter values.
Considerations for EXECUTE Scope of EXECUTE A statement must be compiled by PREPARE before you EXECUTE it, but after it is compiled, you can execute the statement multiple times without recompiling it. The statement must have been compiled during the same Neoview Script session as its execution. Examples of EXECUTE •...
Page 103
--- 1 row(s) selected. SQL>execute findemp using 20000.00, 300; EMPNUM FIRST_NAME LAST_NAME DEPTNUM JOBCODE SALARY ------ --------------- -------------- ------- ------- -------- 75 TIM WALKER 3000 300 32000.00 89 PETER SMITH 3300 300 37000.40 --- 13 row(s) selected. • Use SET PARAM to assign a value to a parameter name and specify both the parameter name and a literal value in the EXECUTE USING clause: SQL>prepare findemp from +>select * from persnl.employee...
The EXPLAIN statement helps you to review query execution plans. You can use the EXPLAIN statement anywhere you can execute other Neoview database statements (for example, SELECT). For information about Neoview Script, see the HP Neoview Script Guide For more information on the EXPLAIN function, see “EXPLAIN Function”...
Considerations • “Case Considerations” (page 105) • “Number Considerations” (page 105) • “Formatted [OPTIONS 'f'] Considerations” (page 105) • “Normal User [OPTIONS 'n'] Considerations” (page 106) • “Expert User [OPTIONS 'e'] Considerations” (page 108) • “Machine-Readable [OPTIONS 'm'] Considerations” (page 110) Case Considerations In most cases, words in the commands can be in uppercase or lowercase.
PREPARE q FROM SELECT * FROM REGION; EXPLAIN options 'f' q; The FILE_SCAN operator is the only operator in this example that shows additional information in the OPT and DESCRIPTION fields. 'fs' indicates that fast-scan optimization was used. 'fr' indicates that fast-reply data-move optimization was used. The table name is shown in the DESCRIPTION field.
Page 107
Table 2-4 Node Listing Information (continued) Field Description EST_TOTAL_COST Estimated cost associated with execution of the current operator and all children. DESCRIPTION Additional information about the operation. For example, in the case of a scan, the description field shows scan_type, scan_direction, lock_mode, access_mode, columns_retrieved, optimization information, and so on.
Page 111
Column Name Data Type Description TNAME CHAR(60) For operators in scan group, full name of base table, truncated on the right if too long for column. If correlation name differs from table name, simple correlation name first and then table name in parentheses.
Example of EXPLAIN Statement Using ODBC Suppose an application prepares a SELECT statement: “SELECT * FROM ODBC_PERSNL.EMPLOYEE”. Use SQLGetCursorName to find the statement name. In this example, the returned statement name is "SQL_CUR_21". To get the plan for “SELECT * FROM ODBC_PERSNL.EMPLOYEE”, the application must allocate another statement handle and issue SQLExecDirect on “EXPLAIN options ‘f’...
• “Examples of GRANT” The GRANT statement grants access privileges for a Neoview SQL table, view, or materialized view to specified roles or through a synonym of a table, view, or materialized view. GRANT { privilege [,privilege]... | ALL [PRIVILEGES] } ON [TABLE] object TO {grantee [,grantee ]...
WITH GRANT OPTION specifies that roles to whom privileges are granted have the right to grant the same privilege to other roles. Considerations for GRANT Authorization and Availability Requirements To grant a privilege on an object, you must have both that privilege and the right to grant that privilege.
GRANT EXECUTE Statement • “Syntax Description of GRANT EXECUTE” • “Considerations for GRANT EXECUTE” • “Examples of GRANT EXECUTE” The GRANT EXECUTE statement grants privileges for executing a stored procedure in Java (SPJ) to one or more specified roles. GRANT EXECUTE ON [PROCEDURE] procedure-ref TO {grantee [,grantee ]...
Examples of GRANT EXECUTE • The SPJ owner grants EXECUTE and WITH GRANT OPTION privileges on the ADJUSTSALARY procedure to the role 'ROLE.HR': GRANT EXECUTE ON PROCEDURE persnl.adjustsalary TO 'ROLE.HR' WITH GRANT OPTION; • The role 'ROLE.HR' grants EXECUTE privilege on the ADJUSTSALARY procedure to other roles: GRANT EXECUTE ON PROCEDURE persnl.adjustsalary...
GRANT SCHEMA Statement • “Syntax Description of GRANT SCHEMA” • “Considerations for GRANT SCHEMA” • “Examples of GRANT SCHEMA” The GRANT SCHEMA statement grants access privileges for a schema to specified roles. GRANT {privilege [,privilege]... | ALL [PRIVILEGES] } ON SCHEMA schema-name TO {grantee [,grantee ]...
Considerations for GRANT SCHEMA Authorization and Availability Requirements To grant a privilege on a schema, you must have both that privilege and the right to grant that privilege. That is, the privilege must have been issued to you WITH GRANT OPTION and not revoked.
INSERT Statement • “Syntax Description of INSERT” • “Considerations for INSERT” • “Examples of INSERT” The INSERT statement is a DML statement that inserts rows in a table or view. INSERT [NOMVLOG] [WITH NO ROLLBACK] INTO table [(target-col-list)] insert-source target-col-list is: colname [,colname]...
Page 122
The use of DEFAULT in a value expression is a Neoview SQL extension. If you attempt to insert NULL into a column that is defined as NOT NULL or DEFAULT into a column that is defined with NO DEFAULT, Neoview SQL returns an error. For the description of value expressions, see “Expressions”...
ASC | DESC specifies the sort order. The default is ASC. For ordering the source table on a column that can contain null, nulls are considered equal to one another but greater than nonnulls. DEFAULT VALUES specifies a query expression of the form VALUES (DEFAULT, ... ). The value of each DEFAULT is the default value defined in the column descriptor of colname, which is contained in the table descriptor of table.
Isolation Levels of Transactions and Access Options of Statements The isolation level of a Neoview SQL transaction defines the degree to which the operations on data within that transaction are affected by operations of concurrent transactions. When you specify access options for the DML statements within a transaction, you override the isolation level of the containing transaction.
In addition to inserting values with specific data types, you might want to insert nulls. To insert null, use the keyword NULL. Examples of INSERT • Insert a row into the CUSTOMER table and supply the value 'A2' for the CREDIT column: INSERT INTO sales.customer VALUES (4777, 'ZYROTECHNIKS', '11211 40TH ST.', 'BURLINGTON', 'MASS.', '01803', 'A2');...
Page 126
• The PROJECT table consists of five columns using the data types numeric, varchar, date, timestamp, and interval. Insert values by using these types: INSERT INTO persnl.project VALUES (1000, 'SALT LAKE CITY', DATE '1996-10-02', TIMESTAMP '1996-12-21:08:15:00.00', INTERVAL '30' DAY); --- 1 row(s) inserted. •...
At the start of a session, the AUTOCOMMIT option is ON by default. When this option is ON, Neoview SQL automatically commits any changes, or rolls back any changes, made to the database at the end of statement execution. When you issue a LOCK TABLE statement without turning off AUTOCOMMIT, Neoview SQL locks the table temporarily, commits the transaction at the end of the LOCK TABLE statement and releases the locks.
Indexes LOCK TABLE attempts to lock all indexes of any table it locks. If an index is not available or if the lock request times out, LOCK TABLE displays a warning and continues to request locks on other indexes. Examples of LOCK TABLE •...
MERGE INTO Statement • “Syntax Description of MERGE INTO” • “Considerations for MERGE INTO” The MERGE INTO statement provides upsert, reflexive updates, and updates from one table into another.. MERGE INTO table [using-clause ] on-clause {[when-matched-clause] [when-not-matched-clause]} using-clause is: USING (select-query) AS derived-table-name [derived-column-names] on-clause is: ON predicate...
Restrictions • A merged table cannot be a view. • Merge is not allowed if the table has triggers or constraints. • Merge is not allowed with SET ON ROLLBACK. • on-clause must be unique. This statement is not allowed: MERGE INTO t ON a >...
Example This query extracts derived columns 'a' and 'b' from the USING query as derived table 'z' and use each row to join to the merged table 't' based on the ON clause. For each matched row, column 'b' in table 't' is updated using column 'b' in derived table 'z'. For rows that are not matched, values z.a and z.b are inserted.
PREPARE Statement • “Syntax Description of PREPARE” • “Considerations for PREPARE” • “Examples of PREPARE” The PREPARE statement compiles an SQL statement for later use with the EXECUTE statement in a Neoview Script session. You can also use PREPARE to check the syntax of a statement without executing the statement in a Neoview Script session.
Page 133
SALARY ---------- 32000.00 33000.50 40000.00 32000.00 45000.00 --- 5 row(s) selected. SQL> • Prepare a SELECT statement with a named parameter (?param-name) and later run EXECUTE on it: SQL>prepare findsal from +>select salary from persnl.employee +>where jobcode = ?job; --- SQL command prepared. SQL>set param ?job 450 SQL>execute findsal;...
“Considerations for REVOKE” • “Examples of REVOKE” The REVOKE statement revokes access privileges for a Neoview SQL table, view, or materialized view from specified roles or through a synonym of a table, view, or materialized view. REVOKE [GRANT OPTION FOR] {privilege [,privilege ]...| ALL [PRIVILEGES]}...
grantee is authid | PUBLIC authid specifies an authorization ID to whom you revoke privileges. Authorization IDs identify roles during the processing of SQL statements. The authorization ID must be a valid role name, enclosed in double quotes. authid is not case-sensitive. SQL:1999 specifies two special authorization IDs: PUBLIC and SYSTEM.
REVOKE EXECUTE Statement • “Syntax Description of REVOKE EXECUTE” • “Considerations for REVOKE EXECUTE” • “Examples of REVOKE EXECUTE” The REVOKE EXECUTE statement removes privileges for executing a stored procedure in Java (SPJ) from one or more specified roles. REVOKE [GRANT OPTION FOR] EXECUTE ON [PROCEDURE] procedure-ref FROM {grantee [,grantee ]...
Considerations for REVOKE EXECUTE Authorization and Availability Requirements You can revoke the EXECUTE privilege from a role only if you have previously granted it to the role. If the privilege does not exist, the system returns a warning. To revoke privileges by using the CASCADE option, you must be the SPJ owner (that is, the creator of the stored procedure).
“Syntax Description of REVOKE SCHEMA” • “Considerations for REVOKE SCHEMA” • “Examples of REVOKE SCHEMA” The REVOKE SCHEMA statement revokes access privileges for a Neoview SQL schema from specified roles. See also“ROLLBACK WORK Statement” (page 140). REVOKE [GRANT OPTION FOR] {privilege [,privilege ] ...| ALL [PRIVILEGES ]}...
grantee is authid | PUBLIC authid specifies an authorization ID from which you revoke privileges. Authorization IDs identify roles during the processing of SQL statements. The authorization ID must be a valid role name, enclosed in double quotes. authid is not case-sensitive. SQL:1999 specifies two special authorization IDs: PUBLIC and SYSTEM.
ROLLBACK WORK Statement • “Considerations for ROLLBACK WORK” • “Examples of ROLLBACK WORK” The ROLLBACK WORK statement undoes all database modifications to objects made during the current transaction, releases all locks on objects held by the transaction, and ends the transaction.
SELECT Statement • “Syntax Description of SELECT” • “Considerations for SELECT” • “Considerations for Select List” • “Considerations for SEQUENCE BY” • “Considerations for GROUP BY” • “Considerations for ORDER BY” • “Considerations for UNION” • “Examples of SELECT” SELECT Statement...
Page 142
The SELECT statement is a DML statement that retrieves values from tables, views, derived tables determined by the evaluation of query expressions, or joined tables. size-and-index is: SELECT [col-expr] [[ANY N] | [FIRST N]] [ALL | DISTINCT] select-list FROM table-ref [,table-ref]... [WHERE search-condition] [SAMPLE sampling-method] [TRANSPOSE transpose-set [transpose-set]...
THEN percent-result PERCENT [ROWS] [WHEN condition THEN percent-result PERCENT [ROWS]]... [ELSE percent-result PERCENT [ROWS]] END rows-size is: number-rows ROWS | BALANCE WHEN condition THEN number-rows ROWS [WHEN condition THEN number-rows ROWS]... [ELSE number-rows ROWS] END transpose-set is: transpose-item-list AS transpose-col-list transpose-item-list is: expression-list | (expression-list) [,(expression-list)]...
Page 145
Neoview SQL returns the columns you specify in select-list. To refer to a table or view, use the ANSI logical name.
Page 146
[OLD.]* specifies the row from the old table exposed by the embedded delete. The old table refers to column values before the delete operation. NEW is not allowed. An implicit OLD.* return list is assumed for a delete operation that does not specify a return list.
Page 147
RIGHT, and FULL keywords. If you omit the optional OUTER keyword and use LEFT, RIGHT, or FULL in a join, Neoview SQL assumes the join is an outer join. If you specify a CROSS join as the join-type, you cannot specify a NATURAL join or a join-spec.
Page 148
FIRST rows-size [SORT BY colname [,colname]...] directs Neoview SQL to choose the first rows-size rows from the sorted result table. The sampling size is determined by using the specified number of rows.
Page 149
CUSTOMER.CITY. ASC | DESC specifies the sort order. The default is ASC. When Neoview SQL orders an intermediate result table on a column that can contain null, nulls are considered equal to one another but greater than all other nonnull values.
Page 150
GROUP BY clause in the SELECT statement. The GROUP BY clause, if one exists, must precede the HAVING clause in the SELECT statement. To comply with ANSI standards, Neoview SQL does not move aggregate predicates from the WHERE clause to a HAVING clause and does not move non-aggregate predicates from the HAVING clause to the WHERE clause.
ORDER BY {colname | colnum} [ASC[ENDING] | DESC[ENDING]] [,{colname | colnum} [ASC[ENDING] | DESC[ENDING]]]... specifies the order in which to sort the rows of the final result table. colname names a column in select-list or a column in a table reference in the FROM clause of the SELECT statement.
Join Limits NOTE: HP recommends that you limit the number of tables in a join to a maximum of 64, which includes base tables of views referenced in joins. Queries with joins that involve a larger number of tables are not guaranteed to compile.
Limitations of DISTINCT Aggregates • There is no limit to the number of distinct aggregates. • Distinct STDDEV and distinct VARIANCE are not supported with multiple distinct aggregates. For example, this statement will result in an error. SELECT sum(distinct a), stddev(distinct b) from T group by d; Examples of Multiple Distinct Aggregates •...
• You can specify GROUP BY using ordinals to refer to the relative position within the SELECT list. For example, GROUP BY 3, 2, 1. • If you do not include a GROUP BY clause but you specify an aggregate function in the select-list, all rows of the result table form the one and only group.
(The year-month fields are YEAR and MONTH. The day-time fields are DAY, HOUR, MINUTE, and SECOND.) For example, suppose that the column in TABLE1 has the data type INTERVAL HOUR TO MINUTE, and the column in TABLE2 has the data type INTERVAL DAY TO HOUR. The data type of the column resulting from the union operation is INTERVAL DAY TO MINUTE.
Use a table subquery to enclose the union, and apply the access mode to the main query. This statement receives a warning because Neoview SQL treats the access mode on the second SELECT as applicable only to that second SELECT:...
Page 157
1500 JIMMY SCHNEIDER 26000.00 2500 MIRIAM KING 18000.00 1000 CRAMER 19000.00 . . . In this example, because of READ UNCOMMITTED access, the query does not wait for other concurrent processes to commit rows. • Display selected rows grouped by job code in ascending order: SELECT jobcode, AVG(salary) FROM persnl.employee WHERE jobcode >...
Page 159
SECRETARY JOHN CHOU 28000.00 • Select from three tables, group the rows by job code and (within job code) by department number, and order the groups by the maximum salary of each group: SELECT E.jobcode, E.deptnum, MIN (salary), MAX (salary) FROM persnl.employee E, persnl.dept D, persnl.job J WHERE E.deptnum = D.deptnum AND E.jobcode = J.jobcode...
Page 160
JOBCODE JOBDESC ------- ------------------ MANAGER PRODUCTION SUPV ASSEMBLER SALESREP SYSTEM ANALYST ENGINEER PROGRAMMER ACCOUNTANT ADMINISTRATOR SECRETARY CORP MANAGER CORP SALESREP CORP SYSTEM ANALYS CORP ACCOUNTANT CORP ADMINISTRATOR CORP SECRETARY --- 16 row(s) selected. • A FULL OUTER JOIN combines the results of both left and right outer joins. These joins show records from both tables and fill in NULLs for missing matches on either side: SELECT * FROM employee...
(SELECT O.ordernum FROM sales.orders O WHERE custnum IN (SELECT custnum FROM sales.customer WHERE state = 'CALIFORNIA')) GROUP BY OD.ordernum; ORDERNUM (EXPR) ---------- --------------------- 200490 1030.00 300350 71025.00 300380 28560.00 --- 3 row(s) selected. The price for the total quantity ordered is computed for each order number. •...
Page 162
from ( insert into identity_table values (DEFAULT,100,100), (DEFAULT,200,200) --------------- ------ ------ 216944652091640 216944652091641 • INSERT...SELECT statements are supported with embedded INSERT statements: insert into another_table values (300,300,300), (400,400,400), (500,500,500); select P.a, P.b, P.c from ( insert into identity_table select * from another_table where y < 500 ) as P where P.a = 300;...
SET SCHEMA Statement • “Syntax Description of SET SCHEMA” • “Consideration for SET SCHEMA” • “Examples of SET SCHEMA” The SET SCHEMA statement sets the default logical schema for unqualified object names for the current SQL session. SET SCHEMA default-schema-name Syntax Description of SET SCHEMA default-schema-name specifies the name of the schema.
Neoview SQL not to time out. A value of zero (0) directs Neoview SQL not to wait. If a table lock cannot be acquired or if a stream is empty, Neoview SQL immediately times out.
NOTE: Because of overhead processing by Neoview SQL after a timeout occurs on a locked table, the actual time is usually a few seconds longer than value. RESET removes the dynamic timeout value (if set) for the specified table, resetting the timeout value to the static values set during explicit Neoview SQL compilations.
SET TRANSACTION Statement • “Syntax Description of SET TRANSACTION” • “Considerations for SET TRANSACTION” • “Example of SET TRANSACTION” The SET TRANSACTION statement sets attributes for transactions. It stays in effect until the end of the session or until the next SET TRANSACTION statement, whichever comes first. Therefore, the SET TRANSACTION statement can set the attributes of all subsequent transactions in the session.
This option applies to any statement for which the system initiates a transaction. If this option is set to ON, Neoview SQL automatically commits any changes or rolls back any changes made to the database at the end of statement execution. AUTOCOMMIT is on by default at the start of a session.
The exceptions (statements that are not transaction initiating) are: • COMMIT, FETCH, ROLLBACK, and SET TRANSACTION • DML statements executing under READ UNCOMMITTED access • EXECUTE or EXECUTE IMMEDIATE, which are transaction initiating only if the associated statement is transaction-initiating Explicit Transactions You can issue an explicit BEGIN WORK even if the autocommit option is on.
UPDATE Statement • “Syntax Description of UPDATE” • “Considerations for UPDATE” • “Examples of UPDATE” The UPDATE statement is a DML statement that updates data in a row or rows in a table or updatable view. Updating rows in a view updates the rows in the table on which the view is based.
Page 170
A scalar subquery in expression cannot refer to the table being updated. If expression refers to columns being updated, Neoview SQL uses the original values to evaluate the expression and determine the new value.
ROLLBACK is encountered or an error occurs. Isolation Levels of Transactions and Access Options of Statements The isolation level of a Neoview SQL transaction defines the degree to which the operations on data within that transaction are affected by operations of concurrent transactions. When you specify access options for the DML statements within a transaction, you override the isolation level of the containing transaction.
When an UPDATE completes successfully, Neoview SQL reports the number of times rows were updated during the operation. Under certain conditions, updating a table with indexes can cause Neoview SQL to update the same row more than once, causing the number of reported updates to be higher than the actual number of changed rows.
• More than one subquery is not allowed if multiple-column syntax is used. UPDATE t SET (a,b)=(SELECT x,y FROM z), (c,d)=(SELECT x,y FROM a)) • If a subquery is used, it must return at most one row. SET ON ROLLBACK Considerations The SET ON ROLLBACK expression is evaluated when each row is processed during execution of the UPDATE statement.
Page 174
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; --- SQL operation complete. BEGIN WORK; --- SQL operation complete. DELETE FROM persnl.employee WHERE empnum = 23; --- 1 row(s) deleted. INSERT INTO persnl.employee (empnum, first_name, last_name, deptnum, salary) SQL Statements...
You must use the ON clause to generate statistics stored in histogram tables. If you omit it, physical statistics are generated for Neoview SQL tables, and SQL returns a warning message. See “Using Statistics”...
Page 176
column-list | EVERY COLUMN [, column-list] | EVERY KEY [, column-list] | EXISTING COLUMN[S] [, column-list] specifies the ways in which column-group-list can be defined. The column list represents both a single-column group and a multi-column group. Single-column group: column-name | (column-name) | column-name TO column-name | (column-name) TO (column-name) are the ways you can specify individual columns or a group of individual columns.
The value c must be an integer that is greater than or equal to zero (c > 0). If the ROWCOUNT clause in not specified, Neoview SQL determines the number of rows in the table either by estimation or SELECT COUNT(*).
--- SQL operation complete. • This example generates histogram statistics using the ON EVERY COLUMN option for the table DEPT. This statement performs a full scan, and Neoview SQL determines the default number of intervals. UPDATE STATISTICS FOR TABLE dept ON EVERY COLUMN;...
Page 179
--- SQL operation complete. • Suppose that a construction company has an ADDRESS table of potential sites and a DEMOLITION_SITES table that contains some of the columns of the ADDRESS table. The primary key is ZIP. Join these two tables on two of the columns in common: SELECT COUNT(AD.number), AD.street, AD.city, AD.zip, AD.state FROM address AD, demolition_sites DS...
3 SQL Utilities A utility is a tool that runs within Neoview SQL and performs such tasks as maintenance, loading indexes, purging data from tables, indexes, and reorganizing and reloading data in a table or index. This section describes the Neoview SQL utilities: “MAINTAIN Command”...
MAINTAIN Command • “Syntax Description of MAINTAIN” • “Examples of MAINTAIN” The MAINTAIN command performs one or more table maintenance tasks, such as REORG, UPDATE STATISTICS, and REFRESH, on a specified database object. The MAINTAIN command provides support: • For users to specify one or more maintenance tasks for a specific object. •...
Page 183
REORG MVS reorganizes all materialized views on the specified table. task options optional string containing options specific to the individual tasks that would be passed on to that particular command at run time. CONTINUE ON ERROR If any of the maintain tasks return an error, that error is returned and execution continues to the next task.
The REFRESH utility can be applied to both incremental MVs and recomputed MVs. The REFRESH utility optimizes the refresh of MVGROUP. HP recommends that you gather all the MVs to refresh at a specific time into one group and refresh them together.
Page 185
maintain table t1_090, all, display detail; • Disables all tasks that are allowed to be disabled (reorg table, index, update statistics): maintain table t1_090, all, disable; The status will show up as Disabled for the tasks that were disabled by the previous command.
• “Examples of POPULATE INDEX” POPULATE INDEX is a syntax-based utility that can be executed in the Neoview Script interface. The POPULATE INDEX utility loads Neoview SQL indexes. POPULATE INDEX index ON table [index-option] index-option is ONLINE | OFFLINE Syntax Description of POPULATE INDEX index is an SQL identifier that specifies the simple name for the index.
• “Considerations for PURGEDATA” • “Examples of PURGEDATA” The PURGEDATA utility deletes all data from a Neoview SQL table and its related indexes. PURGEDATA table [IGNORE_TRIGGER] [NOLOG] Syntax Description of PURGEDATA table is the name of the table from which to purge the data. See “Database Object Names”...
4 SQL Language Elements Neoview SQL language elements, which include data types, expressions, functions, identifiers, literals, and predicates, occur within the syntax of SQL statements. The statement and command topics support the syntactical and semantic descriptions of the language elements in this section.
UTF16 big-endian encoding. All Basic Multilingual Plan (BMP) characters are included. Surrogate characters are treated as two double-byte characters. Neoview SQL supports the Unicode 2.1 standard. This means that you get all the European languages, as well as Hebrew, Arabic, and Cyrillic (Russian) encodings. The detailed language...
Columns A column is a vertical component of a table and is the relational representation of a field in a record. A column contains one data value for each row of the table. A column value is the smallest unit of data that can be selected from or updated in a table. Each column has a name that is an SQL identifier and is unique within the table or view that contains the column.
Page 192
SELECT AVG (salary) AS "AVERAGE SALARY" FROM persnl.employee; "AVERAGE SALARY" ---------------- 49441.52 --- 1 row(s) selected. SQL Language Elements...
Correlation Names A correlation name is a name you can associate with a table reference that is a table, view, or subquery in a SELECT statement to: • Distinguish a table or view from another table or view referred to in a statement •...
“Views” Ownership In Neoview SQL, the creator of a schema owns all the objects defined in the schema. In addition, you can use the GRANT and REVOKE statements to grant access privileges for a table or view to specified users.
“Logical Names for SQL Objects” • “SQL Object Namespaces” DML statements can refer to Neoview SQL database objects. To refer to a database object in a statement, use an appropriate database object name. For information on the types of database objects see “Database Objects”...
Data Types Neoview SQL data types are character, datetime, interval, or numeric (exact or approximate): “Character String Data Types” (page 200) Fixed-length and variable-length character data types. “Examples of SET TABLE TIMEOUT” (page 165) DATE, TIME, and TIMESTAMP data types.
Page 198
Type SQL Designation Description Size or Range (1) DOUBLE PRECISION Floating-point numbers (64 +/- 2.2250738585072014e-308 bits) with 1 through 52 bits through of precision (52 bits of binary +/-1.7976931348623157e+308; stored precision and 11 bits of in 8 byte exponent) Decimal number DECIMAL (1,scale) to Decimal number with 1 to 18 digits.
Compatible data types are also comparable. Assignment and comparison are the basic operations of Neoview SQL. Assignment operations are performed during the execution of INSERT and UPDATE statements. Comparison operations are performed during the execution of statements that include predicates, aggregate (or set) functions, and GROUP BY, HAVING, and ORDER BY clauses.
Character String Data Types • “Considerations for Character String Data Types” Neoview SQL includes both fixed-length character data and variable-length character data. You cannot compare character data to numeric, datetime, or interval data. character-type is: CHAR[ACTER] [(length [CHARACTERS])] [char-set]...
Character Sets For Neoview SQL, a character data type can be associated only with the DEFAULT collation. You set the default NCHAR data type and you can select from the ISO88591 or UCS2. If you do not make a selection, the default is UCS2.
“CAST Expression” (page 298). Neoview SQL accepts dates, such as October 5 to 14, 1582, that were omitted from the Gregorian calendar. This functionality is a Neoview SQL extension. The range of times that a datetime value can represent is: January 1, 1 A.D., 00:00:00.000000 (low value) December 31, 9999, 23:59:59.999999 (high value)
Page 203
Second, from 00 to 59 Microsecond, from 000000 to 999999 msssss When you specify datetime_value (FORMAT ‘string’) and the specified format is ‘mm/dd/yyyy’,’MM/DD/YYYY’, or ‘yyyy/mm/dd’ or ‘yyyy-mm-dd’, the datetime type is automatically cast. If the TITLE clause is present, it is ignored. Data Types...
Interval Data Types Values of interval data type represent durations of time in year-month units (years and months) or in day-time units (days, hours, minutes, seconds, and fractions of a second). interval-type is: INTERVAL { start-field TO end-field | single-field } start-field is: {YEAR | MONTH | DAY | HOUR | MINUTE} [(leading-precision)] end-field is:...
Approximate numeric data types are types that do not necessarily represent a value exactly: FLOAT, REAL, and DOUBLE PRECISION. A column in a Neoview SQL table declared with a floating-point data type is stored in IEEE floating-point format and all computations on it are done assuming that. Neoview SQL tables can contain only IEEE floating-point data.
Page 206
SMALLINT [SIGNED|UNSIGNED] specifies an exact numeric column—a two-byte binary integer, SIGNED or UNSIGNED. The column stores integers in the range unsigned 0 to 65535 or signed -32768 to +32767. The default is SIGNED. INT[EGER] [SIGNED|UNSIGNED] specifies an exact numeric column—a four-byte binary integer, SIGNED or UNSIGNED. The column stores integers in the range unsigned 0 to 4294967295 or signed -2147483648 to +2147483647.
Page 207
An IEEE DOUBLE PRECISION data type is stored in 8 bytes with 52 bits of binary precision and 11 bits of exponent. The minimum and maximum range is from +/- 2.2250738585072014e-308 through +/-1.7976931348623157e+308. Numeric Data Types...
Expressions An SQL value expression, referred to as an expression, can evaluate to a value with one of these “Character Value Expressions” (page 208) Operands can be combined with the concatenation operator (||). Example: 'HOUSTON,' ||' TEXAS' “Datetime Value Expressions” (page 210) Operands can be combined in specific ways with arithmetic operators.
Page 209
The concatenation of two string literals. 'ABILENE ' ||' TEXAS' The concatenation of three string literals to form the literal: 'ABILENE ' ||' TEXAS' || x’55 53 41 'ABILENE TEXAS USA' The concatenation of a string literal with the value in 'Customer ' || custname column CUSTNAME.
Datetime Value Expressions • “Considerations for Datetime Value Expressions” • “Examples of Datetime Value Expressions” The operands of a datetime value expression can be combined in specific ways with arithmetic operators. In this syntax diagram, the data type of a datetime primary is DATE, TIME, or TIMESTAMP. The data type of an interval term is INTERVAL.
Considerations for Datetime Value Expressions Data Type of Result In general, the data type of the result is the data type of the datetime-primary part of the datetime expression. For example, datetime value expressions include: The sum of the current date and an interval value of one CURRENT_DATE + INTERVAL '1' DAY day.
Page 212
(EXPR) ---------- 1996-03-12 --- 1 row(s) selected. The result of adding 20 days to 1996-02-21 is 1996-03-12. Neoview SQL correctly handles 1996 as a leap year. • Subtract an interval value qualified by HOUR TO MINUTE from a datetime value: SELECT ship_timestamp - INTERVAL '15:30' HOUR TO MINUTE FROM persnl.project...
Interval Value Expressions • “Considerations for Interval Value Expressions” • “Examples of Interval Value Expressions” The operands of an interval value expression can be combined in specific ways with addition and subtraction operators. In this syntax diagram, the data type of a datetime expression is DATE, TIME, or TIMESTAMP;...
Considerations for Interval Value Expressions Start and End Fields Within the definition of an interval range, the start-field and end-field can be any of the specified fields with these restrictions: • An interval is either year-month or day-time. If the start-field is YEAR, the end-field is MONTH;...
INTERVAL '1' MONTH + INTERVAL '7' DAY • If you multiply or divide an interval value by a numeric value expression, Neoview SQL converts the interval value to its least significant subfield and then multiplies or divides it by the numeric value expression. The result has the same fields as the interval that was multiplied or divided.
Page 216
4000 1996-09-21 1996-10-21:10:15:00.0000 5000 1996-09-28 1996-10-28:09:25:01.1111 • Suppose that the CURRENT_TIMESTAMP is 2000-01-06 11:14:41.748703. Find the number of days, hours, minutes, seconds, and fractional seconds in the difference of the current timestamp and the SHIP_TIMESTAMP in the PROJECT table: SELECT projcode, (CURRENT_TIMESTAMP - ship_timestamp) DAY(4) TO SECOND(6) FROM samdbcat.persnl.project;...
Numeric Value Expressions • “Considerations for Numeric Value Expressions” • “Examples of Numeric Value Expressions” The operands of a numeric value expression can be combined in specific ways with arithmetic operators. In this syntax diagram, the data type of a term, factor, or numeric primary is numeric numeric-expression is: numeric-term | numeric-expression + numeric-term...
Page 218
Neoview SQL cannot convert an HP REAL or a FLOAT data type with precision between 1 and 22 bits to IEEE REAL, because the HP exponent will not fit in an IEEE REAL data type. The precision of an HP data type will be maintained correctly.
Examples of Numeric Value Expressions These are examples of numeric value expressions: Numeric literal. The product of the values in the SALARY column and a salary * 1.10 numeric literal. The product of the values in the UNIT_PRICE and unit_price * qty_ordered QTY_ORDERED columns.
Lisa"""). Unlike regular identifiers, delimited identifiers are case-sensitive. Spaces within a delimited identifier are significant except for trailing spaces, which Neoview SQL truncates. You can use reserved words as delimited identifiers. These forms of delimited identifiers are not supported. Results are unpredictable for delimited identifiers that: •...
An index is an ordered set of pointers to rows of a table. Each index is based on the values in one or more columns. There is always a one-to-one correspondence between index rows and base table rows. SQL Indexes Each row in a Neoview SQL index contains: • The columns specified in the CREATE INDEX statement •...
“Literals” Clustering Keys Neoview SQL organizes records of a table or index by using a b-tree based on the “clustering key”. Values of the clustering key act as logical row-ids. The primary key is the clustering key and it must be unique.
[_character-set | N]'string' _character-set specifies the character set ISO88591 and UCS2. If you omit the character set specification, the default is whatever character set default you set when you installed Neoview SQL. See “Character Sets” (page 190). associates the system default character set with the string literal. The default is set by the value of the NATIONAL_CHARSET attribute during the Neoview SQL installation.
• Do not put a space between the character set qualifier and the character string literal. If you use this character string literal in a statement, Neoview SQL returns an error. • To specify a single quotation mark within a string literal, use two consecutive single quotation marks.
Datetime Literals • “Examples of Datetime Literals” A datetime literal is a DATE, TIME, or TIMESTAMP constant you can use in an expression, in a statement, or as a parameter value. Datetime literals have the same range of valid values as the corresponding datetime data types.
Interval Literals • “Considerations for Interval Literals” • “Examples of Interval Literals” An interval literal is a constant of data type INTERVAL that represents a positive or negative duration of time as a year-month or day-time interval; it begins with the keyword INTERVAL optionally preceded or followed by a minus sign (for negative duration).
'year-month' | 'day:time' specifies the date and time components of an interval literal. The day and hour fields can be separated by a space or a colon. The interval literal strings are: Unsigned integer that specifies a number of years. years years can be up to 18 digits, or 16 digits if months is the end-field.
Examples of Interval Literals Interval of 1 month INTERVAL '1' MONTH Interval of 7 days INTERVAL '7' DAY Interval of 2 years, 7 months INTERVAL '2-7' YEAR TO MONTH Interval of 5 days, 2 hours, 15 minutes, and 36.33 seconds INTERVAL '5:2:15:36.33' DAY TO SECOND(2) Interval that subtracts 5 days INTERVAL - '5' DAY...
Examples of Numeric Literals • These are all numeric literals, along with their display format: Literal Display Format 580.45 580.45 +005 -.3175 -.3175 1300000000 1300000000 -0.123456789012345678 -.123456789012345678 99E-2 9.9000000E-001 12.3e+5 1.2299999E+006 Literals...
Null is the default for a column (other than NOT NULL) unless the column definition includes a DEFAULT clause (other than DEFAULT NULL) or the NO DEFAULT clause. The default value for a column is the value Neoview SQL inserts in a row when an INSERT statement omits a value for a particular column.
Null and Expression Evaluation Comparison Expression Type Condition Result Boolean operators (AND, OR, NOT) Either operand is null. For AND, the result is null. For OR, the result is true if the other operand is true, or null if the other operand is null or false.
Users may also specify the MAX TABLE SIZE clause that will be used to decide on the table extent sizes. If this option is not specified Neoview SQL will decide. If the table is partitioned then the table is partitioned across all the disk volumes on the system.
Predicates A predicate determines an answer to a question about a value or group of values. A predicate returns true, false, or, if the question cannot be answered, unknown. Use predicates within search conditions to choose rows from tables or views. “BETWEEN Predicate”...
Considerations for BETWEEN Logical Equivalents Using AND and OR The predicate expr1 BETWEEN expr2 AND expr3 is true if and only if this condition is true: expr2 <= expr1 AND expr1 <= expr3 The predicate expr1 NOT BETWEEN expr2 AND expr3 is true if and only if this condition is true: expr2 >...
Predicate X<>Y is true if X=Y is false. If X1<>Y1, Neoview SQL does not look at all components. It stops and returns a value of false for the X=Y predicate and a value of true for the X<>Y predicate.
X=Y. Predicate X<=Y is true if X<Y is true or X=Y is true. In this scenario, Neoview SQL might need to look through all components and return true if they are all equal. It stops at the first nonequal components, Xm<>Ym.
Page 237
Suppose that JOB1_TIME, defined as INTERVAL DAY TO MINUTE, is 2 days 3 hours, and JOB2_TIME, defined as INTERVAL DAY TO HOUR, is 3 days. To evaluate the predicate, Neoview SQL converts the two INTERVAL values to MINUTE. The comparison predicate is true.
--- 35 row(s) selected. The first subquery of this query determines the minimum salary of employees from other departments whose salary is greater than the average salary for department 1500. The main query then finds the names of employees who are not in department 1500 and whose salary is less than the minimum salary determined by the first subquery.
WHERE EXISTS (SELECT partnum FROM invent.partloc PL WHERE PS.partnum = PL.partnum AND qty_on_hand < 20); PARTNUM SUPPNUM ------- ------- 2001 2003 --- 18 row(s) selected. IN Predicate • “Considerations for IN” • “Examples of IN” The IN predicate determines if a sequence of values is equal to any of the sequences of values in a list of sequences.
Both fixed-length and varying-length strings are padded in this way. For example, Neoview SQL considers the string ‘JOE’ equal to a value JOE stored in a column of data type CHAR or VARCHAR of width three or more. Similarly, Neoview SQL considers a value JOE stored in any column of the CHAR data type equal to the value JOE stored in any column of the VARCHAR data type.
------- ------------------ 186 MegaByte Disk --- 1 row(s) selected. • Find those items (and their suppliers) in PARTS that have a supplier in the PARTSUPP table: SELECT P.partnum, P.partdesc, S.suppnum, S.suppname FROM sales.parts P, invent.supplier S WHERE P.partnum, S.suppnum IN (SELECT partnum, suppnum FROM invent.partsupp);...
Note that the rvc IS NOT NULL predicate is not equivalent to NOT rvc IS NULL. Examples of NULL • Find all rows with null in the SALARY column: salary IS NULL • This predicate evaluates to true if the expression (PRICE + TAX) evaluates to null: (price + tax) IS NULL •...
table-subquery provides the values for the comparison. The number of values returned by the row-value-constructor must be equal to the number of values specified by the table-subquery, and the data types of values returned by the row-value-constructor must be comparable to the data types of values returned by the table-subquery. See “Subquery”...
Page 244
EMPNUM FIRST_NAME LAST_NAME SALARY ------ --------------- -------------------- ----------- ROGER GREEN 175500.00 JERRY HOWARD 137000.10 JANE RAYMOND 136000.00 ALAN TERRY 39500.00 HENDERSON 65000.00 JESSICA CRINER 39500.00 --- 23 row(s) selected. • This predicate is true if the part number is equal to any part number with more than five units in stock: partnum = ANY (SELECT partnum FROM sales.odetail...
Privileges These privileges are used by the GRANT and REVOKE statements. For further information on GRANT, see “GRANT Statement” (page 115), “GRANT EXECUTE Statement” (page 117), or “GRANT SCHEMA Statement” (page 119). For further information on REVOKE, see “REVOKE Statement” (page 134), “REVOKE EXECUTE Statement”...
General Rules for column-list Names the columns to which the SELECT, UPDATE, or REFERENCES privileges apply. If you specify SELECT, UPDATE or REFERENCES without column names, the privileges apply to all columns of the table or view (regular or materialized). SQL Language Elements...
The logical name of the form schema.object is an ANSI name. The part schema denotes the ANSI-defined schema. To be compliant with ANSI SQL:1999, Neoview SQL provides support for ANSI object names. By using these names, you can develop ANSI-compliant applications that access all SQL objects.
Search Condition A search condition is used to choose rows from tables or views, depending on the result of applying the condition to rows. The condition is a Boolean expression consisting of predicates combined together with OR, AND, and NOT operators. You can use a search condition in the WHERE clause of a SELECT, DELETE, or UPDATE statement, the HAVING clause of a SELECT statement, the NOT CASESPECIFIC clause of a SELECT statement, the searched form of a CASE expression, the ON clause of a SELECT statement...
Examples of Search Condition • Select rows by using a search condition composed of three comparison predicates joined by AND operators: select O.ordernum, O.deliv_date, OD.qty_ordered FROM sales.orders O, sales.odetail OD WHERE qty_ordered < 9 AND deliv_date <= DATE '1998-11-01' AND O.ordernum = OD.ordernum; ORDERNUM DELIV_DATE QTY_ORDERED...
Subquery A subquery is a query expression enclosed in parentheses. Its syntactic form is specified in the syntax of a SELECT statement. For further information about query expressions, see “SELECT Statement” (page 141). A subquery is used to provide values for a BETWEEN, comparison, EXISTS, IN, or quantified comparison predicate in a search condition.
Correlated Subqueries When Providing Comparison Values In the search condition of a subquery, when you refer to columns of any table or view defined in an outer query, the reference is called an outer reference. A subquery containing an outer reference is called a correlated subquery.
(for example, the storage order of rows within the table) A Neoview SQL table is described in an SQL schema and stored in a physical file in the environment. An SQL table name can be a fully qualified ANSI name of the form schema-name.object-name.
Triggers A trigger is a mechanism that resides in the database and specifies that when a particular action—an insert, delete, or update—occurs on a particular table, Neoview SQL should automatically perform one or more additional actions. For a complete description of triggers and their use, see “Considerations for CREATE TRIGGER”...
Views A view provides an alternate way of looking at data in one or more tables. A view is a named specification of a result table, which is a set of rows selected or generated from one or more base tables or other views.
Page 255
Although MVGROUPs are automatically created, if you decide to group together materialized views that share the same refresh frequency rate, you will need to manually create them. Views...
5 SQL Clauses Clauses are used by Neoview SQL statements to specify default values, ways to sample or sort data, how to store physical data, and other details. This section describes: • “DEFAULT Clause”. Specifies a default value for a column being created.
DEFAULT Clause “Examples of DEFAULT” The DEFAULT option of the CREATE TABLE or ALTER TABLE table-name ADD COLUMN statement specifies a default value for a column being created. The default value is used when a row is inserted in the table without a value for the column. DEFAULT default | NO DEFAULT | identity-column- specification default is:...
N. The number of rows picked follows a binomial distribution with mean equal to r * N/100. If you specify a sample size greater than 100 PERCENT, Neoview SQL returns all the rows in the result table plus duplicate rows. The duplicate rows are picked from the result table according to the specified sampling method.
FIRST rows-size [SORT BY colname [ASC[ENDING] | DESC[ENDING]] [,colname [ASC[ENDING] | DESC[ENDING]]]...] directs Neoview SQL to choose the first rows from the result table. You can specify the order of the rows to sample. Otherwise, Neoview SQL chooses an arbitrary order. The sampling...
stored. The number of blocks in a cluster is specified in the CLUSTERS subclause of the SAMPLE RANDOM clause. For example: SELECT * FROM customers SAMPLE RANDOM 1 PERCENT CLUSTERS OF 2 BLOCKS; This query randomly selects one percent of the clusters in the CUSTOMERS table and then adds each row in all selected clusters to the result table.
Page 263
--- 50 row(s) selected. • Return the SALARY of 50 sales people. In this case, the table is clustered on EMPID. If the optimizer chooses a plan to access rows using the primary access path, the result consists of salaries of the 50 sales people with the smallest employee identifiers. SELECT salary FROM salesperson SAMPLE FIRST 50 ROWS;...
Page 264
SELECT AVG(salary) FROM salesperson SAMPLE RANDOM 10 PERCENT CLUSTERS OF 4 BLOCKS; (EXPR) --------------------- 50219.524 --- 1 row(s) selected. For this query execution, the number of rows returned is limited by the total number of rows in the SALESPERSON table. Therefore, it is possible that no rows are returned, and the result is null.
Page 265
--- 1 row(s) selected. Note that the results of this query and some of the results of previous queries might return null: SELECT AVG(salary) FROM ( SELECT salary, dnum FROM salesperson SAMPLE RANDOM 10 PERCENT ) AS S, department D WHERE S.DNUM = D.DNUM AND D.NAME = 'CORPORATE';...
Page 266
• The BALANCE option enables stratified sampling. Retrieve the age and salary of 1000 sales people such that 50 percent of the result are male and 50 percent female. SELECT age, sex, salary FROM salesperson SAMPLE FIRST BALANCE WHEN sex = 'male' THEN 15 ROWS WHEN sex = 'female' THEN 15 ROWS ORDER BY age;...
You must include a SEQUENCE BY clause if you include a sequence function in the select list of the SELECT statement. Otherwise, Neoview SQL returns an error. Further, you cannot include a SEQUENCE BY clause if there is no sequence function in the select list. See “Sequence Functions”...
AS tab2 (ordernum, avg_price) SEQUENCE BY ordernum; • Like aggregate functions, sequence functions generate an intermediate result. If the query has a WHERE clause, its search condition is applied during the generation of the intermediate result. Therefore, you cannot use sequence functions in the WHERE clause of a SELECT statement.
Page 270
FROM orders o, odetail d WHERE o.ordernum=d.ordernum SEQUENCE BY o.order_date, o.ordernum, d.partnum ORDER BY o.order_date, o.ordernum, d.partnum; Order/Num MCOUNT Part/Num Order/Date AMOUNT ORDER_TOTAL TOTAL_SALES ---------- ----------- -------- ---------- ---------- -------------- -------------- 100250 1997-01-23 14000.00 14000.00 14000.00 100250 5103 1997-01-23 4000.00 18000.00 18000.00 100250...
The result table of the TRANSPOSE clause has all the columns of the source table plus, for each transpose item list, a value column or columns and an optional key column. TRANSPOSE is a Neoview SQL extension. TRANSPOSE transpose-set [transpose-set]... [KEY BY key-colname]...
transpose-col-list specifies the columns that consist of the evaluation of expressions in the item list as the expressions are applied to rows of the source table. colname is an SQL identifier that specifies a column name. It identifies the column consisting of the values in expression-list.
Cardinality of the TRANSPOSE Result The items in each transpose-item-list are enumerated from 1 to N, where N is the total number of items in all the item lists in the transpose sets. In this example with a single transpose set, the value of N is 3: TRANSPOSE (A,X),(B,Y),(C,Z) AS (V1,V2) In this example with two transpose sets, the value of N is 5: TRANSPOSE (A,X),(B,Y),(C,Z) AS (V1,V2)
Page 274
The result table of the TRANSPOSE query is: KEYCOL VALCOL • This query shows that the items in the transpose item list can be any valid scalar expressions: SELECT KEYCOL, VALCOL, A, B, C FROM mytable TRANSPOSE A + B, C + 3, 6 AS VALCOL KEY BY KEYCOL;...
Page 275
(EXPR) -------------------- --- 3 row(s) selected. • This query shows how multiple TRANSPOSE clauses can be used in the same query. The result table from this query has nine times as many rows as there are rows in MYTABLE: SELECT KEYCOL1, VALCOL1, KEYCOL2, VALCOL2 FROM mytable TRANSPOSE A, B, C AS VALCOL1 KEY BY KEYCOL1 TRANSPOSE D, E, F AS VALCOL2...
Page 276
The result table of the TRANSPOSE query is: KEYCOL VALCOL1 VALCOL2 A question mark (?) in a value column indicates no value for the given KEYCOL. • This query shows how the preceding query can include a GROUP BY clause: SELECT KEYCOL, VALCOL1, VALCOL2, COUNT(*) FROM mytable TRANSPOSE A, B, C AS VALCOL1 D, E, F AS VALCOL2...
Page 277
The result table of the TRANSPOSE query is: VALCOL1 VALCOL2 VALCOL3 TRANSPOSE Clause...
6 SQL Functions and Expressions This section describes the syntax and semantics of specific functions and expressions that you can use in Neoview SQL statements. The functions and expressions are categorized according to their functionality. Categories Use these types of functions within an SQL value expression: •...
include a GROUP BY clause but you specify an aggregate function in the select list, all rows of the SELECT result table form the one and only group. See the individual entry for the function. Character String Functions These functions manipulate character strings. These functions use a character value expression as an argument or return a result of character data type: “ASCII Function”...
“TRIM Function” (page 418) Removes leading or trailing characters from a character string. “UCASE Function” (page 419) Upshifts single-byte characters. You can also use UPSHIFT or UPPER. “UPPER Function” (page 427) Upshifts single-byte characters. You can also use UPSHIFT or UCASE. “UPSHIFT Function”...
“DAYOFYEAR Function” (page 329) Returns an integer value in the range 1 through 366 that represents the corresponding day of the year. “EXTRACT Function” (page 342) Returns a specified datetime field from a datetime value expression or an interval value expression. “HOUR Function”...
“LOG10 Function” (page 353) Returns the base 10 logarithm of a numeric value expression. “MOD Function” (page 364) Returns the remainder (modulus) of an integer value expression divided by an integer value expression. “NULLIFZERO Function” (page 378) Returns the value of the operand unless it is zero, in which case it returns NULL.
Page 284
“MOVINGCOUNT Function” (page 368) Returns the number of nonnull values of a column expression in the current window. “MOVINGMAX Function” (page 370) Returns the maximum of nonnull values of a column expression in the current window. “MOVINGMIN Function” (page 371) Returns the minimum of nonnull values of a column expression in the current window.
Other Functions and Expressions Use these other functions and expressions in an SQL value expression: “CASE (Conditional) Expression” (page 295) A conditional expression. The two forms of the CASE expression are simple and searched. “CAST Expression” (page 298) Converts a value from one data type to another data type that you specify.
ABS Function The ABS function returns the absolute value of a numeric value expression. ABS is a Neoview SQL extension. ABS (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the ABS function. The result is returned as an unsigned numeric value if the precision of the argument is less than 10 or as a LARGEINT if the precision of the argument is greater than or equal to 10.
ACOS Function The ACOS function returns the arccosine of a numeric value expression as an angle expressed in radians. ACOS is a Neoview SQL extension. ACOS (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the ACOS function.
ADD_MONTHS Function The ADD_MONTHS function adds the integer number of months specified by int_expr to datetime_expr and normalizes the result. ADD_MONTHS is a Neoview extension. ADD_MONTHS (datetime_expr, int_expr [, int2 datetime_expr is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. The return value is the same type as the datetime_expr.
ASCII Function The ASCII function returns the integer that is the ASCII code of the first character in a character string expression associated with the ISO8891 character set. ASCII is a Neoview SQL extension. ASCII (character-expression) character-expression is an SQL character value expression that specifies a string of characters. See “Character Value...
ASIN Function The ASIN function returns the arcsine of a numeric value expression as an angle expressed in radians. ASIN is a Neoview SQL extension. ASIN (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the ASIN function.
ATAN Function The ATAN function returns the arctangent of a numeric value expression as an angle expressed in radians. ATAN is a Neoview SQL extension. ATAN (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the ATAN function.
ATAN2 Function The ATAN2 function returns the arctangent of the x and y coordinates, specified by two numeric value expressions, as an angle expressed in radians. ATAN2 is a Neoview SQL extension. ATAN2 (numeric-expression-x,numeric-expression-y) numeric-expression-x, numeric-expression-y are SQL numeric value expressions that specify the value for the x and y coordinate arguments of the ATAN2 function.
AVG Function AVG is an aggregate function that returns the average of a set of numbers. AVG ([ALL | DISTINCT] expression) ALL | DISTINCT specifies whether duplicate values are included in the computation of the AVG of the expression. The default option is ALL, which causes duplicate values to be included. If you specify DISTINCT, duplicate values are eliminated before the AVG function is applied.
Page 294
--- 1 row(s) selected. • Return the average salary by department: SELECT deptnum, AVG (salary) AS "AVERAGE SALARY" FROM persnl.employee WHERE deptnum < 3000 GROUP BY deptnum; Dept/Num "AVERAGE SALARY" -------- --------------------- 1000 52000.17 2000 50000.10 1500 41250.00 2500 37000.00 --- 4 row(s) selected.
The CASE expression is a conditional expression with two forms: simple and searched. In a simple CASE expression, Neoview SQL compares a value to a sequence of values and sets the CASE expression to the value associated with the first match—if there is a match. If there is no match, Neoview SQL returns the value specified in the ELSE clause (which can be null).
CASE expression returns the value expression specified in the ELSE clause, or NULL if the ELSE value is not specified. Considerations for CASE Data Type of the CASE Expression The data type of the result of the CASE expression depends on the data types of the result expressions.
Page 297
WHEN 500 THEN 'ACCOUNTANT' WHEN 600 THEN 'ADMINISTRATOR ANALYST' WHEN 900 THEN 'SECRETARY' ELSE NULL FROM persnl.employee; LAST_NAME FIRST_NAME (EXPR) -------------------- --------------- ----------------- GREEN ROGER MANAGER HOWARD JERRY MANAGER RAYMOND JANE MANAGER CHOU JOHN SECRETARY CONRAD MANFRED PROGRAMMER HERMAN SALESREP CLARK LARRY ACCOUNTANT...
10 characters consisting of the year, a hyphen, the month, another hyphen, and the day. • A date value to a character string or to a TIMESTAMP (Neoview SQL fills in the time part with 00:00:00.00). •...
Examples of CAST • In this example, the fractional portion is discarded: CAST (123.956 as INTERVAL DAY(18)) • This example returns the difference of two timestamps in minutes: CAST((d.step_end - d.step_start) AS INTERVAL MINUTE) • The PROJECT table contains a column START_DATE of data type DATE and a column SHIP_TIMESTAMP of data type TIMESTAMP.
CEILING Function The CEILING function returns the smallest integer, represented as a FLOAT data type, greater than or equal to a numeric value expression. CEILING is a Neoview SQL extension. CEILING (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the CEILING function.
CHAR Function The CHAR function returns the character that has the specified code value, which must be of exact numeric with scale 0. CHAR is a Neoview SQL extension. CHAR(code-value, [,char-set-name]) code-value is a valid code value in the character set in use.
Considerations for CHAR_LENGTH CHAR and VARCHAR Operands For a column declared as fixed CHAR, Neoview SQL returns the maximum length of that column. For a VARCHAR column, Neoview SQL returns the actual length of the string stored in that column.
COALESCE Function The COALESCE function returns the value of the first expression in the list that does not have a NULL value or if all the expressions have NULL values, the function returns a NULL value. COALESCE (expr1, expr2, ...) expr1 an expression to be compared.
The CODE_VALUE function returns an unsigned integer (INTEGER UNSIGNED) that is the code point of the first character in a character value expression that can be associated with any character sets allowed. CODE_VALUE is a Neoview SQL extension. CODE_VALUE(character-value-expression) character-value-expression is a character string.
CONCAT Function The CONCAT function returns the concatenation of two character value expressions as a character string value. You can also use the concatenation operator (||). CONCAT is a Neoview SQL extension. CONCAT (character-expr-1, character-expr-2) character-expr-1, character-expr-2 are SQL character value expressions (of data type CHAR or VARCHAR) that specify two strings of characters.
Page 306
VALUES (002, 'Executed at ' || CAST (CURRENT_TIMESTAMP AS CHAR(26))); SQL Functions and Expressions...
CONVERTTIMESTAMP Function The CONVERTTIMESTAMP function converts a Julian timestamp to a value with data type TIMESTAMP. CONVERTTIMESTAMP is a Neoview SQL extension. CONVERTTIMESTAMP (julian-timestamp) julian-timestamp is an expression that evaluates to a Julian timestamp, which is a LARGEINT value. Considerations for CONVERTTIMESTAMP...
COS Function The COS function returns the cosine of a numeric value expression, where the expression is an angle expressed in radians. COS is a Neoview SQL extension. COS (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the COS function.
COSH Function The COSH function returns the hyperbolic cosine of a numeric value expression, where the expression is an angle expressed in radians. COSH is a Neoview SQL extension. COSH (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the COSH function.
COUNT Function The COUNT function counts the number of rows that result from a query or the number of rows that contain a distinct value in a specific column. The result of COUNT is data type LARGEINT. The result can never be NULL. COUNT {(*) | ([ALL | DISTINCT] expression)} COUNT (*)
Page 311
--- 1 row(s) selected. SELECT COUNT(*) FROM persnl.employee WHERE jobcode IS NOT NULL; (EXPR) ----------- --- 1 row(s) selected. • Count the number of distinct departments in the EMPLOYEE table: SELECT COUNT (DISTINCT deptnum) FROM persnl.employee; (EXPR) ----------- --- 1 row(s) selected. COUNT Function...
CURRENT Function The CURRENT function returns a value of type TIMESTAMP based on the current local date and time. You can also use “CURRENT_TIMESTAMP Function” (page 316). CURRENT [(precision)] precision is an integer value in the range 0 to 6 that specifies the precision of (the number of decimal places in) the fractional seconds in the returned value.
CURRENT_DATE Function The CURRENT_DATE function returns the local current date as a value of type DATE. CURRENT_DATE The CURRENT_DATE function returns the current date, such as 1997-09-28. The value returned is a value of type DATE, not a string value. Examples of CURRENT_DATE •...
CURRENT_ROLE Function The CURRENT_ROLE function returns the role (ROLE.name) that you logged in as. This function can be used anywhere in the query. The values returned are string datatype VARCHAR(64). CURRENT_ROLE() Example of CURRENT_ROLE Logon with role of role1.role1 and with an alias of abcd. >>SELECT CURRENT_ROLE FROM (values(1)) x(a);...
CURRENT_TIME Function The CURRENT_TIME function returns the current local time as a value of type TIME. CURRENT_TIME [(precision)] precision is an integer value in the range 0 to 6 that specifies the precision of (the number of decimal places in) the fractional seconds in the returned value. The default is 0. For example, the function CURRENT_TIME (2) returns the current time as a value of data type TIME, where the precision of the fractional seconds is 2—for example, 14:01:59.30.
CURRENT_TIMESTAMP Function The CURRENT_TIMESTAMP function returns a value of type TIMESTAMP based on the current local date and time. You can also use the “CURRENT Function” (page 312). CURRENT_TIMESTAMP [(precision)] precision is an integer value in the range 0 to 6 that specifies the precision of (the number of decimal places in) the fractional seconds in the returned value.
CURRENT_USER Function The CURRENT_USER function returns the user name that you logged in as. If you are logged in as the role, the role is returned. This function can be used anywhere in the query. The values returned are string datatype VARCHAR(64). CURRENT_USER The CURRENT_USER function is equivalent to the “USER Function”...
DATE_ADD Function The DATE_ADD function adds the interval specified by interval_expression to datetime_expr. If the specified interval is in years or months, DATE_ADD normalizes the result. See “Standard Normalization” (page 279). The type of the datetime_expr is returned, unless the interval_expression contains any time components, then a timestamp is returned. DATE_ADD is a Neoview extension.
DATE_SUB Function The DATE_SUB function subtracts the specified interval_expression from datetime_expr. If the specified interval is in years or months, DATE_SUB normalizes the result. See “Standard Normalization” (page 279). The type of the datetime_expr is returned, unless the interval_expression contains any time components, then a timestamp is returned. DATE_SUB is a Neoview extension.
num_expr is an SQL exact numeric value expression that specifies how many datepart units of time are to be added to datetime_expr. If num_expr has a fractional portion, it is ignored. If num_expr is negative, the return value precedes datetime_expr by the specified amount of time.
DATEDIFF Function The DATEDIFF function returns the integer value for the number of datepart units of time between startdate and enddate. If enddate precedes startdate, the return value is negative or zero. DATEDIFF is a Neoview extension. DATEDIFF (datepart, startdate, enddate) datepart is YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, QUARTER, WEEK, or one of the following abbreviations...
The DATEFORMAT function returns a datetime value as a character string literal in the DEFAULT, USA, or EUROPEAN format. The data type of the result is CHAR. DATEFORMAT is a Neoview SQL extension. DATEFORMAT (datetime-expression,{DEFAULT | USA | EUROPEAN}) datetime-expression is an expression that evaluates to a datetime value of type DATE, TIME, or TIMESTAMP.
DATE_PART Function (of a timestamp) The DATE_PART function extracts the datetime field specified by text from the datetime value specified by datetime_expr and returns the result as an exact numeric value. The DATE_PART function accepts the specification of 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', or 'SECOND' for text.
DATE_TRUNC Function The DATE_TRUNC function returns a value of type TIMESTAMP, which has all fields of lesser precision than text set to zero (or 1 in the case of months or days). DATE_TRUNC is a Neoview extension. DATE_TRUNC(text, datetime_expr) text specifies 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', or 'SECOND'.
The DAY function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 31 that represents the corresponding day of the month. The result returned by the DAY function is equal to the result returned by the DAYOFMONTH function. DAY is a Neoview SQL extension. DAY (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP.
DAYNAME Function The DAYNAME function converts a DATE or TIMESTAMP expression into a character literal that is the name of the day of the week (Sunday, Monday, and so on). DAYNAME is a Neoview SQL extension. DAYNAME (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
1 through 31 that represents the corresponding day of the month. The result returned by the DAYOFMONTH function is equal to the result returned by the DAY function. DAYOFMONTH is a Neoview SQL extension. DAYOFMONTH (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP.
The DAYOFWEEK function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 7 that represents the corresponding day of the week. The value 1 represents Sunday, 2 represents Monday, and so forth. DAYOFWEEK is a Neoview SQL extension. DAYOFWEEK (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP.
DAYOFYEAR Function The DAYOFYEAR function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 366 that represents the corresponding day of the year. DAYOFYEAR is a Neoview SQL extension. DAYOFYEAR (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
DECODE Function The DECODE function compares expr to each test_expr value one by one in the order provided. If expr is equal to a test_expr, then the corresponding retval is returned. If no match is found, default is returned. If no match is found and default is omitted, NULL is returned.
‘Hi’, ?P3, NULL) *** ERROR[8822] The statement was not prepared. The last ret-val is an explicit NULL. When Neoview SQL encounters this situation, it assumes that the return value will be NUMERIC(18,6). Once Neoview SQL determines that the return values are numeric, it determines that all possible return values must be numeric.
Page 332
This statement is equivalent and will not produce an error: SELECT decode( (?p1 || ?p2), trim(?p1), ‘Hi’ ) from emp; SQL Functions and Expressions...
DEGREES Function The DEGREES function converts a numeric value expression expressed in radians to the number of degrees. DEGREES is a Neoview SQL extension. DEGREES (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the DEGREES function.
DIFF1 computation could result in a divisor of zero. Datetime Arguments In general, Neoview SQL does not allow division by a value of INTERVAL data type. However, to permit use of the two-argument version of DIFF1 with times and dates, Neoview SQL relaxes this restriction and allows division by a value of INTERVAL data type.
Page 335
--- 5 row(s) selected. Note that the first row retrieved displays null because the offset from the current row does not fall within the results set. • Retrieve the difference between the TS column in the current row and the TS column in the previous row: SELECT DIFF1 (TS) AS DIFF1_TS FROM mining.seqfcn...
DIFF1 computation could result in a divisor of zero. Datetime Arguments In general, Neoview SQL does not allow division by a value of INTERVAL data type. However, to permit use of the two-argument version of DIFF2 with times and dates, Neoview SQL relaxes this restriction and allows division by a value of INTERVAL data type.
Page 337
Note that the results are equal to the difference of DIFF1(I1) for the current row and DIFF1(I1) of the previous row. For example, in the third row of the output of this example, -31075 is equal to -9116 minus 21959. The value -9116 is the result of DIFF1(I1) for the current row, and the value 21959 is the result of DIFF1(I1) for the previous row.
EXP Function This function returns the exponential value (to the base e) of a numeric value expression. EXP is a Neoview SQL extension. EXP (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the EXP function.
EXPLAIN result for all statements prepared within the current session: SELECT * FROM TABLE (EXPLAIN (NULL,'%')) For more information about the LIKE predicate, see the Neoview SQL Reference Manual. This statement returns the EXPLAIN result for all statements prepared within the embedded SQL module named MYCAT.MYSCH.MYPROG:...
Page 340
Statement name; truncated on the right if longer than 60 characters. PLAN_ID LARGEINT Unique system-generated plan ID automatically assigned by Neoview SQL; generated at compile time. SEQ_NUM Sequence number of the current operator in the operator tree; indicates the sequence in which the operator tree is generated.
IDLETIME An estimate of the number of seconds to wait for an event to happen. The estimate includes the amount of time to open a table or start an ESP process. PROBES The number of times the operator will be executed. Usually, this value is 1, but it can be greater when you have, for example, an inner scan of a nested-loop join.
EXTRACT Function The EXTRACT function extracts a datetime field from a datetime or interval value expression. It returns an exact numeric value. EXTRACT (datetime-field FROM extract-source) datetime-field is: YEAR | MONTH | DAY | HOUR | MINUTE | SECOND extract-source is: datetime-expression | interval-expression “Datetime Value Expressions”...
FLOOR Function The FLOOR function returns the largest integer, represented as a FLOAT data type, less than or equal to a numeric value expression. FLOOR is a Neoview SQL extension. FLOOR (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the FLOOR function.
HOUR Function The HOUR function converts a TIME or TIMESTAMP expression into an INTEGER value in the range 0 through 23 that represents the corresponding hour of the day. HOUR is a Neoview SQL extension. HOUR (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type TIME or TIMESTAMP. See “Datetime Value Expressions”...
The INSERT function returns a character string where a specified number of characters within the character string have been deleted beginning at a specified start position and then another character string has been inserted at the start position. INSERT is a Neoview SQL extension. INSERT (char-expr-1, start, length, char-expr-2) char-expr-1, char-expr-2 are SQL character value expressions (of data type CHAR or VARCHAR) that specify two strings of characters.
ISNULL Function The ISNULL function returns the value of the first argument if it is not null, otherwise it returns the value of the second argument. Both expressions must be of comparable types. ISNULL is a Neoview extension. ISNULL(ck_expr, repl_value) ck_expr an expression of any valid SQL data type.
YEAR through SECOND, Neoview SQL extends the value before converting it to a Julian timestamp. Datetime fields to the left of the specified datetime value are set to current date fields. Datetime fields to the right of the specified datetime value are set to zero.
Page 348
SELECT LASTNOTNULL (I1) AS LASTNOTNULL FROM mining.seqfcn SEQUENCE BY TS; LASTNOTNULL ----------- 6215 6215 19058 19058 11966 --- 5 row(s) selected. SQL Functions and Expressions...
The result returned by the LCASE function is equal to the result returned by the LOWER function. LCASE returns a string of fixed-length or variable-length character data, depending on the data type of the input string. LCASE is a Neoview SQL extension. LCASE (character-expression) character-expression is an SQL character value expression that specifies a string of characters to downshift.
LEFT Function The LEFT function returns the leftmost specified number of characters from a character expression LEFT is a Neoview SQL extension. LEFT (character-expr, count) character-expr specifies the source string from which to return the leftmost specified number of characters.
NULL. See “Character Value Expressions” (page 208). Neoview SQL returns the result as a 2-byte signed integer with a scale of zero. If substring-expression is not found in source-expression, Neoview SQL returns 0. Considerations for LOCATE Result of LOCATE If the length of source-expression is zero and the length of substring-expression is greater than zero, Neoview SQL returns 0.
LOG Function The LOG function returns the natural logarithm of a numeric value expression. LOG is a Neoview SQL extension. LOG (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the LOG function. The value of the argument must be greater than zero. See “Numeric Value...
LOG10 Function The LOG10 function returns the base 10 logarithm of a numeric value expression. LOG10 is a Neoview SQL extension. LOG10 (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the LOG10 function.
LOWER Function • “Considerations for LOWER” • “Example of LOWER” The LOWER function downshifts characters. LOWER can appear anywhere in a query where a value can be used, such as in a select list, an ON clause, a WHERE clause, a HAVING clause, a LIKE predicate, an expression, or as qualifying a new value in an UPDATE or INSERT statement .
Example of LOWER Suppose that your CUSTOMER table includes an entry for Hotel Oregon. Select the column CUSTNAME and return the result in uppercase and lowercase letters by using the UPPER and LOWER functions: SELECT custname,UPPER(custname),LOWER(custname) FROM sales.customer; (EXPR) (EXPR) (EXPR) ----------------- -------------------...
LPAD Function The LPAD function pads the left side of a string with the specified string. LPAD is a Neoview extension. LPAD (str, len [,padstr]) can be an expression. See “Character Value Expressions” (page 208). can be an expression but must be an integral value. If len is equal to the length of the string, no change is made.
LTRIM Function The LTRIM function removes leading spaces from a character string. LTRIM is a Neoview SQL extension. LTRIM (character-expression) character-expression is an SQL character value expression and specifies the string from which to trim leading spaces. See “Character Value Expressions” (page 208).
MAX/MAXIMUM Function MAX is an aggregate function that returns the maximum value within a set of values. MAXIMUM is the equivalent of MAX wherever the function name MAX appears within a statement. The data type of the result is the same as the data type of the argument. MAX | MAXIMUM ([ALL | DISTINCT] expression) ALL | DISTINCT specifies whether duplicate values are included in the computation of the maximum of the...
MIN Function MIN is an aggregate function that returns the minimum value within a set of values. The data type of the result is the same as the data type of the argument. MIN ([ALL | DISTINCT] expression) ALL | DISTINCT specifies whether duplicate values are included in the computation of the minimum of the expression.
MINUTE Function The MINUTE function converts a TIME or TIMESTAMP expression into an INTEGER value, in the range 0 through 59, that represents the corresponding minute of the hour. MINUTE is a Neoview SQL extension. MINUTE (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type TIME or TIMESTAMP. See “Datetime Value Expressions”...
MOD Function The MOD function returns the remainder (modulus) of an integer value expression divided by an integer value expression. MOD is a Neoview SQL extension. MOD (integer-expression-1,integer-expression-2) integer-expression-1 is an SQL numeric value expression of data type SMALLINT, INTEGER, or LARGEINT that specifies the value for the dividend argument of the MOD function.
MONTH Function The MONTH function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 12 that represents the corresponding month of the year. MONTH is a Neoview SQL extension. MONTH (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
MONTHNAME Function The MONTHNAME function converts a DATE or TIMESTAMP expression into a character literal that is the name of the month of the year (January, February, and so on). MONTHNAME is a Neoview SQL extension. MONTHNAME (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGAVG is a Neoview SQL extension. MOVINGAVG (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGCOUNT is a Neoview SQL extension. MOVINGCOUNT (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGMAX is a Neoview SQL extension. MOVINGMAX (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGMIN is a Neoview SQL extension. MOVINGMIN (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGSTDDEV is a Neoview SQL extension. MOVINGSTDDEV (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGSUM is a Neoview SQL extension. MOVINGSUM (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). MOVINGVARIANCE is a Neoview SQL extension. MOVINGVARIANCE (column-expression,integer-expression [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
NULLIF Function The NULLIF function compares the value of two expressions. Both expressions must be of comparable types. The return value is the value of the first argument when that value is not NULL. NULLIF(expr1, expr2) expr1 an expression to be compared. expr2 an expression to be compared.
NULLIFZERO Function The NULLIFZERO function returns the value of the expression if that value is not zero. It returns NULL if the value of the expression is zero. NULLIFZERO (expression) expression specifies a value expression. It must be a numeric data type. Examples of NULLIFZERO •...
If operand is a null value, NVL returns new-operand. If operand is not a null value, NVL returns operand. The operand and new-operand can be a column name, subquery, Neoview SQL string functions, math functions, or constant values. Examples of NVL •...
Considerations for OCTET_LENGTH CHAR and VARCHAR Operands For a column declared as fixed CHAR, Neoview SQL returns the length of that column as the maximum number of storage bytes. For a VARCHAR column, Neoview SQL returns the length of the string stored in that column as the actual number of storage bytes.
The OFFSET function is a sequence function that retrieves columns from previous rows of an intermediate result table ordered by a SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). OFFSET is a Neoview SQL extension. OFFSET (column-expression,number-rows [,max-rows]) column-expression specifies a derived column determined by the evaluation of the column expression.
PI Function The PI function returns the constant value of pi as a floating-point value. PI is a Neoview SQL extension. PI() Example of PI This constant function returns the value 3.14159260000000064E+000: PI() SQL Functions and Expressions...
NULL. See “Character Value Expressions” (page 208). Neoview SQL returns the result as a 2-byte signed integer with a scale of zero. If substring-expression is not found in source-expression, Neoview SQL returns zero. Considerations for POSITION Result of POSITION If the length of source-expression is zero and the length of substring-expression is greater than zero, Neoview SQL returns 0.
POWER Function The POWER function returns the value of a numeric value expression raised to the power of an integer value expression. You can also use the exponential operator **. POWER is a Neoview SQL extension. POWER (numeric-expression-1,numeric-expression-2) numeric-expression-1, numeric-expression-2 are SQL numeric value expressions that specify the values for the base and exponent arguments of the POWER function.
The QUARTER function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 4 that represents the corresponding quarter of the year. Quarter 1 represents January 1 through March 31, and so on. QUARTER is a Neoview SQL extension. QUARTER (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP.
RADIANS Function The RADIANS function converts a numeric value expression expressed in degrees to the number of radians. RADIANS is a Neoview SQL extension. RADIANS (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the RADIANS function.
RANK/RUNNINGRANK Function The RUNNINGRANK function is a sequence function that returns the rank of the given value of an intermediate result table ordered by a SEQUENCE BY clause in a SELECT statement. RANK is an alternative syntax for RUNNINGRANK. RUNNINGRANK is a Neoview extension. RUNNINGRANK(expression) | RANK(expression) expression specifies the expression on which to perform the rank.
Page 388
SELECT I1, RUNNINGRANK (I1) AS RANK FROM cat.sch.seqfcn SEQUENCE BY I1; RANK ----------- -------------------- --- 8 row(s) selected. Return the rank of I1 descending: SELECT I1, RUNNINGRANK (I1) AS RANK FROM cat.sch.seqfcn SEQUENCE BY I1 DESC; RANK ----------- -------------------- --- 8 row(s) selected. Return the rank of I2, using the alternative RANK syntax: SELECT I2, RANK (I2) AS RANK FROM cat.sch.seqfcn...
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGSTDDEV is a Neoview SQL extension. RUNNINGSTDDEV (column-expression) column-expression specifies a derived column determined by the evaluation of the column expression. RUNNINGSTDDEV returns the standard deviation of nonnull values of column-expression up to and including the current row.
REPEAT Function The REPEAT function returns a character string composed of the evaluation of a character expression repeated a specified number of times. REPEAT is a Neoview SQL extension. REPEAT (character-expr, count) character-expr specifies the source string from which to return the specified number of repeated strings.
RIGHT Function The RIGHT function returns the rightmost specified number of characters from a character expression. RIGHT is a Neoview SQL extension. RIGHT (character-expr, count) character-expr specifies the source string from which to return the rightmost specified number of characters.
The ROWS SINCE function is a sequence function that returns the number of rows counted since the specified condition was last true in the intermediate result table ordered by a SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). ROWS SINCE is a Neoview SQL extension. SQL Functions and Expressions...
If a row is reached where the condition is true, ROWS SINCE returns the number of rows counted so far. Otherwise, if the condition is never true within the result table being considered, ROWS SINCE returns null. Neoview SQL then goes to the next row as the new current row. Examples of ROWS SINCE •...
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). ROWS SINCE CHANGED is a Neoview SQL extension. ROWS SINCE CHANGED (column-expression-list) column-expression-list is a comma-separated list that specifies a derived column list determined by the evaluation of the column expression list.
17, 'gofly' ) RTRIM Function The RTRIM function removes trailing spaces from a character string. RTRIM is a Neoview SQL extension. RTRIM (character-expression) character-expression is an SQL character value expression and specifies the string from which to trim trailing spaces.
SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGCOUNT is a Neoview SQL extension. RUNNINGCOUNT {(*) | (column-expression)} as an argument causes RUNNINGCOUNT(*) to return the number of rows in the intermediate result table up to and including the current row.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGMAX is a Neoview SQL extension. RUNNINGMAX (column-expression) column-expression specifies a derived column determined by the evaluation of the column expression.
Page 398
SELECT RUNNINGMIN (I1) AS MIN_I1 FROM mining.seqfcn SEQUENCE BY TS; MIN_I1 ------------ 6215 6215 6215 4597 4597 --- 5 row(s) selected. SQL Functions and Expressions...
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGSTDDEV is a Neoview SQL extension. RUNNINGSTDDEV (column-expression) column-expression specifies a derived column determined by the evaluation of the column expression. RUNNINGSTDDEV returns the standard deviation of nonnull values of column-expression up to and including the current row.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGSUM is a Neoview SQL extension. RUNNINGSUM (column-expression) column-expression specifies a derived column determined by the evaluation of the column expression.
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 268). RUNNINGVARIANCE is a Neoview SQL extension. RUNNINGVARIANCE (column-expression) column-expression specifies a derived column determined by the evaluation of the column expression.
SECOND Function The SECOND function converts a TIME or TIMESTAMP expression into an INTEGER value in the range 0 through 59 that represents the corresponding second of the hour. SECOND is a Neoview SQL extension. SECOND (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type TIME or TIMESTAMP. See “Datetime Value Expressions”...
The SIGN function returns an indicator of the sign of a numeric value expression. If the value is less than zero, the function returns -1 as the indicator. If the value is zero, the function returns 0. If the value is greater than zero, the function returns 1. SIGN is a Neoview SQL extension. SIGN (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the SIGN function.
SIN Function The SIN function returns the sine of a numeric value expression, where the expression is an angle expressed in radians. SIN is a Neoview SQL extension. SIN (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the SIN function.
SINH Function The SINH function returns the hyperbolic sine of a numeric value expression, where the expression is an angle expressed in radians. SINH is a Neoview SQL extension. SINH (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the SINH function.
SPACE Function The SPACE function returns a character string consisting of a specified number of spaces. SPACE is a Neoview SQL extension. SPACE (length [,char-set-name]) length specifies the number of characters to be returned. The number count must be a value greater than or equal to zero of exact numeric data type and with a scale of zero.
SQRT Function The SQRT function returns the square root of a numeric value expression. SQRT is a Neoview SQL extension. SQRT (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the SQRT function. The value of the argument must not be a negative number. See “Numeric Value...
Because the definition of variance has N-1 in the denominator of the expression (if weight is not specified), Neoview SQL returns a system-defined default setting of zero (and no error) if the number of rows in the table, or a group of the table, is equal to 1.
Examples of STDDEV • Compute the standard deviation of the salary of the current employees: SELECT STDDEV(salary) AS StdDev_Salary FROM persnl.employee; STDDEV_SALARY ------------------------- 3.57174062500000000E+004 --- 1 row(s) selected. • Compute the standard deviation of the cost of parts in the current inventory: SELECT STDDEV (price * qty_available) FROM sales.parts;...
SUBSTRING/SUBSTR Function The SUBSTRING function extracts a substring out of a given character expression. It returns a character string of data type VARCHAR, with maximum length equal to the fixed length or maximum variable length of the character expression. SUBSTR is equivalent to SUBSTRING. SUBSTRING (character-expr FROM start-position [FOR length]) SUBSTRING (character-expr,start-position,length) character-expr...
Page 412
SUBSTRING('Robert John Smith' FROM 0 FOR 3) SUBSTR('Robert John Smith' FROM 0 FOR 3) • Extract 'John': SUBSTRING ('Robert John Smith' FROM 8 FOR 4) SUBSTR ('Robert John Smith' FROM 8 FOR 4) • Extract 'John Smith': SUBSTRING ('Robert John Smith' FROM 8) SUBSTR ('Robert John Smith' FROM 8) •...
SUM Function SUM is an aggregate function that returns the sum of a set of numbers. SUM ([ALL | DISTINCT] expression) ALL | DISTINCT specifies whether duplicate values are included in the computation of the SUM of the expression. The default option is ALL, which causes duplicate values to be included. If you specify DISTINCT, duplicate values are eliminated before the SUM function is applied.
TAN Function The TAN function returns the tangent of a numeric value expression, where the expression is an angle expressed in radians. TAN is a Neoview SQL extension. TAN (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the TAN function.
TANH Function The TANH function returns the hyperbolic tangent of a numeric value expression, where the expression is an angle expressed in radians. TANH is a Neoview SQL extension. TANH (numeric-expression) numeric-expression is an SQL numeric value expression that specifies the value for the argument of the TANH function.
If a row is reached where the condition is true, ROWS SINCE returns the number of rows counted so far. Otherwise, if the condition is never true within the result table being considered, ROWS SINCE returns null. Neoview SQL then goes to the next row as the new current row and the THIS constant is reevaluated.
UCS2 character set no data loss is possible. However, when Neoview SQL translates a character-value-expression from UCS2, certain characters encoded in UTF16 cannot be converted to the target character set. Neoview SQL displays an error in this case.
TRIM Function The TRIM function removes leading and trailing characters from a character string. TRIM ([[trim-type] [trim-char] FROM] trim-source) trim-type is: LEADING | TRAILING | BOTH trim-type specifies whether characters are to be trimmed from the leading end (LEADING), trailing end (TRAILING), or both ends (BOTH) of trim-source.
Unicode “alphabetic” property and whose Unicode name includes title. UCASE returns a string of fixed-length or variable-length character data, depending on the data type of the input string. UCASE is a Neoview SQL extension. UCASE (character-expression) character-expression is an SQL character value expression that specifies a string of characters to upshift.
Page 426
----------------- ------------------- ------------------ Hotel Oregon HOTEL OREGON hotel oregon --- 17 row(s) selected. “LCASE Function” (page 349). For more examples of when to use the UCASE function, see “UPSHIFT Function” (page 428). SQL Functions and Expressions...
UPPER Function The UPPER function upshifts characters. UPPER can appear anywhere in a query where a value can be used, such as in a select list, an ON clause, a WHERE clause, a HAVING clause, a LIKE predicate, an expression, or as qualifying a new value in an UPDATE or INSERT statement. The result returned by the UPPER function is equal to the result returned by the UPSHIFT or UCASE function.
UCASE function. UPSHIFT returns a string of fixed-length or variable-length character data, depending on the data type of the input string. UPSHIFT is a Neoview SQL extension. UPSHIFT (character-expression) character-expression is an SQL character value expression that specifies a string of characters to upshift. See “Character Value Expressions”...
USER Function The USER function returns the username that you logged in as. If you are logged in as the role, the role is returned. This function can be used anywhere in the query. The values returned are string datatype VARCHAR(64). USER Example of USER Logon with role of role1.role1 and with an alias of abcd.
Because the definition of variance has N-1 in the denominator of the expression (when weight is not specified), Neoview SQL returns a default value of zero (and no error) if the number of rows in the table, or a group of the table, is equal to 1.
where vi is the i-th value of expression, wi is the i-th value of weight, and N is the cardinality of the result table. Data Type of the Result The data type of the result is always DOUBLE PRECISION. Operands of the Expression The expression includes columns from the rows of the SELECT result table—but cannot include an aggregate function.
WEEK Function The WEEK function converts a DATE or TIMESTAMP expression into an INTEGER value in the range 1 through 54 that represents the corresponding week of the year. WEEK is a Neoview SQL extension. WEEK (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
YEAR Function The YEAR function converts a DATE or TIMESTAMP expression into an INTEGER value that represents the year. YEAR is a Neoview SQL extension. YEAR (datetime-expression) datetime-expression is an expression that evaluates to a datetime value of type DATE or TIMESTAMP. See “Datetime Value Expressions”...
ZEROIFNULL Function The ZEROIFNULL function returns a value of zero the expression if NULL. Otherwise, it returns the value of the expression. ZEROIFNULL (expression) expression specifies a value expression. It must be a numeric data type. Example of ZEROIFNULL ZEROIFNULL returns the value of the column named salary whenever the column value is not NULL and it returns 0 whenever the column value is NULL.
A Quick Reference This appendix provides a quick, alphabetic reference to commands, statements, and utilities. For other topics, see the Index. “ALTER MATERIALIZED VIEW Statement” (page 44) “ALTER MVGROUP Statement” (page 45) “ALTER VIEW Statement” (page 51) “ALTER TABLE Statement” (page 47) “ALTER TRIGGER Statement”...
B Reserved Words The words listed in this appendix are reserved for use by Neoview SQL. To prevent syntax errors, avoid using these words as identifiers in Neoview SQL. In Neoview SQL, if an HP operating system name contains a reserved word, you must enclose the reserved word in double quotes (") to access that column or object.
Page 438
Table B-1 Reserved SQL Identifiers (continued) BIT_LENGTH INITIALLY SCHEMA BLOB INNER SCOPE BOOLEAN INOUT SCROLL BOTH INPUT SEARCH BREADTH INSENSITIVE SECOND INSERT SECTION CALL SELECT CASE INTEGER SENSITIVE CASCADE INTERSECT SESSION CASCADED INTERVAL SESSION_USER CAST INTO CATALOG SETS CHAR ISOLATION SIGNAL CHAR_LENGTH ITERATE...
Page 439
DESCRIBE TRIM DESCRIPTOR ONLY TRUE DESTROY OPEN UNDER DESTRUCTOR OPERATORS UNION DETERMINISTIC OPTION UNIQUE DIAGNOSTICS UNKNOWN DISTINCT ORDER UNNEST DICTIONARY ORDINALITY UPDATE DISCONNECT OTHERS UPPER DOMAIN UPSHIFT DOUBLE OUTER USAGE DROP OUTPUT USER DYNAMIC OVERLAPS USING Reserved Neoview SQL Identifiers...
Page 440
PRESERVE WHERE EXTERNAL PRIMARY WHILE EXTRACT PRIOR WITH FALSE PRIVATE WITHOUT FETCH PRIVILEGES WORK FIRST PROCEDURE WRITE FLOAT PROTECTED YEAR ZONE Indicates reserved words that are Neoview SQL extensions. Words reserved by the ANSI standard are not marked. Reserved Words...
INSERT operations 150 records can be inserted into a Neoview SQL table in a single INSERT operation. Joins 40 tables can be joined, including base tables of views, but joining more tables affects performance.
D Standard SQL and Neoview SQL This appendix describes Neoview SQL conformance to the SQL standards established by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). It describes: • “ANSI SQL Standards” • “ISO Standards”...
F201 CAST function F471 Scalar subquery values F481 Expanded NULL predicate This table lists the Core SQL:1999 features for which Neoview SQL offers partial support: ID, Feature Level of Support E071 Basic query expressions Neoview SQL fully supports this subfeature:...
Page 445
E121-04 OPEN statement (Neoview SQL syntax does not match that of SQL '99) E121-10 FETCH statement, implicit NEXT (Neoview SQL syntax does not match that of SQL '99) E121-17 WITH HOLD cursors (supported only for SELECT statements that use stream access mode or an...
Page 446
F051-04 Comparison predicate for DATE, TIME, and TIME-STAMP data types F051-05 Explicit CAST between datetime types and character types F051-06 CURRENT_DATE Neoview SQL does not support these subfeatures F051-07 LOCALTIME (equivalent to CAST (CURRENT_TIME AS TIME WITHOUT TIME ZONE)) F051-08 LOCALTIMESTAMP...
Neoview SQL provides many features that enhance or supplement the functionality of standard SQL. In your Neoview SQL applications, you can use these extensions just as you can use Core SQL:1999. This table shows the Non-Core extensions that Neoview SQL supports:...
10646, see the Web sites listed under “ISO Standards” (page 443). Neoview SQL complies fully with the Unicode 2.1 standard. For information about this standard, see the Web site of the Unicode Consortium: http://www.unicode.org Neoview SQL uses UTF-16BE (16-bit) encoding for the Unicode (UCS2) character set. The full range of UTF-16 characters is allowed, but surrogate pairs are not recognized as characters.