Home » SQL & PL/SQL » SQL & PL/SQL » compare strings
compare strings [message #187824] Tue, 15 August 2006 18:09 Go to next message
Jolanda
Messages: 68
Registered: September 2004
Member
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));

dbms_output.put_line(v_string);

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



Thanks...

[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
rleishman
Messages: 3724
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: DBMS_PROFILER Results
Next Topic: Very Large Table to add Index
Goto Forum:
  


Current Time: Sat Dec 03 08:09:40 CST 2016

Total time taken to generate the page: 0.27249 seconds