View Single Post
  #3  
Old 18th December 2016, 12:02
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,646
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
Cast

Hello,

Code:
CAST expression
With the CAST expression you can assign a type to a parameter.

Syntax

<cast expression>
    ::= CAST ( Parameter AS <parameter cast type> )

<parameter cast type>
    ::= INTEGER | REAL | DATE | TIMESTAMP | STRING | RAW
Semantics

The cast operator assigns the type <parameter cast type> to the <parameter>. The cast expression itself will also be of type <parameter cast type>.

Examples

The following CAST expression assigns the type integer to the parameter param.

CAST ( :param AS INTEGER )
The following CAST expression assigns the type raw to the parameter param.

CAST ( :param AS RAW )
Resolving type conflicts on parameters

The cast operator is used to properly type parameters in case of ambiguities or in case of possible type conflicts.

In the following example, both param1 and param2 cannot be typed, because each type is comparable to itself.

:param1 = :param2
This problem can be resolved using the CAST expression.

:param1 = CAST( :param2 AS STRING )
In the following example the first comparison types param as date, while the second comparison types it as real.

:param = hiredate  or  :param = 0
Using the CAST expression this can be resolved.

:param = hiredate  or  CAST( :param AS DATE ) = 0
Regards
__________________
//Bernd
Reply With Quote