Re: most preferable SQL
- From: DA Morgan <damorgan@xxxxxxxxx>
- Date: Thu, 08 Feb 2007 08:20:13 -0800
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
.
- References:
- most preferable SQL
- From: Amritha . Datta
- Re: most preferable SQL
- From: Amritha . Datta
- most preferable SQL
- Prev by Date: Re: most preferable SQL
- Next by Date: attn: callie - genuinely enticing news - cemli teffa - (1/1)
- Previous by thread: Re: most preferable SQL
- Next by thread: attn: callie - genuinely enticing news - cemli teffa - (1/1)
- Index(es):