To all of you who replied to this thread at once.
Yoda
----
So it sounds like script1 and script2 are connecting to 2 different DB instances.
My Reply:- No they are running on same instance.
Since you are not allowed to create a table, writing to file, then in script2 reading each record in bash variables and using them in SQL*Plus is the only option that I can think of.
My Reply:- Yes it is and that's what we are using.
But if you are allowed to create tables, you can try one of below approaches:-
SQLPlus Copy command - to copy objects from source to destination DB instance.
Export Import Utilities - to transfer data objects between databases.
SQLloader - to load data from file to database.
My Reply - This is extraction requirement at client end. We developed bash script and SQLPlus script to get the data. We provide the scripts to the client and they run it in their environment and they send us the extracted files. We cannot use Export utilities since it is specific extraction of tables and with specific conditions applied on the tables. SQLloader is also out of scope considering our requirements.
----------------------
cero
----
Your requirement is a bit confusing for me. That's why I'd like to take one step back to evaluate possible solutions.
You say you need the results of sqlscript1 in sqlscript2.
In order to offer you good advice we need some more information. A starting point can be this questions, and based on the assumptions I mention below I'll propose a possible solution
-
What are the results of sqlscript1? (assumption: it is a listing displayed in your sqlplus session)
-
How are the results created? (assumption: sqlscript1 is just a select statement that queries that huge table)
-
What will sqlscript2 do with the result it gets from sqlscript1? (assumption: sqlscript2 needs those results for a join to another table)
My Reply -
-
We are trying to do Order to Cash Cycle extraction for Oracle e-Business R12 for client(s).
Orders --> Deliveries --> Invoices --> SLA --> GL
SLA = Subledger Accounting
Now I can get "Invoices --> SLA --> GL" extraction done in a reasonable time frame.
If I try to get "Orders --> Deliveries --> Invoices --> SLA --> GL" together, it will take a lot of time.
Hence I am trying to populate all master Ids/primary keys by running just "Invoices --> SLA --> GL" as part of 'sqlscript1' first in a table.
-
sqlscript2 then can use the table to get "Orders" & "Deliveries" separately.
Now the challenge is our team members are suggesting is there a way that we can avoid creating a table at client end from security point of view.
This the process we have right now.
Shell Script
--> Calling SQL * Plus Script for table extraction into files
--> Performing record count on each files.
Shell Script
--> sqlscript1 (which would populate a table which would contain all master ids Invoices --> SLA --> GL)
--> sqlscript2 (extraction can take place and we can use the table data from sqlscript1 to get the Sales Orders and Deliveries).
Is there any better approach by which we can avoid creating a table? That is also going to be very helpful.
Thanks