0
shell脚本,SQL文件,我已经开发了下面的代码从shell脚本调用SQL文件testshell.sh
调用从参数
#!/usr/bin/env ksh
feed=`sqlplus -s uname/pwd <<-EOF
@test.sql 'Test_VAl'
/
exit;
EOF`
echo $feed;
我的SQL文件是test.sql
其中包含以下内容:
Declare
attributeName varchar2(255):=&1;
BEGIN
DBMS_OUTPUT.put_line (attributeName);
END;
我在执行时遇到错误。
old 3: attributeName varchar2(255):=&1;
new 3: attributeName varchar2(255):=Test_VAl;
attributeName varchar2(255):=Test_VAl; test.sql testshell.sh
ERROR at line 3:
ORA-06550: line 3, column 31: PLS-00201: identifier 'TEST_VAL' must be declared
ORA-06550: line 3, column 16: PL/SQL: Item ignored
ORA-06550: line 5, column 25: PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 3: PL/SQL: Statement ignored
请告诉我如何解决此问题。
感谢亚历克斯。 这是问题所在。我在sqldeveloper中尝试了相同的代码,它工作正常,这让我相信sql部分是正确的。 –