Sponsored Content
Top Forums Shell Programming and Scripting Multiple Query Results to Variables Post 302733435 by Yoda on Tuesday 20th of November 2012 01:27:07 PM
Old 11-20-2012
Here are other options which you can follow:-
Code:
1. Export (exp) & Import (imp) table from 1st DB to 2nd DB and join them to perform your task.
2. Spool all the values from table, use SQL Loader (sqlldr) to load them into a table in 2nd DB and join them to perform your task.

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Set shell variables from SQLPLUS query results

Hi All, I needed to get the result of two sqlplus queris into shell variables. After days of looking for the ultimate solution to this problem.. i found this... sqlplus -s USER/PASS@DB <<EOF | awk '{if(NR==1) printf("%s ", $1); if(NR==2) printf("%s ", $1);}' | read VAR1 VAR2 set head off... (2 Replies)
Discussion started by: pranavagarwal
2 Replies

2. Shell Programming and Scripting

Oracle Query results to be stored in variables

Hi I would like to know if there is a way to just have one ORACLE connection established, using which we can execute different queries and store the results under different variables. For e.g the following uses to two silent ORACLE connection to store the result under two different... (4 Replies)
Discussion started by: ashokjaysiv
4 Replies

3. Shell Programming and Scripting

Oracle Query results to be stored in variables using unix

I want to store the sql query output into a variable #!/bin/ksh ORACLE_SID=DB01; export ORACLE_SID; export FILE_PATH=/home/asg/Tmp # Order Checking echo " removing old files " rm $FILE_PATH/Malformed_Order.txt echo " Enter the Malformed Order ....!" read orders echo "Regrade... (5 Replies)
Discussion started by: Nareshp
5 Replies

4. UNIX for Dummies Questions & Answers

how to - redirect query results to a variable

How can I send the results of a query to a unix variable. I basically want to run a query then do some logic on the results. Trying to redirect the result into a variable I define in the script. select count(*) as counter from table - nut to redirect the "count" returned from the query... (2 Replies)
Discussion started by: rstone
2 Replies

5. Shell Programming and Scripting

SQL/Plus in a coprocess example. Also saves query results into shell variables

While assisting a forum member, I recommended running SQL/Plus in a coprocess (to make database connections and run a test script) for the duration of his script rather than starting/stopping it once for every row in a file he was processing. I recalled I made a coprocess example for folks at... (2 Replies)
Discussion started by: gary_w
2 Replies

6. Shell Programming and Scripting

How to store results of multiple sql queries in shell variables in ksh?

Hi, I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else. Thanks in advance.. Cheers (6 Replies)
Discussion started by: gonchusirsa
6 Replies

7. Shell Programming and Scripting

How to Assign SQL Query Results to Variables in Linux?

Hi, I am new to linux... How to Assign SQL Query Results to Variables in Linux,i want ti generate it in param files, Can anyone please explain me. Ex: SQL> Select * from EMP; O/P: Emp_No Emp_Name 1 AAA 2 BBB 3 CCC and I want expected... (5 Replies)
Discussion started by: Sravana Kumar
5 Replies

8. Shell Programming and Scripting

Mailing query results in tabular format

Hi , I am purging two tables based on date. In my script I am taking the count of the tables purging them and then taking the after counts. I need to mail the before and after counts of the two tables in a mail in table format as mentioned in the result section. For Eg: ## Count of the... (14 Replies)
Discussion started by: CFA
14 Replies

9. Shell Programming and Scripting

Assigning multiple column's value from Oracle query to multiple variables in UNIX

Hi All, I need to read values of 10 columns from oracle query and assign the same to 10 unix variables. The query will return only one record(row). I tried to append all these columns using a delimiter(;) in the select query and assign the same to a single variable(V) in unix. I thought I... (3 Replies)
Discussion started by: hkrishnan91
3 Replies

10. Shell Programming and Scripting

Postgre Query results as Email HTML table

Hello, I'm trying to send email from Greenplum query results as HTML table with status Red/Green Select Server, Last_Date from Table; Results Server, Last_Date Prod, 2018-04-09 Final email Output in HTML format Server Status LastDate Prod GREEN(BOX) 2018-04-09 (if... (2 Replies)
Discussion started by: krux_rap
2 Replies
join-dctrl(1)						      General Commands Manual						     join-dctrl(1)

NAME
join-dctrl - perform relational join on data in dctrl format SYNOPSIS
join-dctrl [ options ] filename filename join-dctrl --version join-dctrl --help DESCRIPTION
join-dctrl performs a relational join operation on data given to it in Debian control file format. A join field must be specified using either the switches -1 and -2 or the switch -j. Conceptually, the program creates all ordered pairs of records that can be formed by having a record from the first file as the first member of the pair and having a record from the second file as the second member of the pair; and then it deletes all such pairs where the join fields are not equal. Effectively, each of the input files is treated as a relational database table. Every input file must be in ascending order on its join field; this allows the program to work fast. The sort-dctrl(1) program can be used to make it so. OPTIONS
-1 field, --1st-join-field=field Specify the join field of the first input file. -2 field, --2nd-join-field=field Specify the join field of the second input file. -j field, --join-field=field Specify a common join field for all files. -a fileno, --unpairable-from=fileno Specify that unmatched paragraphs from the first (if 1 is given) or the second (if 2 is given) file are printed. -o fieldspec, --output-fields=fieldspec Specify which fields are included in the output. Fields are separated by commas (more than one -o option can be used, too). Each field is specified in the format fileno.field in which fileno is the ordinal number of the input file from which the field is drawn (either 1 or 2), and field gives the name of the field to use. As a special case, simple 0 can be used instead of fileno.field to refer to the common value of the join fields. The name of the field (not including the file number) is used in the output as the name of the field. However, a different name for output purposes can be specified by suffixing the field specification by a colon and the preferred visible name. For example, the option -o 0,1.Version:Old-Version,2.Version specifies that the first field in any output record should be the join field, the second field should be Old-Version drawing its data from the Version field of the first input file, and the third field should be Version drawing its data from the field with the same name in the second input file, and these are the only fields in an output record. If no -o option is given, all fields of all the records being joined are included in the output. -l level, --errorlevel=level Set log level to level. level is one of fatal, important, informational and debug, but the last may not be available, depending on the compile-time options. These categories are given here in order; every message that is emitted when fatal is in effect, will be emitted in the important error level, and so on. The default is important. -V, --version Print out version information. -C, --copying Print out the copyright license. This produces much output; be sure to redirect or pipe it somewhere (such as your favourite pager). -h, --help Print out a help summary. OPERANDS
join-dctrl will treat each file named on the command line as a relational database table. A file called - represents the program's stan- dard input stream. Currently, exactly two files must be named. STDIN
The standard input stream may be used as input as specified above in the OPERANDS section. INPUT FILES
All input to join-dctrl is in the format of a Debian control file. A Debian control (dctrl) file is a semistructured single-table database stored in a machine-parseable text file. Such a database consists of a set of records; each record is a mapping from field names to field content. Textually, records are separated by empty lines, while each field is encoded as one or more nonempty lines inside a record. A field starts with its name, followed by a colon, followed by the field content. The colon must reside on the first line of the field, and the first line must start with no whitespace. Subsequent lines, in contrast, always start with linear whitespace (one or more space or tab characters). Each input file must be in the ascending order of its join field. ENVIRONMENT VARIABLES
The standard locale environment, specifically its character set setting, affects the interpretation of input and output as character streams. ASYNCHRONOUS EVENTS
Standard UNIX signals have their usual meaning. STDOUT
All output is sent to the standard output stream. The output is in the format of a Debian control file, described above in the INPUT FILES section. The output will be in the ascending order of the join field, if that field is included in the output. OUTPUT FILES
There are no output files. EXIT STATUS
This utility exits with 0 when successful. It uses a nonzero exit code inconsistently when an error is noticed (this is a bug). CONSEQUENCES OF ERRORS
In case of errors in the input, the output will be partially or completely garbage. In case of errors in invocation, the program will refuse to function. EXAMPLES
Suppose that a file containing data about binary packages for the AMD64 architecture contained in the Debian squeeze (6.0) release, section main, is in the current directory and named Packages. Suppose that we are currently on a Debian system. Suppose further that the current directory does not contain files named stat and pkg. The following commands gives, for each package currently installed and available in Debian squeeze (6.0), its currently installed version (as Old-Version) and the version in squeeze (as New-Version): $ sort-dctrl -kPackage /var/lib/dpkg/status > stat $ sort-dctrl -kPackage Packages > pkg $ join-dctrl -j Package -o 0,1.Version:Old-Version,2.Version:New-Version stat pkg AUTHOR
The join-dctrl program and this manual page were written by Antti-Juhani Kaijanaho. SEE ALSO
grep-dctrl(1), sort-dctrl(1), tbl-dctrl(1) join-dctrl(1)
All times are GMT -4. The time now is 09:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy