There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer ipod itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound trojan upgrade usb virus vista vista 32-bit windows windows vista windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
SQL code Help in oracle


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
boot8077's Avatar
Junior Member with 3 posts.
 
Join Date: Aug 2003
13-Aug-2003, 01:09 PM #1
SQL code Help in oracle
I have the following code. Both 1 and 2 are basicly the same except that 2 has "UDA_4 = 'DJ' AND" in it. 1 will return data instantly and 2 takes 15 minutes. Does anyone know why the inclusion of "UDA_4 = 'DJ' AND" causes this code to take so much longer to execute.


1)

SELECT t1.unit_key, t1.parent_unit_key, t1.serial_number, t1.uda_4, t1.uda_9, t1.part_revision, t1.part_number,
t1.ship_account_key, t2.customer, t2.customer_Date from (select unit_key, parent_unit_key, serial_number, uda_4, uda_9,
part_revision, shipped_time, part_number, ship_account_key from unit where
(udt_0 > TO_DATE('1/1/1994 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM') AND
udt_0 <= TO_DATE('8/13/2002 10:07:44 AM','MM/DD/YYYY HH:MI:SS AM')) ) t1,
(select tt1.object_name, tt1.object_key, tt1.customer, tt1.customer_date from dc_ge_customerships tt1,
(select distinct object_key, max(creation_time) as MAX_TIME from dc_ge_customerships where Customer = '53146'
group by object_key) tt2 where tt1.creation_time = tt2.MAX_TIME and tt1.object_key = tt2.object_key and
tt1.returned = '0')t2 WHERE t1.unit_key = t2.object_key AND t1.serial_number = t2.object_name


2)

SELECT t1.unit_key, t1.parent_unit_key, t1.serial_number, t1.uda_4, t1.uda_9, t1.part_revision, t1.part_number,
t1.ship_account_key, t2.customer, t2.customer_Date from (select unit_key, parent_unit_key, serial_number, uda_4,
uda_9, part_revision, shipped_time, part_number, ship_account_key from unit where uda_4 = 'DJ' AND
(udt_0 > TO_DATE('1/1/1994 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM') AND
udt_0 <= TO_DATE('8/13/2002 10:09:23 AM','MM/DD/YYYY HH:MI:SS AM'))) t1,
(select tt1.object_name, tt1.object_key, tt1.customer, tt1.customer_date from
dc_ge_customerships tt1, (select distinct object_key, max(creation_time) as
MAX_TIME from dc_ge_customerships where Customer = '53146' group by object_key) tt2
where tt1.creation_time = tt2.MAX_TIME and tt1.object_key = tt2.object_key and tt1.returned = '0')t2
WHERE t1.unit_key = t2.object_key AND t1.serial_number = t2.object_name

Last edited by boot8077 : 13-Aug-2003 01:38 PM.
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
13-Aug-2003, 01:31 PM #2
uda_4 = 'DJ' AND AND
boot8077's Avatar
Junior Member with 3 posts.
 
Join Date: Aug 2003
13-Aug-2003, 01:38 PM #3
That was a mistake in posting this message
I mistakenly put the extra AND in when I was bolding the code that is not really there.
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
13-Aug-2003, 01:47 PM #4
OK...LOL

That is the only difference between these two statements is the additional condition?
boot8077's Avatar
Junior Member with 3 posts.
 
Join Date: Aug 2003
13-Aug-2003, 01:51 PM #5
Yes this is the only dfference
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
13-Aug-2003, 02:04 PM #6
Other than no bracketing around the extra condition I can't see anything.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:15 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.