I have a trigger in Oracle SQL.
CREATE OR REPLACE TRIGGER test
BEFORE INSERT ON SomeTable
FOR EACH ROW
DECLARE str1 VARCHAR(30);
str2 VARCHAR(30);
BEGIN
-- some code
IF ( str1 <> str 2 ) THEN
DBMS_OUTPUT.PUT_LINE( ' if ' );
ELSE
DBMS_OUTPUT.PUT_LINE( ' else ' );
END IF;
END;
Now, this always goes to the else statement, even when the strings are definitely not equal. I tried to use != instead of <> with the same result. However, it works, in reverse, if I just use
IF ( str1 = str2 ) THEN ... ELSE ... END If;
So what is the right way to test for two strings not being equal to each other (in Oracle)?
str 2just a typo?