一个ORACLE的SQL错误?
在过程里调用输入参数时,应该怎么用,如果参数是字符串类型的,像如下我写的过程,会报下面的错误,应该怎么改呢?
CREATE OR REPLACE Procedure update_product_price1 (
v_NAME In Varchar2(20),
p_factor In Number
) As
v_product_count Integer;
Begin
Select Count(1) Into v_product_count From products Where Name = v_NAME;
If v_product_count > 0 Then
Update products
Set price = price * p_factor
Where Name = v_NAME;
Commit;
End If;
Exception
When Others Then
dbms_output.put_line( '没有这个产品! ');
End update_product_price1;
/
--报的错:
LINE/COL ERROR
-------- ---------------------------------------------------------------------------------------------------------------------------
2/20 PLS-00103: 出现符号 "( "在需要下列之一时: := . ) , @ % default character 符号 ":= " 被替换为 "( " 后继续。
7/65 PLS-00103: 出现符号 "= "在需要下列之一时: . ( * @ % & = - + ; < / > at for in is mod not rem <an exponent (**)> <> or != or ~= > = <= <> and or like between group having intersect minus order start union where connect || 符号 ".在 "= " 继续之前已插入。
------解决方案--------------------把声明中“CREATE OR REPLACE Procedure update_product_price1 (
v_NAME In Varchar2(20),
p_factor In Number
) As”的“Varchar2(20)”改为Varchar2就应该对了,还有,这个“As”也应该改成“is”吧?不过好像“AS”“IS”都行。