ORACLE SQL:过程成功,出现编译错误

问题描述 投票:0回答:1

我正在尝试创建一个过程以从几个表中转出特定数据:

CREATE OR REPLACE PROCEDURE Lab9_View IS
--declare the variable
  o_Id orders.OrderID%type;
  o_date orders.orderdate%type;
  s_date orders.shippeddate%type;
  c_name customers.companyname%type;
  s_country orders.shippeddate%type;
  --define CURSOR for select
CURSOR Lab9_View IS
    SELECT OrderId, OrderDate, ShippedDate, CompanyName, ShipCountry
    FROM Orders JOIN Customers ON
        customers.customerid = orders.CustomerId WHERE ORDERDATE BETWEEN '2019-08-14' AND '2019-08-23';
        --exceution begin here
BEGIN
--heading line
        dbms_output.put_line(' Harry''s Lab9 - Orders by COuntry Aug. 14th-23rd ');
        dbms_output.put_line(' Order #' || '    '|| ' Order Date' || '    ' || 'Shipped Date' || "    " || 'Company Name' || '    ' || 'Ship Country');
       --execute the select
        OPEN Lab9_View;
--retrieve each row from result in loop
            LOOP
                FETCH Lab9_View into o_id, o_date, s_date, c_name, s_country;
       --end of result reach
                EXIT WHEN Lab9_View%notfound;
        --dump out data
                dbms_output.put_line(o_id || '   '|| o_date || '  ' || s_date || "   " || c_name || '   ' || s_country);
            END LOOP;
          --close cursor
        CLOSE Lab9_View;
END;

我不断收到此错误:

ORA-24344: success with compilation error
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200100", line 581
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200100", line 567
ORA-06512: at "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", line 2127


3.   o_Id orders.OrderID%type;
4.   o_date orders.orderdate%type;
5.   s_date orders.shippeddate%type;
6.   c_name customers.companyname%type;
7.   s_country orders.shippeddate%type;

我无法发现与教授的实验笔记不同的地方。谁能看到我的代码有问题吗?

谢谢

sql oracle stored-procedures view compiler-errors
1个回答
0
投票

在put_line命令中的两列之间,您使用双引号而不是单引号。

© www.soinside.com 2019 - 2024. All rights reserved.