Home » SQL & PL/SQL » SQL & PL/SQL » Basic Sql statement need advice on
Basic Sql statement need advice on [message #304743] Thu, 06 March 2008 08:11 Go to next message
californiagirl
Messages: 79
Registered: May 2007
Member
Hi all,

This sql statement is going into an autoaccounting rule in Oracle Apps. I just wanted to get a second opinion on it..to see if it was ok or can be better. I guess I am really concerned about the second like..let me know what you think.


select decode(ps.segment_value,:1,'PC',12) from apps.pa_segment_value_lookups ps 
where  ps.segment_value_lookup like
 'TNPRC%' or ps.segment_value_lookup
  like 'Tulake Natl Primative Rsch Center';

Re: Basic Sql statement need advice on [message #304745 is a reply to message #304743] Thu, 06 March 2008 08:16 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Since you have no wildcards in 'Tulake Natl Primative Rsch Center' there is no reason not to use a = in place of the second like.
Re: Basic Sql statement need advice on [message #304746 is a reply to message #304743] Thu, 06 March 2008 08:18 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Why did you use a LIKE operator in the second part? There is no wildcard in the value, so you can use =
It would (most probably) not make any difference at runtime, but you asked for a review.

Also, make sure that the possible return-values from your decode have the same data-type (now it's either the string 'PS' or the number 12)
Re: Basic Sql statement need advice on [message #304749 is a reply to message #304743] Thu, 06 March 2008 08:24 Go to previous message
californiagirl
Messages: 79
Registered: May 2007
Member
Thanks for all the advice, that's what I needed to know.

Californiagirl
Previous Topic: how to delete all data in all tables in one time ?!
Next Topic: Create a table for fields and record type
Goto Forum:
  


Current Time: Tue Feb 11 16:54:55 CST 2025