UGU Unix Guru Universe
For Unix Admins, By Unix Admins
Follow ugucom on Twitter      Search  in 
Home
BEGINNERS & USERS

Events

Internet
 
 Linux
BEGINNERS & USERS
Software
Linux Vendors
Usenet NewsGroups
Books & Publications
 
 Shop
Cool Admin Gifts!
Gadgets
T-Shirts
Books
 
 Unix Guru Universe
About
Add Link
Feedback
 
 
UGU: Unix Guru Universe - Unix Tip #4582- September 27, 2023 - Home : Help : Today's Tip
Unix Tip #4582- September 27, 2023

SHELL SCRIPTING A SQLPLUS SCRIPT



Here is a tip on how to run sqlplus scripts within a shell script.
It is an example of how to pass database values into shell variables
and to make shell scripts more dynamic. This maybe elementary to some
folks but hope it helps others.....Here is the syntax:

#!/bin/sh
dummyvar=`sqlplus -s username/password < set pagesize 0 feedback off ver off heading off echo off
select sysdate from dual;
exit;
end`
echo "system date is " $dummyvar
#end of shell script

This will retrieve the system date from Oracle but you get the idea
that you can expand the select script to get whatever you want from
the database and place it in a shell variable where you can make
decisions on it.


This tip generously supported by: riosm@abcbs.com



NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted by various unix admins around the globe. UGU suggest you read and test each tip in a non-volitile environment before placing into production.


LAST 5 TIPS
4581 - I SEE YOU WITH FUSER
4580 - GLOBAL SYSTEM PATH SETTINGS
4579 - KILLING ALL USER PROCESSES
4578 - NFS HANG FIX ON HP-UX
4577 - REGEXP MATCHING IN AWK


I want to SUBSCRIBE and get a UGU Tip everyday.
I want to UNSUBSCRIBE and NOT get a UGU Tip everyday.

If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
Email Address:

Yes, email me a Hot Unix Tip everday.

Enter Hot Unix Tip (optional):

Yes, I will support this tip

Captcha (not case sensitive):


Please enter the above letters:

 
Copyright 1994-2018 Unix Guru Universe