IBM Informix Guide to SQL: Reference
Total Page:16
File Type:pdf, Size:1020Kb
IBM Informix Version 11.70 IBM Informix Guide to SQL: Reference SC27-3524-00 IBM Informix Version 11.70 IBM Informix Guide to SQL: Reference SC27-3524-00 Note Before using this information and the product it supports, read the information in “Notices” on page D-1. Edition This publication contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright IBM Corporation 1996, 2010. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Introduction ..................................ix About This Publication................................ix Types of Users .................................ix Software Dependencies ..............................ix Assumptions About Your Locale............................x Demonstration Database ..............................x What's New in SQL Reference for IBM Informix, Version 11.70 ..................x Example code conventions ..............................xi Additional documentation ..............................xii Compliance with industry standards ...........................xii Syntax diagrams .................................xiii How to read a command-line syntax diagram ......................xiv Keywords and punctuation .............................xv Identifiers and names ...............................xv How to Provide Documentation Feedback .........................xv Chapter 1. System Catalog Tables........................1-1 Objects That the System Catalog Tables Track ........................1-1 Using the System Catalog ..............................1-1 Accessing the System Catalog ............................1-6 Update System Catalog Data ............................1-6 Structure of the System Catalog ............................1-7 SYSAGGREGATES.................................1-9 SYSAMS ....................................1-9 SYSATTRTYPES .................................1-11 SYSBLOBS ...................................1-12 SYSCASTS ...................................1-12 SYSCHECKS ..................................1-13 SYSCHECKUDRDEP ...............................1-14 SYSCOLATTRIBS .................................1-14 SYSCOLAUTH .................................1-15 SYSCOLDEPEND.................................1-15 SYSCOLUMNS .................................1-16 Opaque Data Types ...............................1-18 Storing Column Length..............................1-18 Storing Maximum and Minimum Values ........................1-19 SYSCONSTRAINTS ................................1-20 SYSDEFAULTS .................................1-20 SYSDEPEND ..................................1-21 SYSDIRECTIVES .................................1-22 SYSDISTRIB ..................................1-22 SYSDOMAINS..................................1-24 SYSERRORS ..................................1-24 SYSEXTCOLS ..................................1-24 SYSEXTCOLS (XPS) ................................1-25 SYSEXTDFILES .................................1-26 SYSEXTDFILES (XPS) ...............................1-26 SYSEXTERNAL .................................1-26 SYSEXTERNAL (XPS) ...............................1-27 SYSFRAGAUTH .................................1-27 SYSFRAGDIST..................................1-28 SYSFRAGMENTS.................................1-30 SYSINDEXES ..................................1-31 SYSINDICES ..................................1-33 SYSINHERITS ..................................1-35 © Copyright IBM Corp. 1996, 2010 iii SYSLANGAUTH .................................1-35 SYSLOGMAP ..................................1-35 SYSNEWDEPEND (XPS) ..............................1-36 SYSOBJSTATE ..................................1-36 SYSOPCLASSES .................................1-37 SYSOPCLSTR ..................................1-37 SYSPROCAUTH .................................1-38 SYSPROCBODY .................................1-39 SYSPROCCOLUMNS...............................1-40 SYSPROCEDURES ................................1-40 SYSPROCPLAN .................................1-43 SYSREFERENCES ................................1-43 SYSREPOSITORY (XPS)...............................1-44 SYSROLEAUTH .................................1-44 SYSROUTINELANGS ...............................1-45 SYSSECLABELCOMPONENTS ............................1-45 SYSSECLABELCOMPONENTELEMENTS ........................1-45 SYSSECPOLICIES.................................1-46 SYSSECPOLICYCOMPONENTS ............................1-46 SYSSECPOLICYEXEMPTIONS ............................1-47 SYSSECLABELAUTH ..............................1-47 SYSSECLABELNAMES ...............................1-47 SYSSECLABELS .................................1-48 SYSSEQUENCES .................................1-48 SYSSYNONYMS .................................1-48 SYSSYNTABLE .................................1-49 SYSTABAMDATA ................................1-49 SYSTABAUTH..................................1-50 SYSTABLES...................................1-50 SYSTRACECLASSES................................1-53 SYSTRACEMSGS .................................1-54 SYSTRIGBODY .................................1-54 SYSTRIGGERS..................................1-55 SYSUSERS ...................................1-55 SYSVIEWS ...................................1-56 SYSVIOLATIONS.................................1-56 SYSXADATASOURCES ...............................1-57 SYSXASOURCETYPES ...............................1-57 SYSXTDDESC ..................................1-58 SYSXTDTYPEAUTH ................................1-58 SYSXTDTYPES .................................1-59 Information Schema ................................1-60 Generating the Information Schema Views .......................1-60 Accessing the Information Schema Views ........................1-60 Structure of the Information Schema Views .......................1-61 Chapter 2. Data Types .............................2-1 Summary of Data Types ...............................2-1 Description of Data Types ..............................2-5 BIGINT ...................................2-5 BIGSERIAL ..................................2-6 BLOB ....................................2-6 BOOLEAN ..................................2-7 BYTE ....................................2-8 CHAR(n) ...................................2-8 CHARACTER(n) ................................2-10 CHARACTER VARYING(m,r) ...........................2-10 CLOB....................................2-10 DATE....................................2-11 DATETIME ..................................2-11 DEC....................................2-14 iv IBM Informix Guide to SQL: Reference DECIMAL ..................................2-14 DISTINCT ..................................2-16 DOUBLE PRECISION ..............................2-17 FLOAT(n) ..................................2-17 IDSSECURITYLABEL ..............................2-17 INT....................................2-18 INT8 ....................................2-18 INTEGER ..................................2-18 INTERVAL ..................................2-18 LIST(e) ...................................2-20 LVARCHAR(m) ................................2-22 MONEY(p,s) .................................2-22 MULTISET(e) .................................2-23 Named ROW .................................2-24 NCHAR(n) ..................................2-24 NUMERIC(p,s) ................................2-24 NVARCHAR(m,r)................................2-24 OPAQUE ..................................2-25 REAL....................................2-25 ROW, Named .................................2-25 ROW, Unnamed ................................2-26 SERIAL(n) ..................................2-28 SERIAL8(n) ..................................2-29 SET(e) ...................................2-30 SMALLFLOAT.................................2-31 SMALLINT ..................................2-31 TEXT data type ................................2-32 Unnamed ROW ................................2-33 VARCHAR(m,r) ................................2-33 Built-In Data Types ................................2-35 Character Data Types ..............................2-35 Large-Object Data Types .............................2-37 Time Data Types ................................2-39 Extended Data Types ...............................2-43 Complex Data Types...............................2-44 Distinct Data Types ...............................2-46 Opaque Data Types ...............................2-46 Data Type Casting and Conversion ...........................2-47 Using Built-in Casts ...............................2-47 Using User-Defined Casts .............................2-49 Determining Which Cast to Apply ..........................2-50 Casts for Distinct Types..............................2-51 What Extended Data Types Can Be Cast? ........................2-51 Operator Precedence................................2-52 Chapter 3. Environment Variables ........................3-1 Types of Environment Variables ............................3-1 Limitations on Environment Variables ..........................3-2 Using Environment Variables on UNIX ..........................3-2 Where