Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...............................................................................................................................6 1.1. General...........................................................................................................................................6 1.2. Reading this Guide.........................................................................................................................6 1.3. Definition of Terms........................................................................................................................6 1.4. Declaring Host Variables...............................................................................................................7 1.5. Declaring and Accessing Databases...............................................................................................7 1.6. Transactions....................................................................................................................................7 1.7. SQL Statements..............................................................................................................................8 1.8. Statement Handles..........................................................................................................................8 1.9. Dynamic SQL (DSQL)...................................................................................................................8 1.10. Error Handling..............................................................................................................................8 2. Using Databases..................................................................................................................................10 2.1. Declaring a Database....................................................................................................................10 2.1.1. Connection Strings................................................................................................................10 2.1.2. SET DATABASE.................................................................................................................10 2.1.3. SET NAMES........................................................................................................................11 2.2. Opening a Database......................................................................................................................11 2.2.1. CONNECT...........................................................................................................................11 2.3. Closing a Database.......................................................................................................................13 2.3.1. DISCONNECT.....................................................................................................................13 3. Using Transactions.............................................................................................................................14 3.1. Transaction Behaviour..................................................................................................................14 3.1.1. Access Mode.........................................................................................................................14 3.1.2. Lock Resolution....................................................................................................................14 3.1.3. Isolation Level......................................................................................................................14 3.2. Starting a Transaction...................................................................................................................15 3.2.1. SET TRANSACTION..........................................................................................................15 3.3. Saving Your Changes...................................................................................................................16 3.3.1. COMMIT..............................................................................................................................16 3.4. Discarding Your Changes.............................................................................................................16 3.4.1. ROLLBACK.........................................................................................................................16 4. Accessing the Data..............................................................................................................................18 4.1. Supported Data Types..................................................................................................................18 4.2. SQL Expressions..........................................................................................................................20 4.2.1. Precedence of Operators.......................................................................................................21 4.2.2. String Concatenation............................................................................................................21 4.2.3. Arithmetic Operators............................................................................................................21 4.2.4. Comparison Operators..........................................................................................................22 4.2.4.1. BETWEEN...................................................................................................................22 4.2.4.2. CONTAINING..............................................................................................................22 4.2.4.3. IN..................................................................................................................................23 4.2.4.4. LIKE..............................................................................................................................23 4.2.4.5. IS NULL........................................................................................................................23 4.2.4.6. STARTING WITH........................................................................................................24 4.2.4.7. ALL...............................................................................................................................24 4 Embedded SQL Guide for RM/Cobol 4.2.4.8. ANY or SOME.............................................................................................................24 4.2.4.9. EXISTS.........................................................................................................................24 4.2.4.10. SINGULAR.................................................................................................................25 4.2.5. Logical Operators.................................................................................................................25 4.2.6. NULLs in Expressions .........................................................................................................25 4.2.7. Computed Columns..............................................................................................................26 4.2.8. Built in Functions.................................................................................................................26 4.2.8.1. CAST............................................................................................................................27 4.2.8.2. EXTRACT....................................................................................................................27 4.2.8.3. SUBSTRING................................................................................................................28 4.2.8.4. UPPER..........................................................................................................................28 4.2.8.5. GEN_ID........................................................................................................................28 4.2.8.6. AVG..............................................................................................................................28 4.2.8.7. COUNT.........................................................................................................................28 4.2.8.8. MAX.............................................................................................................................29 4.2.8.9. MIN...............................................................................................................................29 4.2.8.10. SUM............................................................................................................................29 4.2.8.11. CASE..........................................................................................................................29 4.2.8.12. COALESCE................................................................................................................30 4.2.8.13. NULLIF.......................................................................................................................30 4.3. Retrieving Data.............................................................................................................................30 4.3.1. The SELECT statement........................................................................................................30 4.3.2. Named Transactions.............................................................................................................31
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages55 Page
-
File Size-