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!

How do you incorporate a .SQL file in another script?

594752Aug 27 2007 — edited Aug 27 2007
I have a SELECT statement in a file that cannot be altered and must be run as it is sent to me. I am creating another table using this SELECT statement. I just want to run my own script which gets part of its content from the one sent me. That way, if the - you might call it 'sub script' changes, I won't have to change anything. It goes something like the following, though this is greatly changed and simplified.
But I want to read everything in the block from a separate file rather than have it copied and pasted every time as it is now. Thank you.

select e.emp_ID
,e.data1
,e.data2,
from empdata e
,(
/****************************************************************************
BEGINNING OF THE MAIN REPORT (this is pasted
from other suq-query at the present moment)
*****************************************************************************/
select distinct w.emp_ID, w.empwages
from wages w
/****************************************************************************
END OF THE MAIN QUERY
*****************************************************************************/
) main
WHERE
main.wages > 40
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2007
Added on Aug 27 2007
8 comments
239 views