Retrive sqldata through shell script



Normal
0
14
false
false
false
IT
X-NONE
X-NONE


/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabella normale”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:”Times New Roman”;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}

It could be useful get data from DB by a  bash script Linux.
Using a shell Bash is possible to create the following query:
dir_in=`sqlplus -s $PMS_CONN_STRING <<EOF
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF
select directory_path FROM all_directories WHERE directory_name = ‘GARBAGE_SFTP_AREA’;
exit
EOF
Analyze this script.
The query above, very simple, extracts a path from the system table all_directories where directory name is GARBAGE_SFTP_AREA.
At the beginning, dir_in = indicate the variable where we’ll put the result (the value of directory_path field).
With the symbol s `COMMAND`  bash execute the command between `  and replace it with his output.
The string called $PMS_CONN_STRING is a system variable that contains user/password@dbserver  that permits to connect to database.
The part with different set indicated :
SET PAGESIZE  0
— PAGESIZE = height 54 is 11 inches (0 will supress all headings and page brks)
 

SET FEEDBACK  OFF
-- FEEDBACK = ON will count rows returned

SET VERIFY    OFF
-- VERIFY = ON will show before and after substitution variables

SET HEADING   OFF
-- HEADING = OFF will hide column headings

SET ECHO      ON
-- ECHO = ON will Display the command on screen (+ spool)
-- ECHO = OFF will Display the command on screen but not in spool files.
-- Interactive commands are always echoed to screen/spool.

 
After these rows there is the sql instruction.
 
 

Potrebbero interessarti anche...