我在以下简单程序中遇到错误
Create or Replace PROCEDURE "My Procedure"
(
vendor_name in VARCHAR2
)
BEGIN
INSERT INTO cust_vendors_test (cust_vendor_name)
select pv.vendor_name from po_vendors@prod09 pv
END;
/
答案 0 :(得分:2)
在INSERT INTO ... SELECT
声明的末尾添加分号:
INSERT INTO cust_vendors_test (cust_vendor_name)
select pv.vendor_name from po_vendors@prod09 pv;
^
另外一些建议:
答案 1 :(得分:0)
Zunain,你得到的具体错误是什么?
如果不知道我们正在处理什么,我已经重新格式化,这是我的建议。
USE [MyDatabase]
GO
DROP PROCEDURE [Schema].[MyProcedure]
GO
CREATE PROCEDURE [Schema].[MyProcedure]
@vendor_name VARCHAR(100)
AS
BEGIN
INSERT INTO cust_vendors_test
(
cust_vendor_name
)
SELECT pv.vendor_name AS cust_vendor_name
FROM po_vendors@prod09 AS pv
END
答案 2 :(得分:0)
您可以在创建程序之前使用'exists' 即...
IF EXISTS( SELECT * FROM sys.objects WHERE NAME = "My Procedure") BEGIN DROP PROCEDURE "My Procedure" END;
Create PROCEDURE "My Procedure"
AS
INSERT INTO cust_vendors_test (cust_vendor_name) VALUES
(select pv.vendor_name from po_vendors@prod09 pv)
GO;