UNIX Code:
#!/bin/sh
if [ $# -gt 0 ]
then
## Checking wheather or all the Server Objects are up and working
if [[ $1 = 'PreCheck' ]];then
COUNT_SERV=`${ORACLE_HOME}/bin/sqlplus ${dbConnect} <<GETCOUNT|tee -a ${logFile}
SET HEADING ON
SET SERVEROUTPUT ON SIZE 10000
SET ECHO OFF
SET FEEDBACK OFF
@PLSQLBLCK1.sql
GETCOUNT`
fi
fi
exit 0;
SQL Code:
DECLARE
COUNT_SERV INTEGER;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
SELECT COUNT (*) INTO COUNT_SERV FROM FT_LM_SERVERS WHERE STATE <> 'START';
IF COUNT_SERV > 0 THEN
DBMS_OUTPUT.PUT_LINE('******ERROR1: One or More BG Object is Down, please restart the BG to proceed ahead******');
END IF;
END;
I am trying to get the value of DBMS_OUTPUT.PUT_LINE stored in COUNT_SERV (of UNIX), so that I can use it accordingly ahead. However, if I execute the shell script, I am getting output as below in Log file:
SQL> SQL> SQL> SQL> SQL> SQL> SQL> 18 19 20
Please ignore if some values are hidden, as I can not reveal the full code here.