Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Improve query performance instead of aggregrate function

user12251389Aug 18 2017 — edited Aug 18 2017

I have query where i want to change the SALES_DATE to '01.01.2017' for the 1st record for a product. It means i want to get every unique product which is stored in PRODUCT_ID and check the first SALES_DATE on which the product is loaded and change this SALES_DATE to '01.01.2017'.

I have used the below query which is working but its hitting the performance it seems. So is there any other i can write the same logic and improves the performance?

UPDATE TEST_GROUP sd

set SALES_DATE = TO_DATE ('01.01.2017', 'dd.mm.yyyy')

where SALES_DATE =

( select min(SALES_DATE)

   from TEST_GROUP sd2

   where sd.PRODUCT_ID = sd2.PRODUCT_ID  

)

and sd.SALES_DATE <> TO_DATE ('01.01.2017', 'dd.mm.yyyy');

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 15 2017
Added on Aug 18 2017
28 comments
1,283 views