
Rocket UniVerse SQL Reference Version 11.2.5 July 2015 UNV-1125-SQLR-1 Notices Edition Publication date: July 2015 Book number: UNV-1125-SQLR-1 Product version: Rocket UniVerse V11.2.5 Copyright © Rocket Software, Inc. or its affiliates 1985-2015. All Rights Reserved. Trademarks Rocket is a registered trademark of Rocket Software, Inc. For a list of Rocket registered trademarks go to: www.rocketsoftware.com/about/legal. All other products or services mentioned in this document may be covered by the trademarks, service marks, or product names of their respective owners. Examples This information might contain examples of data and reports. The examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. License agreement This software and the associated documentation are proprietary and confidential to Rocket Software, Inc. or its affiliates, are furnished under license, and may be used and copied only in accordance with the terms of such license. Note: This product may contain encryption technology. Many countries prohibit or restrict the use, import, or export of encryption technologies, and current use, import, and export regulations should be followed when exporting this product. 2 Corporate information Rocket Software, Inc. develops enterprise infrastructure products in four key areas: storage, networks, and compliance; database servers and tools; business information and analytics; and application development, integration, and modernization. Website: www.rocketsoftware.com Rocket Global Headquarters 77 4th Avenue, Suite 100 Waltham, MA 02451-1468 USA To contact Rocket Software by telephone for any reason, including obtaining pre-sales information and technical support, use one of the following telephone numbers. Country Toll-free telephone number United States 1-855-577-4323 Australia 1-800-823-405 Belgium 0800-266-65 Canada 1-855-577-4323 China 800-720-1170 France 0800-180-0882 Germany 08-05-08-05-62 Italy 800-878-295 Japan 0800-170-5464 Netherlands 0-800-022-2961 New Zealand 0800-003210 South Africa 0-800-980-818 United Kingdom 0800-520-0439 Contacting technical support The Rocket Customer Portal is the primary method of obtaining support. If you have current support and maintenance agreements with Rocket Software, you can access the Rocket Customer Portal and report a problem, download an update, or find answers in the U2 Knowledgebase. To log into the Rocket Customer Portal or to request a Rocket Customer Portal account, go to www.rocketsoftware.com/support. In addition to using the Rocket Customer Portal to obtain support, you can send email to [email protected] or use one of the following telephone numbers. Country Toll-free telephone number North America +1 800 729 3553 United Kingdom/France +44(0) 800 773 771 or +44(0) 20 8867 3691 Europe/Africa +44 (0) 20 88673692 Australia +1 800 707 703 or +61 (0) 29412 5450 New Zealand +0800 505 515 3 Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Table of Contents Table of Contents Chapter 1 Chapter 1: Introduction UniVerse SQL syntax conventions . 1-3 Examples used in this book. 1-4 The UniVerse demonstration database . 1-4 The Circus database . 1-4 Chapter 2 Chapter 2: The SQL catalog What Is the SQL catalog? . 2-3 Structure of the SQL catalog . 2-4 UV_ASSOC . 2-5 UV_COLUMNS . 2-7 UV_SCHEMA. 2-10 UV_TABLES . 2-11 UV_USERS . 2-13 UV_VIEWS. 2-14 Using the SQL catalog . 2-15 Finding SQL catalog inconsistencies . 2-15 Fixing SQL catalog inconsistencies . 2-16 Chapter 3 Chapter 3: Data types UniVerse SQL data categories . 3-3 SQL data types . 3-5 BIT . 3-6 CHAR . 3-7 DATE . 3-7 DEC . 3-7 DOUBLE PRECISION . 3-8 FLOAT . 3-8 INT . 3-9 NCHAR . 3-10 C:\U2Doc\UniVerse\11.2\Source\sqlref\SqlrefTOC.doc (bookTOC.template) March 25, 2014 12:30 pm NUMERIC . 3-10 NVARCHAR. 3-11 REAL . 3-12 SMALLINT . 3-12 TIME . 3-13 VARBIT . 3-13 VARCHAR . 3-13 Data types and data categories . 3-15 Data types and conversion codes. 3-16 Chapter 4 Chapter 4: UniVerse SQL in client programs Programming with ODBC. 4-3 Multivalued columns and associations. 4-3 Using SQL statements in programs . 4-4 SQL syntax in programs . 4-5 SELECT statements in programmatic SQL . 4-6 Using parameter markers in DML statements . 4-8 Chapter 5 Chapter 5: Triggers Applying business rules . 5-2 Using triggers . 5-3 When does a trigger fire? . 5-3 What events fire a trigger? . 5-3 Creating triggers . 5-5 Modifying triggers. 5-5 Listing information about triggers . 5-6 Trigger programs . 5-8 Transactions . 5-9 Opening files . 5-10 Handling errors. 5-11 Handling record and file locks . 5-12 Order of operations . 5-12 Nested triggers and trigger recursion . 5-13 Some examples . 5-16 Extending referential integrity. 5-16 Preventing deletions . 5-17 Validating data . 5-18 Changing a record before writing it . 5-18 Auditing changes . 5-19 Table of Contents 5 Chapter 6 Chapter 6: UniVerse SQL statements Statement page layout . 6-6 ALTER TABLE . 6-7 ADD clause: Column . 6-8 ADD clause: Column Synonym . 6-9 ADD clause: Association . 6-10 ADD clause: Table Constraint . 6-11 DROP clause: Association. 6-11 DROP clause: Integrity Constraint . 6-12 ALTER clause: SET DEFAULT . 6-13 ALTER clause: DROP DEFAULT . 6-13 TRIGGER clause . 6-14 CALL . 6-15 CREATE INDEX . 6-17 CREATE SCHEMA . 6-20 CREATE TABLE . 6-24 Column definition . 6-29 ASSOC clause . 6-41 Table constraints . 6-43 CREATE TRIGGER . 6-49 CREATE VIEW . 6-52 DELETE . 6-61 DROP INDEX . 6-67 DROP SCHEMA . 6-68 DROP TABLE . 6-70 DROP TRIGGER . 6-72 DROP VIEW . 6-73 GRANT . 6-75 Database privileges . 6-76 Table privileges . 6-78 INSERT. 6-81 Specifying columns . 6-83 Specifying values . 6-85 VALUES clause . 6-85 Query specification . 6-86 REVOKE . 6-88 Database privileges . 6-89 Table privileges . 6-91 SELECT . 6-94 SELECT clause . 6-95 6 UniVerse SQL Reference WHERE clause . 6-114 WHEN clause . 6-124 GROUP BY clause . 6-129 HAVING clause . 6-130 ORDER BY clause . 6-131 FOR UPDATE clause . 6-133 Report qualifiers . 6-135 Processing qualifiers . 6-142 UNION operator. 6-145 UPDATE. 6-148 Set expressions . 6-151 WHERE clause . 6-153 WHEN clause . 6-154 Referential integrity actions . 6-154 Column . 6-157 EVAL expressions . 6-159 Condition . 6-160 Comparing values . 6-161 Specifying a range: BETWEEN . 6-162 Phonetic matching: SAID . 6-163 Pattern matching: LIKE . 6-163 Testing for the null value: IS NULL . 6-164 Data type . 6-165 Expression . 6-166 Concatenation operator. 6-167 CAST function . 6-167 Function expressions . 6-167 Identifier. 6-171 Delimited identifiers . 6-171 Literal . 6-175 Character strings . 6-175 Bit strings . 6-175 Hex strings . 6-175 Numbers . 6-176 Dates . 6-176 Times . 6-176 Relational operator. 6-177 Set function. 6-178 Subquery . 6-180 Table . 6-183 Table of Contents 7 Appendix A Appendix A: UniVerse SQL grammar BNF conventions . A-2 Common syntax elements . A-3 Tokens, characters, and symbols . A-3 Keywords . A-4 Delimiters . A-4 Literals . A-5 Identifiers and names. A-7 Value expressions . A-9 Primaries . A-9 Column specifications . A-10 Set functions . A-11 Character value expressions . A-11 Numeric value expressions . A-13.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages338 Page
-
File Size-