I have a bash script running several sql files via sqlplus:
sqlplus $connectioninfo << end
start file1.sql
start file2.sql
start file3.sql $variable
quit
end
file3 has some PL/SQL:
BEGIN
DBMS_OUTPUT.PUT_LINE(&1);
END;
/
But it just prints the literal "&1"
instead of the value of $variable
. I have also tried the following in file3:
DEFINE var_a = &1;
BEGIN
DBMS_OUTPUT.PUT_LINE(var_a);
END;
/
and also the following:
DECLARE
var_b VARCHAR2(64) := &1;
BEGIN
DBMS_OUTPUT.PUT_LINE(var_b);
END;
/
and finally:
DEFINE var_a = &1;
DECLARE
var_b VARCHAR2(64) := var_a;
BEGIN
DBMS_OUTPUT.PUT_LINE(var_b);
END;
/
However, I am getting various errors or just the literal value '&1' for all of these.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…