我的 shell 脚本中的 pl/sql 块有这个问题。这是脚本 PL/SQL BLOCK:
$ORACLE_HOME/bin/sqlplus -s system/${SysPwd}@${SList} <<!
--WHENEVER SQLERROR EXIT FAILURE;
SET SERVEROUTPUT ON SIZE UNLIMITED;
SET FEEDBACK OFF;
SET DEFINE OFF;
spool ${RESULT} append
DECLARE
TABLE_MISSING EXCEPTION;
PRAGMA EXCEPTION_INIT(TABLE_MISSING,-6550);
err_num NUMBER;
err_msg VARCHAR2(100);
cnt number;
sql_stmt varchar2(2000);
v_user varchar2(100) := '${User}';
p_username varchar2(100);
p_fullname varchar2(100);
p_account_state char(2);
BEGIN
select count(*) into cnt from users where upper(full_name) like '%${PaceUser}%';
if cnt <> 0 then
select rtrim(username),rtrim(full_name),account_state into p_username,p_fullname,p_account_state from users where upper(full_name) like '%${User}';
dbms_output.put_line('User ${User} exist in the database ${SList}.....');
end if;
EXCEPTION
when NO_DATA_FOUND then
NULL;
WHEN TABLE_MISSING
THEN
NULL;
WHEN OTHERS THEN
NULL;
END;
/
和错误:
ERROR:
select count(*) into cnt from users where upper(full_name) like '%TYLER MACHUTCHON%';
*
ERROR at line 16:
ORA-06550: line 16, column 48:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 16, column 3:
PL/SQL: SQL Statement ignored
ORA-06550: line 18, column 120:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 18, column 3:
PL/SQL: SQL Statement ignored
有什么想法或建议吗?