Home » SQL & PL/SQL » SQL & PL/SQL » Compare varchar2
Compare varchar2 [message #23467] Wed, 11 December 2002 11:14 Go to next message
Yelanda
Messages: 4
Registered: June 2002
Junior Member
Hello,
Is there a function in SQL that converts VARCHAR2 to NUMBER (not to_number)? I need to compare 2 VARCHAR2 values, and find out which one is > or < than another.
Like compare PEN and PENCIL.
IF string1 > string2 THEN
.....

Thanks.
Re: Compare varchar2 [message #23469 is a reply to message #23467] Wed, 11 December 2002 11:23 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You can just compare the strings as in your example:

if s1 > s2 then


You can also use the greatest/least functions with strings.

Read up on the string comparision rules in the docs.
Previous Topic: select non-alpha
Next Topic: Decode Function and Range Checking
Goto Forum:
  


Current Time: Wed May 15 18:23:40 CDT 2024