Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Checking for NOT EQUAL TO (Strings) in PL/SQL

591586Aug 6 2007 — edited Aug 6 2007
I am trying to compare two strings in an IF statement, for NOT EQUAL TO.

IF (string1 <> string 2) THEN
... do specific task
END IF;

But this didn't work (there is no doubt about it, I tested it thoroughly and noticed that it didn't work).
Then I changed it to = with an ELSE condition as below, and my 'do specific task' executed.

IF (string 1 = string2) THEN
SELECT 1 INTO temp FROM DUAL; --unnecessary statement
ELSE
... do specific task
END IF;

What is the correct way of checking for NOT EQUAL TO?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2007
Added on Aug 6 2007
5 comments
19,045 views