Sponsored Content
Top Forums Shell Programming and Scripting UNIX Solution - Calling SQL*Plus scripts Post 303005620 by uuuunnnn on Friday 20th of October 2017 08:53:17 AM
Old 10-20-2017
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:-

SQL*Plus Copy command - to copy objects from source to destination DB instance.
Export Import Utilities - to transfer data objects between databases.
SQL*loader - to load data from file to database.

My Reply - This is extraction requirement at client end. We developed bash script and SQL*Plus 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. SQL*loader 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

1. What are the results of sqlscript1? (assumption: it is a listing displayed in your sqlplus session)

2. How are the results created? (assumption: sqlscript1 is just a select statement that queries that huge table)

3. What will sqlscript2 do with the result it gets from sqlscript1? (assumption: sqlscript2 needs those results for a join to another table)

My Reply -

1. 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.

2. 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

Last edited by uuuunnnn; 10-20-2017 at 10:04 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Communitcating between UNIX and SQL Scripts

Hello all, With UNIX, they don't come any greener than me. Here's my question: I've written a UNIX script in which I execute SQL Scripts. In the last SQL Script, processing errors can occur that are not SQL problems and therefore the SQL script ends successfully. However, I want to be able... (0 Replies)
Discussion started by: andrewa1
0 Replies

2. Shell Programming and Scripting

Calling SQL scripts through Shell Script

Oracle and Scripting gurus, I need some help with this script... I am trying to add the query SELECT * FROM ALL_SYNONYMS WHERE SYNONYM_NAME = 'METADATA' in the current script.... Read the result set and look for the TABLE_NAME field. If the field is pointing to one table eg.... (18 Replies)
Discussion started by: madhunk
18 Replies

3. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

4. Shell Programming and Scripting

any possible solution on sql calling scripts

hi all, i have a function which will take i/p as a ddl sctipt as i/p and execute it, let function execute_sql { db_var="$1" v_cnt=`sqlplus -s XXXXX/XXXXX@aXXX << ENDSQL | sed -e "s/Connected\.//" -e "/^$/d" set pagesize 0 feedback off verify off heading off echo off serveroutput on size... (4 Replies)
Discussion started by: manas_ranjan
4 Replies

5. UNIX for Advanced & Expert Users

Calling unix script from sql or plsql

Hi Can anyone please let me know how to call unix scripts from sql or plsql ASAP. (2 Replies)
Discussion started by: ksailesh
2 Replies

6. Shell Programming and Scripting

Calling oracle package Unix from shell scripts.

Hi, Can anyone tell me how to call a oracle package from a Unix shell script? I want to pass some input parameters to package and it will return me the output which I want to use further in my shell script. I want to know the way to capture the output values in my shell script. Please send some... (1 Reply)
Discussion started by: anil029
1 Replies

7. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

8. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

9. Shell Programming and Scripting

Behavior of Unix in calling 2 scripts simultaneously

Hi, I wanted to know the exact behavior of the shell scripts in the below scenario. I have 2 scripts - a.ksh and b.ksh Both these scripts call a 3rd script xyz.ksh. What will happen if both a.ksh and b.ksh run at the same time? What will happen if a.ksh starts 2-3 seconds before b.ksh?... (3 Replies)
Discussion started by: aster007
3 Replies

10. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies
DBIx::Class::Manual::Glossary(3pm)			User Contributed Perl Documentation			DBIx::Class::Manual::Glossary(3pm)

NAME
DBIx::Class::Manual::Glossary - Clarification of terms used. INTRODUCTION
This document lists various terms used in DBIx::Class and attempts to explain them. DBIx::Class TERMS DB schema Refers to a single physical schema within an RDBMS. Synonymous with the terms 'database', for MySQL; and 'schema', for most other RDBMS(s). In other words, it's the 'xyz' _thing_ you're connecting to when using any of the following DSN(s): dbi:DriverName:xyz@hostname:port dbi:DriverName:database=xyz;host=hostname;port=port Inflation The act of turning database row data into objects in language-space. DBIx::Class result classes can be set up to inflate your data into perl objects which more usefully represent their contents. For example: DBIx::Class::InflateColumn::DateTime for datetime or timestamp column data. See also DBIx::Class::InflateColumn. Deflation The opposite of "Inflation". Existing perl objects that represent column values can be passed to DBIx::Class methods to store into the database. For example a DateTime object can be automatically deflated into a datetime string for insertion. See DBIx::Class::InflateColumn and other modules in that namespace. ORM Object-relational mapping, or Object-relationship modelling. Either way it's a method of mapping the contents of database tables (rows), to objects in programming-language-space. DBIx::Class is an ORM. Relationship In DBIx::Class a relationship defines the connection between exactly two tables. The relationship condition lists the columns in each table that contain the same values. It is used to output an SQL JOIN condition between the tables. Relationship bridge A relationship bridge, such as "many_to_many" defines an accessor to retrieve row contents across multiple relationships. The difference between a bridge and a relationship is, that the bridge cannot be used to "join" tables in a "search", instead its component relationships must be used. Schema A Schema object represents your entire table collection, plus the connection to the database. You can create one or more schema objects, connected to various databases, with various users, using the same set of table "Result class" definitions. At least one DBIx::Class::Schema class is needed per database. Result class A Result class defines both a source of data (usually one per table), and the methods that will be available in the "Row" objects created using that source. One Result class is needed per data source (table, view, query) used in your application, they should inherit from DBIx::Class::Core. ResultSource ResultSource objects represent the source of your data, these are sometimes (incorrectly) called table objects. ResultSources do not need to be directly created, a ResultSource instance is created for each "Result class" in your "Schema", by the proxied methods "table" and "add_columns". See also: "METHODS" in DBIx::Class::ResultSource ResultSet This is an object representing a set of conditions to filter data. It can either be an entire table, or the results of a query. The actual data is not held in the ResultSet, it is only a description of how to fetch the data. See also: "METHODS" in DBIx::Class::ResultSet Record See Row. Row Row objects contain your actual data. They are returned from ResultSet objects. Object See Row. join prefetch SQL TERMS
Join This is an SQL keyword, it is used to link multiple tables in one SQL statement. This enables us to fetch data from more than one table at once, or filter data based on content in another table, without having to issue multiple SQL queries. Normalisation A normalised database is a sane database. Each table contains only data belonging to one concept, related tables refer to the key field or fields of each other. Some links to webpages about normalisation can be found in DBIx::Class::Manual::FAQ. Related data In SQL, related data actually refers to data that are normalised into the same table. (Yes. DBIC does mis-use this term). perl v5.14.2 2010-09-13 DBIx::Class::Manual::Glossary(3pm)
All times are GMT -4. The time now is 08:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy