【发布时间】:2016-11-27 04:06:25
【问题描述】:
我正在尝试使用 oracle 创建一个过程,它应该可以正常工作,但我不断收到以下错误:
错误(1,30):PLS-00103:在预期以下情况之一时遇到符号“)”:当前删除之前存在
这是我的程序:
CREATE PROCEDURE ProductLineSale ()
BEGIN
ALTER TABLE Product_T ADD COLUMN SalePrice decimal(6,2);
UPDATE Product
SET SalePrice = .90 * ProductStandardPrice
WHERE ProductStandardPrice >= 400;
UPDATE Product
SET SalePrice = .85 * ProductStandardPrice
WHERE ProductStandardPrice < 400;
END
【问题讨论】:
-
我认为只有在实际存在参数时才能使用括号。删除
()。 -
我尝试删除括号并抛出此错误
Error(2,1): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: ( ; is with authid as cluster compress order using compiled wrapped external deterministic parallel_enable pipelined result_cache accessible -
您真正想要完成什么?在过程中添加列是相当奇怪的。这意味着该过程只能被成功调用一次——在那之后,它会因为 DDL 不再有效而失败。您正在尝试安装/更新应用程序,在这种情况下不应该是一个过程,或者您有一些想要重复运行的东西,在这种情况下您不会包含 DDL。
-
另外,PL/SQL 没有“ALTER”语句,“ALTER TABLE ... ADD”没有“COLUMN”关键字。
标签: sql oracle stored-procedures plsql