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!

Query Another Table if Particular Table Does Not Exist

2836804Jan 21 2015 — edited Jan 22 2015

I'm a business user who creates a report of when 15 tables in a system are refreshed and send it out on a daily basis. One particular table is dropped and rebuilt completely, and due to datasize and indexing, paritioning, etc it takes several hours before I can access it in the morning, which is when my business users need it most. Essentially, what I'd like to do is to create a query that allows me to use the dual table instead of Table_XYZ when Table_XYZ is unavailable, as I just want to put in some default values into my report. If I can prepare this SQL correctly, it will allow me to use it in a scheduled Qlikview report so I no longer have to send daily e-mails with the status update.

The below is not meant to be read as being in SQL. I just included it to try to explain what I am trying to accomplish.

IF

     (     SELECT 'TABLE_XYZ' as TABLE_NAME, MAX(TIMESTAMP) AS TIMESTAMP

           FROM TABLE_XYZ )

     DOES NOT EXIST

THEN

     (SELECT 'TABLE_XYZ' as TABLE_NAME, '' AS TIMESTAMP

          FROM DUAL )

Any guidance would be appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2015
Added on Jan 21 2015
7 comments
1,709 views