get value of query sqlplus of bash script [message #690190] |
Sat, 16 November 2024 08:58 |
|
mmm286
Messages: 14 Registered: July 2014
|
Junior Member |
|
|
Hi,
I'm trying to get only value variable of query in sqlplus in a shell script. I do:
data=`sqlplus "user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=hosta)(Port=xxx))(CONNECT_DATA=(SID=sidddd)))" <<EOF
set wrap off
set head off
set feed off
set pages 0
set linesize 32767
set feedback off
set pagesize 200
set echo off
alter session set nls_date_format='DD-MON-RR HH24:MI:SS';
select count(*) from table;
exit;
EOF`
but I get:
SQL*Plus: Release 18.0.0.0.0 - Production on Sat Nov 16 13:54:00 2024 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Last Successful login time: Sat Nov 16 2024 13:46:30 +01:00 Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.24.0.0.0 SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2758 SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.24.0.0.0
I only want to get: 2758
Any help please?
Thanks
|
|
|
|
|
|
|