QUEL Reference Guide
1. Introduction
In This Guide
Audience
Conventions
Query Languages
System-specific Text
Embedded QUEL Examples
2. Introduction to QUEL
Interactive QUEL
Embedded QUEL
3. QUEL Data Types
Object Names
Access to Objects Created Through SQL
Comment Delimiters
Data Types
Character Data Types
Char Data Type
C Data Type
Varchar Data Type
Text Data Type
Numeric Data Types
Integer Data Types
Floating Point Data Types
Date Data Type
Absolute Date Input Formats
Absolute Time Input Formats
Combined Date and Time Input
Date Interval Formats
Time Interval Formats
Date and Time Display Formats
Money Data Type
Binary Data Types
Byte Data Type
Byte Varying Data Type
Storage Formats of Data Types
Literals
String Literals
Numeric Literals
Integer Literals
Floating Point Literals
QUEL Constants
Nulls
Nulls and Comparisons
Nulls and Aggregate Functions
Nulls and Integrity Constraints
4. Elements of QUEL Statements
Operators
Arithmetic
Comparison
Logical
Operations
String Concatenation
Assignment
Character String
Numeric
Date
Null
Arithmetic
Default Type Conversion
Arithmetic Errors
Arithmetic Operations on Dates
Functions
Scalar
Data Type Conversion Functions
Numeric
String
Date
Aggregate
Aggregate Functions Using the Where and By Clauses
Ifnull
Qualifications
Comparison Operators
Partial Match Specification
Is Null Comparison
Clauses
Logical Operators
General Qualification
5. Embedded QUEL
Conventions Used in This Chapter
General Syntax of EQUEL Statements
Basic Structure of EQUEL Programs
Host Language Variables
Variable Declaration
Dereferencing Column Names
Scope of Variables
Include Statement—Include External Files
Indicator Variables
Retrieving Data Using Null Indicators
Setting Values Using Null Indicators
Detecting String Truncation Using Indicator Variables
Variable Usage and Dynamic Operation of EQUEL Statements
Param Statements
Data Manipulation with Cursors
Example of Cursor Processing
Declaring a Cursor
How You Open and Close Cursors
Open Cursors and Transaction Processing
Retrieving the Data
Fetching Rows Inserted by Other Queries
Using Cursors to Update Data
Using Cursors to Delete Data
Summary of Cursor Positioning
Dynamically Specified Cursor Names
Cursors and Retrieve Loops Compared
Transactions
Transaction Statements
Defining Transactions
Committing Transactions
Aborting Transactions
Savepoints and Partial Transaction Aborts
Interrupt and Timeout Handling in Transactions
Deadlock: Detection, Avoidance, and Handling
Program Status Information
The Inquire_ingres Statement
The Dbmsinfo() Function
Runtime Error Processing
Retrieve Statement
Using the Retrieve Statement Without a Loop
How the Sort Clause Works
Other Data Manipulation Statements
Repeat Queries
6. QUEL and EQUEL Statements
QUEL Release
Statement Context
Ingres Forms Statements
Abort Statement—Undo an MQT
Context
Syntax
Description
Embedded Usage
Examples
Append Statement—Add a Table Row
Syntax
Description
Embedded Usage
Considerations
Examples
Begin Transaction Statement—Begin an MQT
Syntax
Description
Example
Call Statement—Call an Ingres Tool or the Operating System
Syntax
Description
Embedded Usage
Examples
Close Cursor Statement—Close an Open Cursor
Syntax
Description
Embedded Usage
Example
Copy Statement—Copy Data
Syntax
Description
Copy Statement Parameters
Unformatted Copying
Formatted Copying
Bulk Copying
Data File Format and Table Format
Column Formats for COPY
Character (Text) Formats
Counted Character Formats
Dummy Format
Binary Formats
COPY Format Details
Delimiters in the Data File
With Null Clause for COPY
Filename Specification
Windows File Types for COPY
VMS File Types for COPY
WITH Clause for COPY
On_error Option
Error_count Option
Log Option
Rollback Option
Row_estimate Option
Fillfactor, Minpages, and Maxpages Options
Leaffill and Nonleaffill Options
Allocation Option
Extend Option
Permissions
Locking
Restrictions and Considerations
Examples of the COPY Statement
Create Statement—Create a Table
Syntax
Description
Embedded Usage
Considerations
Examples
Declare Cursor Statement—Declare a Cursor
Syntax
Description
Embedded Usage
Considerations
Examples
Define Integrity Statement—Define Integrity Constraints
Syntax
Description
Embedded Usage
Examples
Define Permit Statement—Add Table Permissions
Syntax
Description
Example
Define View Statement—Define Virtual Tables
Syntax
Description
Considerations
Example
Delete Statement—Delete Rows
Syntax
Description
Embedded Usage
Considerations
Examples
Delete Cursor Statement—Delete Cursor Row
Syntax
Description
Embedded Usage
Considerations
Example
Destroy Statement—Destroy Tables, Views, Permissions, Integrities
Syntax
Description
Embedded Usage
Examples
Endretrieve Statement—Terminate a Retrieve Loop
Syntax
Description
Example
End Transaction Statement—Terminate an MQT
Syntax
Description
Considerations
Example
Exit Statement—Terminate Database Access
Syntax
Description
Considerations
Help Statement—Display Help
Syntax
Description
Wildcards and Help
Permissions
Examples
Include Statement—Include an External File
Syntax
Description
Examples
Index Statement—Index a Table
Syntax
Description
Embedded Usage
Considerations
Examples
Ingres Statement—Connect to a Database
Syntax
Description
Embedded Usage
Example
Inquire_ingres Statement—Get Diagnostic Information
Syntax
Description
Example
Modify Statement—Change Table or Index Properties
Syntax
Description
Storage Structure Specification
Modify...to Merge Option
Modify...to Relocate Option
Modify...to Reorganize Option
Modify...to Truncated Option
Modify...to Add_extend Option
With Clause Options
Embedded Usage
Permissions
Locking
Examples
Open Cursor Statement—Open a Cursor
Syntax
Description
Embedded Usage
Print Statement—Print Tables
Syntax
Description
Examples
Range Statement—Associate Range Variables with Tables
Syntax
Description
Considerations
Examples
Relocate Statement—Relocate Tables
Syntax
Description
Embedded Usage
Considerations
Example
Replace Statement—Replace Column Values
Syntax
Description
Embedded Usage
Considerations
Examples
Replace Cursor Statement—Update Column Values in a Table Row
Syntax
Description
Embedded Usage
Example
Retrieve Statement—Retrieve Table Rows
Syntax
Description
Retrievals in Embedded QUEL
Embedded Usage
Considerations
Examples
Retrieve Cursor Statement—Retrieve Data into Host Variables
Syntax
Description
Embedded Usage
Considerations
Examples
Save Statement—Save Table Until Date
Syntax
Description
Embedded Usage
Considerations
Examples
Savepoint Statement—Declare Marker in an MQT
Syntax
Description
Example
Set Statement—Set Session Options
Syntax
Description
Set Aggregate [no]project Option
Set Joinop [no]timeout Option
Set [no]journaling Option
Set Lockmode Option
Set [no]printqry Option
Set [no]qep Option
Set ret_into Option
Set [no]logging Option
Set [no]optimizeonly Option
Set [no]maxio Option
Set [no]maxrow Option
Set [no]maxquery Option
Session with on_error Option
Update_rowcount Option
Examples
Set_ingres Statement—Enable or Disable Runtime Attributes
Syntax
Description
A. Keywords
In This Appendix
Single Keywords
Double Keywords
ISO SQL
B. Terminal Monitor
Accessing the Terminal Monitor
Query Buffer
Terminal Monitor Commands
Messages and Prompts
Character Input and Output
Help
Branching
Restrictions
Terminal Monitor Macros
Basic Concepts
Defining Macros
Macro Evaluation
Quotes
Backslashes
More on Parameters
System Macros
Special Characters
Special {define} Processing
Parameter Prescan
Special Macros
C. Calling Ingres Tools from Embedded QUEL
Using the CALL Statement
Ingres Tools and Parameters
Report
Sreport
RBF
QBF
Vifred
ABF
QUEL
IQUEL
Ingmenu
System
Ingres 10S
System