J J
J J

Reputation: 51

PL/SQL: Procedures Successful with compilation error

I am trying to create a procedure to dump out specific data from few tables:

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;

I keep on getting this error:

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;

I can't spot anything different from my professor's lab notes. Can anyone see anything wrong with my code?

Thank you

Upvotes: 0

Views: 1306

Answers (1)

pmdba
pmdba

Reputation: 7033

You have double quotes instead of single quotes between two of the columns in your put_line commands.

Upvotes: 2

Related Questions