Oracle 试图在UNIX变量中存储PL/SQL块的值
UNIX代码:Oracle 试图在UNIX变量中存储PL/SQL块的值,oracle,shell,unix,plsql,sh,Oracle,Shell,Unix,Plsql,Sh,UNIX代码: #!/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 ${logF
#!/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;
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;
如果某些值被隐藏,请忽略,因为我无法在此显示完整代码。您的代码中有一些错误:
- 对SQL*Plus使用
参数-S
- 在PL/SQL块的末尾放一个斜杠
- 将结尾的
放在第一列中GETCOUNT
DECLARE
i PLS_INTEGER;
BEGIN
SELECT COUNT(1)
INTO i
FROM dual;
IF (i > 0)
THEN
DBMS_OUTPUT.PUT_LINE(TO_CHAR(i));
END IF;
END;
/
-- ^^^ Slash!!!
test.sh:
foo=`sqlplus -S foo/bar@bla <<EOF | tee -a logfile
SET HEADING ON;
SET SERVEROUTPUT ON SIZE 10000;
SET ECHO OFF;
SET FEEDBACK OFF;
@test.sql;
EOF` # <-- First column!!!
echo $foo; # --> Prints "1"
foo=`sqlplus-sfoo/bar@bla
foo=`sqlplus -S foo/bar@bla <<EOF | tee -a logfile
SET HEADING ON;
SET SERVEROUTPUT ON SIZE 10000;
SET ECHO OFF;
SET FEEDBACK OFF;
@test.sql;
EOF` # <-- First column!!!
echo $foo; # --> Prints "1"