更改爲過程,在'PROCEDURE'獲取語法錯誤有什麼想法?SQL過程錯誤
CREATE PROCEDURE performance_Report
@startDate DATE,
@endDate DATE
AS
SELECT Salesrep.Name, SUM(OrderLine.Quantity) AS Total_Sold, SUM(OrderLine.UnitSellingPrice * Orderline.Quantity) AS Total_Value
FROM SalesRep, OrderLine, ShopOrder
WHERE ShopOrder.SalesRepID = SalesRep.SalesRepID
AND OrderLine.ShopOrderID = ShopOrder.ShopOrderID
AND ShopOrder.OrderDate BETWEEN @startDate AND endDate
GROUP BY SalesRep.SalesRepID, SalesRep.Name
ORDER BY Total_Value DESC;
這是什麼數據庫?如果它是SQL Server,則可能需要使用@startDate DATETIME而不是@startDate DATE。 – 2011-04-05 22:49:54
pgAdmin,即使沒有輸入參數,語法錯誤仍然存在。 – user195257 2011-04-05 22:52:11
該語法與PostgreSQL無關,即使您想用於該過程的語言也沒有。打開手冊並開始學習如何編寫PostgreSQL中的存儲過程(即函數)。 – 2011-04-06 05:38:42