0
我嘗試將Oracle SELECT命令的輸出保存到bash變量中。 我試過以下行,但它沒有工作真的很好...如何將Oracle中的SELECT放入bash變量中?
ACCESS_SQL=`{
sqlplus << EOF
${USER}/${PASSWORD}@DB
set head off;
set feedback off;
set pagesize 5000;
set linesize 30000;
set serveroutput on;
DECLARE
data varchar(5000);
BEGIN
select ACCESS_ID, PROFILE_ID, START_DATE, END_DATE, PLATFORM, ACCESS_TYPE, PERM_FLAG, ACTIVE_FLAG into data from uam.access_list where USER_ID='${USER_ID}';
dbms_output.put_line(data);
END;
/
exit;
EOF
}`
錯誤陳述我得到的是:
SQL> SQL> SQL> SQL> SQL> SQL> 2 3 4 5 6 7 select ACCESS_ID, PROFILE_ID, START_DATE, END_DATE, PLATFORM, ACCESS_TYPE, PERM_FLAG, ACTIVE_FLAG into data from uam.access_list where USER_ID='PZ230';
*
ERROR at line 4:
ORA-06550: line 4, column 110:
PL/SQL: ORA-00947: not enough values
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
我在想,如果使用VARCHAR是正確的事做...
是否'ORA-00947:沒有足夠的價值'給你一個提示? – devnull