好吧,我正在尝试在 PL/SQL 中运行此脚本。但是我经常遇到错误,我尝试用双引号替换单引号但没有用。
ACCEPT p_name PROMPT "Enter Customer Name: "
VARIABLE g_output VARCHAR2(200)
DECLARE
v_street VARCHAR2(30);
v_city VARCHAR2(20);
v_prov VARCHAR2(20);
v_postal VARCHAR2(10);
BEGIN
SELECT cstreet, ccity, cprov, cpostal
INTO v_address,v_city,v_state,v_zip
FROM customer
WHERE cname = "&p_name";
:g_output := "&p_name" || " " ||v_street || " " || v_city;
:g_output := :g_output " " || v_prov || " " || v_postal;
END;
/
PRINT g_output
错误:
Enter Customer Name: Ankur Kaushal
old 10: WHERE cname = "&p_name";
new 10: WHERE cname = "Ankur Kaushal";
old 11: :g_output := "&p_name" || " " ||v_street || " " || v_city;
new 11: :g_output := "Ankur Kaushal" || " " ||v_street || " " || v_city;
:g_output := :g_output " " || v_prov || " " || v_postal;
*
ERROR at line 12:
ORA-06550: line 12, column 27:
PLS-00103: Encountered the symbol " " when expecting one of the following:
. ( * @ % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between || indicator multiset member SUBMULTISET_
The symbol "." was substituted for " " to continue.
Input truncated to 14 characters
G_OUTPUT
--------------------------------------------------------------------------------
我在这里犯了什么错误?