
SQL Reference for Cross-Platform Development - Version 5 ii SQL Reference for Cross-Platform Development - Version 5 Contents Chapter 1. About this book ......1 CONNECT (Type 1) and CONNECT (Type 2) . 37 Who should read this book .........1 Remote unit of work ..........37 How to use this book ...........2 Application-directed distributed unit of work . 39 Assumptions relating to examples of SQL Data representation considerations......42 statements ..............2 How to read the syntax diagrams ......3 Chapter 3. Language elements ....43 Conventions used in this manual ......5 Characters ...............43 SQL accessibility ............5 Tokens ................44 Related documentation ..........6 Identifiers ...............46 What's new for this book ..........8 SQL identifiers ............46 Host identifiers ............46 Chapter 2. Concepts .........9 Naming conventions ...........47 Relational database ............9 SQL path ..............52 Structured query language..........9 Qualification of unqualified object names . 52 Static SQL ..............9 Aliases ................54 Dynamic SQL .............9 Authorization IDs and authorization names . 55 Interactive SQL ............10 Example ..............55 SQL call level interface and open database Data types...............56 connectivity .............10 Nulls ...............57 Java database connectivity and embedded SQL Numbers ..............57 for Java programs ...........10 Character strings ...........60 Schemas ...............11 Character encoding schemes........61 Tables ................11 Graphic strings ............62 Keys................11 Graphic encoding schemes ........63 Constraints .............12 Binary strings ............63 Indexes ...............15 Large objects .............63 Triggers ..............15 Datetime values ............65 Views ................17 XML Values .............69 User-defined types ............17 User-defined types ...........70 Aliases ................18 Promotion of data types ..........72 Packages and access plans .........18 Casting between data types .........74 Routines ...............18 Assignments and comparisons ........77 Functions ..............18 Numeric assignments ..........78 Procedures .............19 String assignments ...........80 Sequences ...............20 Datetime assignments ..........83 Authorization, privileges and object ownership . 21 XML assignments ...........84 || Row permissions and column masks .....23 Distinct type assignments.........84 Catalog ................24 || Array type assignments .........86 Application processes, concurrency, and recovery. 24 Assignments to LOB locators .......86 Locking, commit, and rollback .......24 Numeric comparisons ..........86 Unit of work .............25 String comparisons ...........87 Rolling back work ...........26 Datetime comparisons ..........89 Isolation level .............28 XML comparisons ...........89 Repeatable read ............29 Distinct type comparisons ........89 Read stability.............29 || Array type comparisons .........90 Cursor stability ............30 Rules for result data types .........91 Uncommitted read ...........30 Numeric operands ...........91 Comparison of isolation levels .......30 Character and graphic string operands ....92 Storage structures ............31 Binary string operands .........93 Character conversion ...........31 Datetime operands ...........93 Character sets and code pages .......34 Distinct type operands..........94 Coded character sets and CCSIDs ......35 XML operands ............94 Default CCSID ............35 Conversion rules for operations that combine strings 95 Distributed relational database ........36 Constants ...............97 Application servers ...........36 Integer constants ...........97 iii Decimal constants ...........97 Predicates ..............163 Floating-point constants .........97 Basic predicate ............164 Decimal floating-point constants ......98 Quantified predicate ..........166 Character-string constants ........98 BETWEEN predicate ..........168 Graphic-string constants .........99 EXISTS predicate ...........169 Datetime constants ...........99 IN predicate .............170 Decimal point ............100 LIKE predicate ............172 Special registers ............101 NULL predicate ...........177 CURRENT CLIENT_ACCTNG ......101 Search conditions ............178 CURRENT CLIENT_APPLNAME .....102 Examples..............178 CURRENT CLIENT_USERID .......102 CURRENT CLIENT_WRKSTNNAME ....102 || Chapter 4. Built-in global variables 181 CURRENT DATE ...........102 || CLIENT_IPADDR ............182 CURRENT DECFLOAT ROUNDING MODE 103 || PACKAGE_NAME ...........183 CURRENT DEGREE ..........104 || PACKAGE_SCHEMA ..........184 CURRENT PATH ...........104 || PACKAGE_VERSION ..........185 CURRENT SCHEMA ..........105 CURRENT SERVER ..........105 Chapter 5. Built-in functions .....187 CURRENT TIME ...........105 Aggregate functions ...........195 CURRENT TIMESTAMP ........106 || ARRAY_AGG ............196 CURRENT TIMEZONE .........106 AVG...............198 SESSION_USER ...........106 COUNT ..............200 USER ...............106 COUNT_BIG ............201 Column names .............108 || GROUPING .............202 Qualified column names.........108 MAX...............204 Correlation names ...........108 MIN...............205 Column name qualifiers to avoid ambiguity . 110 STDDEV ..............206 Column name qualifiers in correlated references 112 SUM...............207 Unqualified column names in correlated VARIANCE or VAR ..........208 references..............113 XMLAGG .............209 Variables ...............114 Scalar functions.............211 || Global variables ...........114 Example ..............211 References to host variables .......116 ABS...............212 Variables in dynamic SQL ........118 ACOS ...............213 References to LOB variables .......119 ADD_MONTHS ...........214 References to LOB locator variables .....119 ASCII ...............216 References to LOB file reference variables . 120 ASIN ...............217 References to XML variables .......120 ATAN...............218 Host structures ............121 ATANH..............219 Functions...............123 ATAN2..............220 Types of functions ...........123 BIGINT ..............221 Function invocation ..........124 BITAND, BITANDNOT, BITOR, BITXOR, and Function resolution ..........124 BITNOT ..............222 Determining the best fit .........126 BLOB ...............224 Best fit considerations .........128 || CARDINALITY ...........225 Expressions ..............130 CEILING ..............226 Without operators ...........130 CHAR...............227 With arithmetic operators ........131 CHARACTER_LENGTH ........233 With the concatenation operator ......134 CLOB ...............234 Scalar fullselect ............136 COALESCE .............236 Datetime operands and durations .....137 COMPARE_DECFLOAT .........237 Datetime arithmetic in SQL........138 CONCAT..............239 Precedence of operations ........142 CONTAINS .............240 || ARRAY constructor ..........144 COS...............243 || ARRAY element specification .......145 COSH ...............244 CASE expressions ...........146 DATE...............245 CAST specification ..........149 DAY...............247 OLAP specification ..........153 DAYNAME .............248 ROW CHANGE expression........157 DAYOFWEEK ............249 Sequence reference ..........158 DAYOFWEEK_ISO ..........250 XMLCAST specification .........162 iv SQL Reference for Cross-Platform Development - Version 5 DAYOFYEAR ............251 REAL ...............344 DAYS...............252 REPEAT ..............345 DBCLOB ..............253 REPLACE .............347 DECFLOAT .............255 RID...............349 DECIMAL or DEC ..........257 RIGHT ..............350 DECRYPT_BIT and DECRYPT_CHAR ....260 ROUND ..............352 DEGREES .............262 ROUND_TIMESTAMP .........354 DIFFERENCE ............263 || RPAD...............357 DIGITS ..............264 RTRIM ..............360 DOUBLE_PRECISION or DOUBLE .....265 SCORE ..............361 ENCRYPT .............267 SECOND ..............364 EXP...............270 SIGN ...............366 EXTRACT .............271 SIN................367 FLOAT ..............273 SINH ...............368 FLOOR ..............274 SMALLINT .............369 GENERATE_UNIQUE .........275 SOUNDEX .............370 GETHINT .............276 SPACE..............371 GRAPHIC .............277 SQRT...............372 HEX...............280 STRIP ...............373 HOUR...............281 SUBSTR ..............375 IDENTITY_VAL_LOCAL ........282 SUBSTRING.............378 INSERT ..............287 TAN...............380 INTEGER or INT ...........289 TANH...............381 JULIAN_DAY ............291 TIME ...............382 LAST_DAY .............292 TIMESTAMP ............383 LCASE ..............293 TIMESTAMP_FORMAT .........385 LEFT ...............294 TIMESTAMP_ISO ...........388 LENGTH ..............295 TIMESTAMPDIFF ...........389 LN................296 TOTALORDER ............392 LOCATE ..............297 TRANSLATE ............393 LOG10 ..............299 TRIM ...............395 LOWER ..............300 || TRIM_ARRAY ............397 || LPAD...............301 TRUNCATE or TRUNC .........398 LTRIM ..............304 TRUNC_TIMESTAMP .........400 MAX...............305 UCASE ..............401 || MAX_CARDINALITY .........306 UPPER ..............402 MICROSECOND ...........307 VALUE ..............403 MIDNIGHT_SECONDS .........308 VARCHAR .............404 MIN...............309 VARCHAR_FORMAT .........409 MINUTE ..............310 VARGRAPHIC
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1202 Page
-
File Size-