Re: most preferable SQL



Amritha.Datta@xxxxxxxxx wrote:
On Feb 8, 8:51 am, Amritha.Da...@xxxxxxxxx wrote:
Which is most preferable between the below SQLs? In terms of consuming
resources or fast execution.

1. Update Table1 set Reason = 'SX#' where
(Sex <> 'M' or
Sex <> 'F' or
trim(Sex) <> '') and
Key = inKey And
Sub_Key = inSubKey and
Reason is NULL;

2. Update Table1 set Reason = 'SX#' where
(Sex not in ( 'M', 'F','') and
Key = inKey And
Sub_Key = inSubKey and
Reason is NULL;

I am calling this SQL in the stored procedure. If there is another
better way of writing SQL for the above query, please let me know.

Thanks in advance.

Amrith


Sorry. If I use 'and' instead of 'or which query is efficient?

1. Update Table1 set Reason = 'SX#' where
(Sex <> 'M' and
Sex <> 'F' and
trim(Sex) <> '') and
Key = inKey And
Sub_Key = inSubKey and
Reason is NULL;

2. Update Table1 set Reason = 'SX#' where
Sex not in ( 'M', 'F','') and
Key = inKey And
Sub_Key = inSubKey and
Reason is NULL;

Thanks!

1. c.d.o.marketplace is not for technical questions. Please post at c.d.o.server.

2. No one can answer the question you asked: Try it!

But I must confess to fascination. What genders are there other than M, F, and what I presume you mean to be NULL (which you should state as such since Oracle is NOT SQL Server).
--
Daniel A. Morgan
University of Washington
damorgan@xxxxxxxxxxxxxxxx
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
.