Get two variables from oracle in a single connection


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get two variables from oracle in a single connection
# 1  
Old 11-26-2008
Get two variables from oracle in a single connection

Hi all

In my script i am getting two variables year and month from oracle by making two connections. In the first connection i am getting varaibel year and again i am making another connection and getting month variable from oracle.
Is there any way i can get two field values from oracle and assign it to two variables in unix with a single connection.
# 2  
Old 11-26-2008
something like:

Code:
k=`sqlplus "select a,b from c"`
a=`echo ${k} | awk '{print $1;}'`
b=`echo ${k} | awk '{print $2;}'`

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

Internet connection single interface through vpn

Hi. Can you please help me with a routing problem? There are 2 networks: 192.168.10.0/24 (eth0) 192.168.11.0/24 (eth0:1) The default gateway is 192.168.10.1 iPv4 routing is already enabled and working. With vpnc I've built up an VPN connection and can access my home network... (0 Replies)
Discussion started by: tschmi
0 Replies

2. Shell Programming and Scripting

Oracle Database connection from UNIX

Hi I have a question regarding Oracle connection using the below code ${ORACLE_HOME}/bin/sqlplus -s $user/$pwd@$sid <<!EOF 1>> $v_log_dir/$v_job_log.out 2>> $v_log_dir/$v_job_log.err / prompt stored procedure beginning . . . exec xx_interface_pkg.pr_xx_clms_out($datayears,$keepmonths); ... (3 Replies)
Discussion started by: smilingraja
3 Replies

3. Programming

Help in pro*c for Oracle connection

hi, am making oracle connection through pro*c using the following command sample: exec sql connect username identified by password. but m getting the following errors frequently even though listener and db is running fine but some times code is working fine and not giving errors. ... (2 Replies)
Discussion started by: senkerth
2 Replies

4. Red Hat

How to Multiple internet connections manage into a single connection.

Dear all, Hope you are all fine & enjoying your good health. Look at this equation 1+1+1=3 So simple I just want to say that I have three internet connections of 1mb, 1mb & 1mb but I can use only 1mb connection at a time & other two connections are useless for me. But now I want to make all... (0 Replies)
Discussion started by: saqlain.bashir
0 Replies

5. IP Networking

Multiple wan connection on single PC

Hi All Is it possible to be connected to a corporate lan/wan through the on-baord nic, and also be connected to mobile wan through a tethered smartphone? Ideally I'd like to be able to use my own smartphone using a browser like chrome (private browsing) while still being able to use the... (3 Replies)
Discussion started by: huskie69
3 Replies

6. Shell Programming and Scripting

SQL query in a loop with single sqlplus connection

Hi, I'm trying to build a shell script that reads a set of accounts from a file. For each account I need to perform a set of sql queries. So I have a loop with a set of sqlplus connections to retrieved my data. Is it possible to have a single sqlplus connection before entering the loop and... (4 Replies)
Discussion started by: lsantacana
4 Replies

7. Shell Programming and Scripting

Oracle connection with UBUNTU

Hi all, Will I be able to connect to oracle using UBUNTU. If so, can any one provide me the steps. I want to try table archival and sql loader using control files. Please do help. Thanks, Raaga (1 Reply)
Discussion started by: Raaga
1 Replies

8. Shell Programming and Scripting

SSH Connection To Oracle

My problem is this....:eek: Platform=Sun Solaris UNIX / Oracle 10g 1) I'm trying to SSH from my local system A to remote system B 2) Once connected, I need to sudo to ID that has the ability to connect to the Oracle database 3) Then run a script that connects via sqlplus and... (2 Replies)
Discussion started by: khand67
2 Replies

9. Windows & DOS: Issues & Discussions

Oracle 9i ODBC connection

I am attempting to access an Oracle 9i database located on a Solaris server from an XP client. The server is running Oracle 9i9.2.0.1.0 and the XP is Oracle client 9i 9.2.0.1.0. When I start a listener on the server, the listener starts but I receive a message “The listener supports no services”. I... (3 Replies)
Discussion started by: jkuchar747
3 Replies

10. UNIX for Advanced & Expert Users

Unix + oracle connection

Requirements: Using a shell script I have to check the 4 values from a table in Oracle and then store the result as "Y" in a Unix variable if the values are desired and "N" if the values are not desired. Explanation: There is a table abc in oracle which has 4 fields. if all the four values... (2 Replies)
Discussion started by: decci_7
2 Replies
Login or Register to Ask a Question