Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

SQL Reference

Functions

Syntax

Example

 

SQL Reference

Joins

Nested Queries

Set Operations

ON CURSOR | INSTANCE

WITH Options

Commands

Functions

 

CAST

The CAST function converts expressions to a specified data type. Column formatting will be the default for the specified data type.

Due to conflicts in specifications, the main OmniAccess data types are not supported here. The $CONVERT function should be used for OmniAccess data types and for more specific functions.

CAST(PRODUCTS.CATEGORY AS CHARACTER(16))

 

Syntax

CAST(scalar_expression AS datatype[(n)])

scalar_expression
Required. The item that is to be cast. Column name.

AS
Required

datatype
Required. The supported SQL92 data type.

n
Length if applicable.

 

Example

select amount,
cast(orders.amount as DOUBLE PRECISION)
from orders where status='cncl'

select order_date,
cast(substring(order_date from 1 for 2) as INTEGER)
from orders
where status='back'

Top