7.26 STRCMP

Use the @STRCMP function to compare two character columns or literal strings. Enclose literals within single quote marks.

@STRCMP returns the following:

  • –1 if the first string is less than the second.

  • 0 if the strings are equal.

  • 1 if the first string is greater than the second.

Trailing spaces are truncated before comparing the strings.

For this function, Oracle GoldenGate supports the use of an escape sequence to represent characters in a string column in Unicode or in the native character encoding of the Microsoft Windows, UNIX, and Linux operating systems.

This function does not support NCHAR or NVARCHAR data types.

Syntax

@STRCMP (string1, string2)
string1

The first column or literal string to be compared.

string2

The second column or literal string to be compared.

Example

The following example compares two literal strings and returns 1 because the first string is greater than the second one.

@STRCMP ('JOHNSON', 'JONES')