dbTalk Databases Forums  

most preferable SQL

comp.databases.oracle.marketplace comp.databases.oracle.marketplace


Discuss most preferable SQL in the comp.databases.oracle.marketplace forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Amritha.Datta@gmail.com
 
Posts: n/a

Default most preferable SQL - 02-08-2007 , 07:51 AM






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


Reply With Quote
  #2  
Old   
Amritha.Datta@gmail.com
 
Posts: n/a

Default Re: most preferable SQL - 02-08-2007 , 08:35 AM






On Feb 8, 8:51 am, Amritha.Da... (AT) gmail (DOT) com wrote:
Quote:
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!



Reply With Quote
  #3  
Old   
DA Morgan
 
Posts: n/a

Default Re: most preferable SQL - 02-08-2007 , 10:20 AM



Amritha.Datta (AT) gmail (DOT) com wrote:
Quote:
On Feb 8, 8:51 am, Amritha.Da... (AT) gmail (DOT) com 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@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.