About DB2 UDB for AS/400 SQL Reference
Concepts
Relational Database
Structured Query Language
Static SQL
Dynamic SQL
Extended Dynamic SQL
Interactive SQL
SQL Call Level Interface
Collections
Tables
Keys
Primary Keys and Unique Keys
Referential Integrity
Check Constraints
Triggers
Indexes
Views
Aliases
Packages and Access Plans
Procedures
Catalog
Application Processes, Concurrency, and Recovery
Threads
Isolation Level
Distributed Relational Database
Application Servers
CONNECT (Type 1) and CONNECT (Type 2)
Remote Unit of Work
Application-Directed Distributed Unit of Work
Data Representation Considerations
Character Conversion
Character Sets and Code Pages
Coded Character Sets and CCSIDs
Default CCSID
Sort Sequence
Authorization and Privileges
Storage Structures
Language Elements
Characters
Tokens
Identifiers
SQL Identifiers
System identifiers
Host Identifiers
Naming Conventions
Qualification of Unqualified Object Names
SQL Names and System Names: Special Considerations
Collections and the SQL Path
Aliases
Authorization IDs and Authorization-Names
Examples
Data Types
Binary Strings
Character Strings
Character Subtypes
Graphic Strings
Graphic Subtypes
Large Objects (LOBs)
Numbers
Datetime Values
DataLink Values
User-Defined Types
Promotion of Data Types
Casting Between Data Types
Assignments and Comparisons
Numeric Assignments
String Assignments
Datetime Assignments
DataLink Assignments
Distinct Type Assignments
Numeric Comparisons
String Comparisons
Conversion Rules for Comparison
Datetime Comparisons
Distinct Type Comparisons
Rules for Result Data Types
Binary String Operands
Character and Graphic String Operands
Numeric Operands
Datetime Operands
DATALINK Operands
DISTINCT Type Operands
Conversion Rules for Operations That Combine Strings
Constants
Integer Constants
Floating-Point Constants
Decimal Constants
Binary-String Constants
Character-String Constants
Graphic-String Constants
Decimal Point
Delimiters
Special Registers
CURRENT DATE or CURRENT_DATE
CURRENT PATH, CURRENT_PATH, or CURRENT FUNCTION PATH
CURRENT SERVER or CURRENT_SERVER
CURRENT TIME or CURRENT_TIME
CURRENT TIMESTAMP or CURRENT_TIMESTAMP
CURRENT TIMEZONE or CURRENT_TIMEZONE
USER
Column Names
Qualified Column Names
Correlation Names
Column Name Qualifiers to Avoid Ambiguity
Column Name Qualifiers in Correlated References
Unqualified Column Names
References to Host Variables
Example
Host Variables in Dynamic SQL
References to LOB Host Variables
References to LOB Locator Variables
References to LOB File Reference Variables
Host Structures in C, C++, COBOL, PL/I, and RPG
Host Structure Arrays in C, C++, COBOL, PL/I, and RPG
Functions
Types of Functions
Function Resolution
Method of Finding the Best Fit
Function Invocation
Expressions
Without Operators
With the Concatenation Operator
With Arithmetic Operators
Two Integer Operands
Integer and Decimal Operands
Two Decimal Operands
Decimal Arithmetic in SQL
Floating-Point Operands
User-Defined Types as Operands
Datetime Operands and Durations
Datetime Arithmetic in SQL
Precedence of Operations
CASE Expressions
CAST Specification
Predicates
Basic Predicate
Quantified Predicate
BETWEEN Predicate
EXISTS Predicate
IN Predicate
LIKE Predicate
NULL Predicate
Search Conditions
Examples
Built-In Functions
Column Functions
AVG
COUNT
COUNT_BIG
MAX
MIN
STDDEV
SUM
VARIANCE or VAR
Scalar Functions
ABS or ABSVAL
ACOS
ANTILOG
ASIN
ATAN
ATANH
BIGINT
BLOB
CEILING
CHAR
CHARACTER_LENGTH or CHAR_LENGTH
CLOB
COALESCE
CONCAT
COS
COSH
COT
CURDATE
CURTIME
DATE
DAY
DAYOFMONTH
DAYOFWEEK
DAYOFYEAR
DAYS
DBCLOB
DECIMAL
DEGREES
DIGITS
DLCOMMENT
DLLINKTYPE
DLURLCOMPLETE
DLURLPATH
DLURLPATHONLY
DLURLSCHEME
DLURLSERVER
DLVALUE
DOUBLE_PRECISION or DOUBLE
EXP
FLOAT
FLOOR
HASH
HEX
HOUR
IFNULL
INTEGER or INT
LAND
LEFT
LENGTH
LN
LNOT
LOCATE
LOG or LOG10
LOR
LOWER or LCASE
LTRIM
MAX
MICROSECOND
MIN
MINUTE
MOD
MONTH
NODENAME
NODENUMBER
NOW
NULLIF
PARTITION
POSITION or POSSTR
POWER
QUARTER
REAL
ROUND
RRN
RTRIM
SECOND
SIGN
SIN
SINH
SMALLINT
SQRT
STRIP
SUBSTRING or SUBSTR
TAN
TANH
TIME
TIMESTAMP
TRANSLATE
TRIM
TRUNCATE
UCASE or UPPER
VALUE
VARCHAR
VARGRAPHIC
WEEK
XOR
YEAR
ZONED
Queries
Authorization
subselect
select-clause
from-clause
where-clause
group-by-clause
having-clause
Examples of a subselect
fullselect
Examples of a fullselect
select-statement
common-table-expression
order-by-clause
update-clause
read-only-clause
optimize-clause
isolation-clause
Examples of a select-statement
Statements
How SQL Statements Are Invoked
Embedding a Statement in an Application Program
Dynamic Preparation and Execution
Static Invocation of a select-statement
Dynamic Invocation of a select-statement
Interactive Invocation
SQL Return Codes
SQLCODE
SQLSTATE
SQL Comments
Example
ALTER TABLE
Invocation
Authorization
Syntax
Description
ADD COLUMN
ALTER COLUMN
DROP COLUMN
ADD unique-constraint
ADD referential-constraint
ADD check-constraint
DROP
Notes
Cascaded Effects
Examples
BEGIN DECLARE SECTION
Invocation
Authorization
Syntax
Description
Examples
CALL
Invocation
Authorization
Syntax
Description
Notes
Example
CLOSE
Invocation
Authorization
Syntax
Description
Notes
Example
COMMENT ON
Invocation
Authorization
Syntax
Description
Examples
COMMIT
Invocation
Authorization
Syntax
Description
Notes
Example
CONNECT (Type 1)
Invocation
Authorization
Syntax
Description
Notes
Examples
CONNECT (Type 2)
Invocation
Authorization
Syntax
Description
Notes
Examples
CREATE ALIAS
Invocation
Authorization
Syntax
Description
Notes
Examples
CREATE COLLECTION
Invocation
Authorization
Syntax
Description
Notes
Example
CREATE DISTINCT TYPE
Invocation
Authorization
Syntax
Description
Notes
Examples
CREATE FUNCTION
Invocation
Notes
CREATE FUNCTION (Scalar)
Authorization
Syntax
Description
Notes
Notes for SQL Functions
Notes for External Functions
Example 1
Example 2
Example 3
CREATE FUNCTION (Sourced)
Authorization
Syntax
Description
Notes
Example 1
Example 2
CREATE INDEX
Invocation
Authorization
Syntax
Description
Notes
Examples
CREATE PROCEDURE
Invocation
Authorization
Syntax
Description
Notes
Notes for SQL Procedures
Notes for External Procedures
Notes for Java Procedures
Example
CREATE SCHEMA
Invocation
Authorization
Syntax
Description
Notes
Examples
CREATE TABLE
Invocation
Authorization
Syntax
Description
column-definition
unique-constraint
referential-constraint
check-constraint
nodegroup-clause
Notes
Rules for System Name Generation
Examples
CREATE VIEW
Invocation
Authorization
Syntax
Description
Notes
Examples
DECLARE CURSOR
Invocation
Authorization
Syntax
Description
Notes
Examples
DECLARE PROCEDURE
Invocation
Authorization
Syntax
Description
Notes
Example
DECLARE STATEMENT
Invocation
Authorization
Syntax
Description
Example
DECLARE VARIABLE
Invocation
Authorization
Syntax
Description
Notes
Example
DELETE
Invocation
Authorization
Syntax
Description
DELETE Rules
Notes
Examples
DESCRIBE
Invocation
Authorization
Syntax
Description
Notes
Example
DESCRIBE TABLE
Invocation
Authorization
Syntax
Description
Notes
Example
DISCONNECT
Invocation
Authorization
Syntax
Description
Notes
Examples
DROP
Invocation
Authorization
Syntax
Description
Examples
END DECLARE SECTION
Invocation
Authorization
Syntax
Description
Examples
EXECUTE
Invocation
Authorization
Syntax
Description
Parameter Marker Replacement
Example
EXECUTE IMMEDIATE
Invocation
Authorization
Syntax
Description
Note
Example
FETCH
Invocation
Authorization
Syntax
Description
single-fetch
multiple-row-fetch
Notes
Example
FREE LOCATOR
Invocation
Authorization
Syntax
Description
Example
GET DIAGNOSTICS
Invocation
Authorization
Syntax
Description
Example
GRANT (Function or Procedure Privileges)
Invocation
Authorization
Syntax
Description
Note
Example
GRANT (Package Privileges)
Invocation
Authorization
Syntax
Description
Note
Example
GRANT (Table Privileges)
Invocation
Authorization
Syntax
Description
Notes
Examples
GRANT (User-Defined Type Privileges)
Invocation
Authorization
Syntax
Description
Note
Example
INCLUDE
Invocation
Authorization
Syntax
Description
Notes
Example
INSERT
Invocation
Authorization
Syntax
Description
insert-multiple-rows
INSERT Rules
Notes
Examples
LABEL ON
Invocation
Authorization
Syntax
Description
Notes
Examples
LOCK TABLE
Invocation
Authorization
Syntax
Description
Example
OPEN
Invocation
Authorization
Syntax
Description
Parameter Marker Replacement
Notes
Examples
PREPARE
Invocation
Authorization
Syntax
Description
Notes
Examples
RELEASE
Invocation
Authorization
Syntax
Description
Notes
Examples
RENAME
Invocation
Authorization
Syntax
Description
Notes
Examples
REVOKE (Function or Procedure Privileges)
Invocation
Authorization
Syntax
Description
Notes
Example
REVOKE (Package Privileges)
Invocation
Authorization
Syntax
Description
Notes
Example
REVOKE (Table Privileges)
Invocation
Authorization
Syntax
Description
Notes
Examples
REVOKE (User-Defined Type Privileges)
Invocation
Authorization
Syntax
Description
Notes
Example
ROLLBACK
Invocation
Authorization
Syntax
Description
Notes
Example
SELECT INTO
Invocation
Authorization
Syntax
Description
Examples
SET CONNECTION
Invocation
Authorization
Syntax
Description
Notes
Example
SET OPTION
Invocation
Authorization
Syntax
Description
Notes
Examples
SET PATH
Invocation
Authorization
Syntax
Description
Notes
Example
SET RESULT SETS
Invocation
Authorization
Syntax
Description
Notes
Example
SET TRANSACTION
Invocation
Authorization
Syntax
Description
Notes
Examples
SET variable
Invocation
Authorization
Syntax
Description
Notes
Examples
UPDATE
Invocation
Authorization
Syntax
Description
UPDATE Rules
Notes
Examples
VALUES INTO
Invocation
Authorization
Syntax
Description
Notes
Examples
WHENEVER
Invocation
Authorization
Syntax
Description
Notes
Example
SQL Procedures and Functions
SQL routine body
Syntax
SQL procedure statement
Syntax
SQL control statements
Syntax
assignment-statement
Syntax
Description
Notes
Example
call-statement
Syntax
Description
Notes
Example
case-statement
Syntax
Description
Notes
Examples
compound-statement
Syntax
Description
Notes
Example
if-statement
Syntax
Description
Example
for-statement
Syntax
Description
Notes
Example
leave-statement
Syntax
Description
Notes
Example
loop-statement
Syntax
Description
Example
repeat-statement
Syntax
Description
Example
return-statement
Syntax
Description
Example
while-statement
Syntax
Description
Example
Appendix A. SQL Limits
Appendix B. SQL Communication Area
Field Descriptions
INCLUDE SQLCA Declarations
Appendix C. SQL Descriptor Area (SQLDA)
Field Descriptions
Field Descriptions in an Occurrence of SQLVAR
Determining How Many SQLVAR Occurrences are Needed
SQLTYPE and SQLLEN
SQLDATA or SQLNAME
Unrecognized and Unsupported SQLTYPES
INCLUDE SQLDA Declarations
For C and C++
For COBOL
For ILE COBOL
For PL/I
For ILE RPG/400
Appendix D. Reserved Words
Appendix E. CCSID Values
Appendix F. Considerations for Using Distributed Relational Database
CONNECT (Type 1) and CONNECT (Type 2) Differences
Determining the CONNECT rules that apply
Connecting to Application Servers That Only Support Remote Unit of Work
Appendix G. DB2 UDB for AS/400 Catalog Views
Notes
SQL_LANGUAGES
SYSCHKCST
SYSCOLUMNS
SYSCST
SYSCSTCOL
SYSCSTDEP
SYSFUNCS
SYSINDEXES
SYSKEYCST
SYSKEYS
SYSPACKAGE
SYSPARMS
SYSPROCS
SYSREFCST
SYSROUTINES
SYSTABLES
SYSTYPES
SYSVIEWDEP
SYSVIEWS
Bibliography
Index
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]