Home » SQL & PL/SQL » SQL & PL/SQL » PL/SQL compilation error
PL/SQL compilation error [message #2437] Tue, 16 July 2002 06:26 Go to next message
AC
Messages: 1
Registered: July 2002
Junior Member
Could someone browse my code to see what is causing this error? Any feedback will be much appreciated :-)
AC

SQL> @gwvkey_1.sql
DECLARE
*
ERROR at line 1:
ORA-06550: line 84, column 26:
PLS-00306: wrong number or types of arguments in call to 'DETAIL_CURSOR'
ORA-06550: line 84, column 7:
PL/SQL: Statement ignored
======================================
DECLARE

max_col_seq_no NUMBER (1);
------------------------------------------------
input_h_order_ind NUMBER (2);
input_h_title VARCHAR2 (30);
input_h_desc VARCHAR2 (100);
------------------------------------------------
input_d_data_title VARCHAR2 (30);
input_d_order_no NUMBER (3);
input_d_row_title VARCHAR2 (30);
------------------------------------------------
input_c_row_title VARCHAR2 (30);
input_c_col_seq_no NUMBER (1);
input_c_col_desc VARCHAR2 (100);
input_c_col_bold VARCHAR2 (1);
input_c_col_ital VARCHAR2 (1);
------------------------------------------------
no_header_cursor EXCEPTION;
no_detail_cursor EXCEPTION;
no_column_cursor EXCEPTION;
------------------------------------------------

CURSOR header_cursor IS
SELECT gwvkeyh_order_ind,
gwvkeyh_header_title,
gwvkeyh_header_desc
FROM gwvkeyh
WHERE SYSDATE BETWEEN gwvkeyh_from_date AND
gwvkeyh_to_date
ORDER BY gwvkeyh_order_ind ;

header_rec header_cursor%ROWTYPE;

CURSOR detail_cursor (header_rec IN
header_cursor%ROWTYPE) IS
SELECT gwvkeyd_data_title,
gwvkeyd_order_no,
gwvkeyd_row_title
FROM gwvkeyd
WHERE gwvkeyd_data_title =
header_rec.gwvkeyh_header_title
ORDER BY gwvkeyd_order_no;

detail_rec detail_cursor%ROWTYPE;

CURSOR column_cursor (detail_rec IN
detail_cursor%ROWTYPE) IS
SELECT gwvkeyc_row_title,
gwvkeyc_col_seq_no,
gwvkeyc_col_desc,
gwvkeyc_col_bold,
gwvkeyc_col_ital
FROM gwvkeyc
WHERE gwvkeyc_row_title =
detail_rec.gwvkeyd_row_title
ORDER BY gwvkeyc_col_seq_no ;

column_rec column_cursor%ROWTYPE;

---------------------------------------------------
-- PL/SQL BEGINS
---------------------------------------------------

BEGIN

FOR header_rec IN header_cursor LOOP

SELECT max(gwvkeyc_col_seq_no)
INTO max_col_seq_no
FROM gwvkeyc,
gwvkeyd,
gwvkeyh
WHERE gwvkeyc_row_title = gwvkeyd_row_title
AND gwvkeyd_data_title = gwvkeyh_header_title
AND gwvkeyd_data_title = header_rec.gwvkeyh_header_title
AND SYSDATE BETWEEN gwvkeyh_from_date AND gwvkeyh_to_date;

-- Display header description
DBMS_OUTPUT.PUT_LINE ('
Table Header reads: '|| header_rec.gwvkeyh_header_desc);

-- Display the maximum column sequence number. Is used for colspan.
DBMS_OUTPUT.PUT_LINE (' It is supposed to colspan this many times: ' || max_col_seq_no);

----- Opening detail_cursor WITHIN header_cursor

FOR detail_rec IN detail_cursor LOOP

---------- Opening column_cursor WITHIN detail_cursor

DBMS_OUTPUT.PUT_LINE ('Start of row
... ');

FOR column_rec IN column_cursor LOOP

DBMS_OUTPUT.PUT_LINE (' - '|| column_rec.gwvkeyc_col_desc ||' - ');

END LOOP; -- closing the FOR counter loop

------------------------------------------------------
END LOOP; --- closing the WHILE loop

DBMS_OUTPUT.PUT_LINE (' ...
End of row.');

------------------------------------------------------
DBMS_OUTPUT.PUT_LINE (' ...
End of Table ');

END LOOP; -- end of the FOR header_rec IN header_cursor LOOP

-------------------------------------------------------
EXCEPTION

WHEN no_header_cursor THEN
DBMS_OUTPUT.PUT_LINE ('No records in HEADER_cursor');

WHEN no_detail_cursor THEN
DBMS_OUTPUT.PUT_LINE ('No records in DETAIL_cursor');

WHEN no_column_cursor THEN
DBMS_OUTPUT.PUT_LINE ('No records in COLUMN_cursor');

END;
/
SET SERVEROUTPUT OFF
SPOOL OFF
[[End of file]]
Re: PL/SQL compilation error [message #2440 is a reply to message #2437] Tue, 16 July 2002 11:41 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
The detail_cursor cursor has a required parameter defined for it (basically the row from header_cursor). So, that parameter needs to be supplied. The error message accurately described the problem here.

FOR detail_rec IN detail_cursor(header_rec)


The same situation exists for detail and column - you will need to pass the detail row (detail_rec) into the column cursor.
Previous Topic: ORA-01402
Next Topic: err:Hostdef not found
Goto Forum:
  


Current Time: Fri Apr 26 19:11:22 CDT 2024