Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将MS SQL函数转换为Oracle函数会引发错误_Oracle_Plsql - Fatal编程技术网

将MS SQL函数转换为Oracle函数会引发错误

将MS SQL函数转换为Oracle函数会引发错误,oracle,plsql,Oracle,Plsql,我试图将MS SQL函数转换为Oracle函数,但我遇到了错误,我无法理解是什么错误或如何修复它们 有人能帮忙吗 CREATE OR REPLACE FUNCTION ItemsSold ( p_PrdID nvarchar2(50), p_Cst nvarchar2(50) ) RETURN Number AS v_Price NUMBER(18,2); BEGIN SELECT (Min(s.Price)*i.Qty) AS MinP into v_Price F

我试图将MS SQL函数转换为Oracle函数,但我遇到了错误,我无法理解是什么错误或如何修复它们

有人能帮忙吗

CREATE OR REPLACE FUNCTION ItemsSold 
(
    p_PrdID nvarchar2(50),  
    p_Cst nvarchar2(50)
)
RETURN Number
AS
 v_Price NUMBER(18,2);
BEGIN

 SELECT (Min(s.Price)*i.Qty) AS MinP into v_Price
FROM            Customers AS c INNER JOIN
                         CustOrders AS o ON c.Name = o.Cust INNER JOIN
                         Sales AS i ON i.Order = o.Order INNER JOIN
                         Purchases AS s ON i.Item = s.Item
WHERE        i.Item = p_PrdID AND o.Cust = p_Cst
group by i.Qty)

    RETURN v_Price;



END;
错误

Error(4,23): PLS-00103: Encountered the symbol "(" when expecting one of the following:     := . ) , @ % default character The symbol ":=" was substituted for "(" to continue. 
Error(6,18): PLS-00103: Encountered the symbol "(" when expecting one of the following:     := . ) , @ % default character The symbol ":=" was substituted for "(" to continue. 
Error(17,29): PLS-00103: Encountered the symbol "INNER" when expecting one of the following:     , ; for group having intersect minus order start union where    connect 

开括号错误与变量声明有关——在PL/SQL中,不允许为变量分配大小(因此,让它们为NVARCHAR2,不能说NVARCHAR2(50))

第三个错误与表名别名的Oracle语法有关-Oracle将关键字用作列别名(可选),但不允许将其用于表名别名

删除变量和关键字的NVARCHAR2的大小规范,与别名c之前一样(在错误消息指示的行上),然后查看发生了什么


祝你好运

按i.Qty分组后没有分号)啊,错过了你看到的明显问题,哦,好吧,多眼睛是一个更好的解决方案。将在接下来的30分钟内进行测试,然后标记答案,这是为了回答,并将“按i.Qty分组”替换为“按i.Qty分组”