# 22. Virtuoso Functions Guide - equ

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
abs
atof
bit_and
bit_not
bit_or
bit_shift
bit_xor
ceiling
either
equ
exp
floor
isdouble
isfloat
isinteger
isnumeric
iszero
log
log10
lower
mod
power
randomize
rnd
sign
sqrt
trigonometric
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## equ

comparison functions
equ ( arg1 any, arg2 any);
gt (in arg1any, in arg2any);
gte (inarg1 any, inarg2 any);
lt (in arg1any, in arg2any);
lte (in arg1any, in arg2any);
neq (in arg1any, in arg2any);
Parameters
arg1, arg2 – integer, float, double precision, varchar or NULL.
Return Values

An integer value of 1 or 0 is returned.

Description

These functions return 1 if their first argument is less than (lt), less than or equivalent (lte), greater than (gt), greater than or equivalent (gte), equivalent (equ), or not equivalent (neq) to the second argument, respectively. If the arguments are not of the same type, then an appropriate type coercion is done for them before comparison.

These functions correspond to SQL query operators <, <=, >, >=, = and <> and are needed because the SQL syntax does not allow these operators to be used on the left side of FROM keyword in a SELECT statement.

Examples
Simple Example

    lt('pata','pato')  -> 1 (Yes, 'pata' is less than 'pato')
    gt('barbar','bar')  -> 1 (Yes, 'barbar' is greater than 'bar')
    equ(17,17)    -> 1 (seventeen is seventeen)
    equ(17,17.0)    -> 1 (regardless of number format)
    equ(atof('17.0'),17.0))  -> 1 (as it seems be)
    equ(atof('17.1'),17.1))  -> 0 (But not always! Beware!)
    gte(1234,NULL)    -> 0 (No, 1234 is not "greater"
            than or equal to NULL)
    lt(1234,NULL)    -> 1 (Instead, it is "less" than NULL)

See Also