Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6175209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:53:07+00:00 2026-05-23T23:53:07+00:00

I recently had to move my database from SQL Studio over to Oracle and

  • 0

I recently had to move my database from SQL Studio over to Oracle and I am learning about all the different syntaxes that must be used.

Anyways, I have run into a problem today where a query I am trying to execute runs forever (> 15 min) and never seems to finish.

As you can see I use the With statement to create 2 temp. tables from which I run my query. If I query either of these tables individually, I get results in < 2 seconds. As soon as I add the other table in the From statement it doesn’t seem to do anything.

This query works fine:

With Laser as
(
SELECT Data.Serial_Number, Equipment.Equipment_Desc, Data.SCAN_TIME,
       ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                              ORDER BY Equipment.Equipment_SN) AS RN
FROM Data, Equipment
where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%laser Etch%'
)

,AssyQC AS
(
SELECT Data.Serial_Number, Equipment.Equipment_Desc,Data.SCAN_TIME,
       ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                              ORDER BY Equipment.Equipment_SN) AS RN
FROM Data, Equipment
where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%QSMC SI%'
)

select to_char(Laser.SCAN_TIME, 'mm') as "Laser Month", to_char(Laser.SCAN_TIME, 'dd') as "Laser Day"

from Laser
;

Now, if I add the other table to the From statement, even though I don’t use it anywhere else (select, where, etc.) the query doesn’t do anything. It runs and runs and runs…

With Laser as
(
SELECT Data.Serial_Number, Equipment.Equipment_Desc, Data.SCAN_TIME,
       ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                              ORDER BY Equipment.Equipment_SN) AS RN
FROM Data, Equipment
where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%laser Etch%'
)

,AssyQC AS
(
SELECT Data.Serial_Number, Equipment.Equipment_Desc,Data.SCAN_TIME,
       ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                              ORDER BY Equipment.Equipment_SN) AS RN
FROM Data, Equipment
where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%QSMC SI%'
)

select to_char(Laser.SCAN_TIME, 'mm') as "Laser Month", to_char(Laser.SCAN_TIME, 'dd') as "Laser Day"

from Laser, AssyQC
;

This query worked fine in SQL Studio.

Any ideas??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:53:08+00:00Added an answer on May 23, 2026 at 11:53 pm

    Without any columns from AssyQC in the final select, I don’t see why you’re including it at all, but assuming you’re just not including them in this example, try joining the tables:

    With Laser as
    (
    SELECT Data.Serial_Number, Equipment.Equipment_Desc, Data.SCAN_TIME,
           ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                                  ORDER BY Equipment.Equipment_SN) AS RN
    FROM Data, Equipment
    where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%laser Etch%'
    )
    
    ,AssyQC AS
    (
    SELECT Data.Serial_Number, Equipment.Equipment_Desc,Data.SCAN_TIME,
           ROW_NUMBER() OVER (PARTITION BY Data.Serial_Number, Equipment.Equipment_SN 
                                  ORDER BY Equipment.Equipment_SN) AS RN
    FROM Data, Equipment
    where Data.Equipment_Station = Equipment.Equipment_SN and Equipment.Equipment_Desc like '%QSMC SI%'
    )
    
    select to_char(Laser.SCAN_TIME, 'mm') as "Laser Month", to_char(Laser.SCAN_TIME, 'dd') as "Laser Day"
    
    from Laser, AssyQC
    where
        Laser.Serial_Number = AssyQC.Serial_Number
    ;
    

    When you have multiple tables in your from clause without joining them, you’re doing an implicit cross join which, if your result sets are large, can cause the query to run a long time; from wikipedia:

    In other words, it will produce rows which combine each row from the first table with each row from the second table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We recently moved our database from our SQL Server 2005 server to our SQL
I have recently had to move my project from using the CPython 2.6 interpreter
I recently had cause to work with some Visual Studio C++ projects with the
This task has already been asked/answered, but I recently had a job interview that
We recently had a web app that went out to site acceptance testing where
I recently had to re-factor some code from a previous maintainer and initially I
I usually use Netbeans for PHP development, but have recently had to move to
Okay, so I've had this code that used to work just fine. I recently
Recently I've been trying to restructure an old database that was not designed with
My studio has a large codebase that has been developed over 10+ years. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.