QUEL Reference Guide
Introduction
In This Guide
Audience
Conventions
Query Languages
System-specific Text
Embedded QUEL Examples
Introduction to QUEL
Interactive QUEL
Embedded QUEL
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
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
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
QUEL and EQUEL Statements
QUEL Release
Statement Context
Ingres Forms Statements
ABORT--Undo an MQT
Embedded Usage
ABORT Examples
APPEND--Add a Table Row
Embedded Usage
Considerations
APPEND Examples
BEGIN TRANSACTION--Begin an MQT
BEGIN TRANSACTION Example
CALL--Call an Ingres Tool or the Operating System
Embedded Usage
CALL Examples
CLOSE CURSOR--Close an Open Cursor
Embedded Usage
CLOSE CURSOR Example
COPY--Copy Data
COPY 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
Permissions
Locking
Restrictions and Considerations
COPY Examples
CREATE--Create a Table
Embedded Usage
Considerations
CREATE Examples
DECLARE CURSOR--Declare a Cursor
Embedded Usage
Considerations
DECLARE CURSOR Examples
DEFINE INTEGRITY--Define Integrity Constraints
Embedded Usage
DEFINE INTEGRITY Examples
DEFINE PERMIT--Add Table Permissions
DEFINE PERMIT Example
DEFINE VIEW--Define Virtual Tables
Considerations
DEFINE VIEW Example
DELETE--Delete Rows
Embedded Usage
Considerations
DELETE Examples
DELETE CURSOR--Delete Cursor Row
Embedded Usage
Considerations
DELETE CURSOR Example
DESTROY--Destroy Tables, Views, Permissions, Integrities
Embedded Usage
DESTROY Examples
ENDRETRIEVE--Terminate a Retrieve Loop
ENDRETRIEVE Example
END TRANSACTION--Terminate an MQT
Considerations
END TRANSACTION Example
EXIT--Terminate Database Access
Considerations
HELP--Display Help
Wildcards and Help
Permissions
HELP Examples
INCLUDE--Include an External File
INCLUDE Examples
INDEX--Index a Table
Embedded Usage
Considerations
INDEX Examples
INGRES--Connect to a Database
Embedded Usage
INGRES Example
INQUIRE_INGRES--Get Diagnostic Information
INQUIRE_INGRES Example
MODIFY--Change Table or Index Properties
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
MODIFY Examples
OPEN CURSOR--Open a Cursor
Embedded Usage
PRINT--Print Tables
PRINT Examples
RANGE--Associate Range Variables with Tables
Considerations
RANGE Examples
RELOCATE--Relocate Tables
Embedded Usage
Considerations
RELOCATE Example
REPLACE--Replace Column Values
Embedded Usage
Considerations
REPLACE Examples
REPLACE CURSOR--Update Column Values in a Table Row
Embedded Usage
REPLACE CURSOR Example
RETRIEVE--Retrieve Table Rows
Retrievals in Embedded QUEL
Embedded Usage
Considerations
RETRIEVE Examples
RETRIEVE CURSOR--Retrieve Data into Host Variables
Embedded Usage
Considerations
RETRIEVE CURSOR Examples
SAVE--Save Table Until Date
Embedded Usage
Considerations
SAVE Examples
SAVEPOINT--Declare Marker in an MQT
SAVEPOINT Example
SET--Set Session Options
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
SET Examples
SET_INGRES--Enable or Disable Runtime Attributes
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
QUEL Reference Guide
System