Home » SQL & PL/SQL » SQL & PL/SQL » compare strings
compare strings [message #187824] Tue, 15 August 2006 18:09 Go to next message
Messages: 68
Registered: September 2004
Hello you all,

The code is not the actual code, I manipulated a little bit to make sense Smile

the columName I get as a parameter. In dbms_output I can see that they are equal, but still I get : this is to make sense.

Isn't it possible to compare strings like this?
Is there a method like equal in Java which I can use to compare strings?

v_string :=Substr (r1.column_name,-(length(ColumnName)-1),length(ColumnName));


If v_string = columnName
	returnColumnName := r1.column_name; 
        dbms_output.put_line('this is to make sense');
end if;


[Updated on: Tue, 15 August 2006 18:11]

Report message to a moderator

Re: compare strings [message #187831 is a reply to message #187824] Tue, 15 August 2006 21:38 Go to previous message
Messages: 3727
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Using your logic:
  1  select a, Substr (a,-(length(a)-1),length(a))
  2  from (
  3  select '123456789' a
  4  from dual
  5* )
SQL> /

A         SUBSTR(A,
--------- ---------
123456789 23456789

Get rid of the "-1".

Ross Leishman

Previous Topic: Matrix with dates/time
Next Topic: Data migration from One table to another
Goto Forum:

Current Time: Wed Aug 23 16:38:20 CDT 2017

Total time taken to generate the page: 0.01323 seconds