Home » SQL & PL/SQL » SQL & PL/SQL » PROCEDURE WITH CURSOR ERROR!
PROCEDURE WITH CURSOR ERROR! [message #114866] |
Wed, 06 April 2005 00:00  |
phyxsly
Messages: 8 Registered: April 2005
|
Junior Member |
|
|
I wanted to have a cursor in my procedure having results from different tables and different databases. I successfully created the query and compiled it using the procedure builder. However, when i was about to create it as stored procedure in iSQLplus, it displayed a warning. It says "Procedure created wuth compilation error." The first error is "PLS-00341: declaration of cursor 'SUBJ_CUR' is incomplete or malformed"
Here's a piece of my code:
--------------------------------
PROCEDURE assess(STUD_ID VARCHAR2, STUD_YEAR NUMBER, STUD_TYPE CHAR) IS
CURSOR subj_cur IS
SELECT e.student_id, s.subject_id, s.subj_code, s.subject_title, s.units, s.pay_units,
d.department_name, s.tuition_fee_type, s.lab_fee_type, f.year, f.amount
FROM regist.enrol e, regist.offering o, regist.subject s,
fee_details f, regist.student st, regist.department d
WHERE (e.student_id = STUD_ID) AND (e.offering_id = o.offering_id) AND
(o.subject_id = s.subject_id) AND (f.fee_no = s.tuition_fee_type) AND
(st.student_id=e.student_id) AND ((f.year = STUD_YEAR) OR (f.year=0)) AND
(s.department_id = d.department_id);
-----------------------------
regist and system are databases.
Can anyone tell me where did I go wrong?
I resorted though in creating views, however I still received an error. It says, "Insufficient privileges"
Help me please..... I really need it badly..
PS. I also uploaded the file i'm working at....
|
|
|
|
Re: PROCEDURE WITH CURSOR ERROR! [message #114892 is a reply to message #114870] |
Wed, 06 April 2005 02:40   |
phyxsly
Messages: 8 Registered: April 2005
|
Junior Member |
|
|
Thanks for the reply. regist and system are schemas, sorry for the error. It did compile successfully using procedure builder but not in SQL*plus.
The select statement in the cursor executed successfully. I just don;t know why I cannot create the procedure successfully. The errors in SQL*plus are:
------------------
LINE/COL ERROR
2/10 PLS-00341: declaration of cursor 'SUBJ_CUR' is incomplete or malf ormed
3/5 PL/SQL: SQL Statement ignored
6/51 PL/SQL: ORA-00942: table or view does not exist
11/20 PL/SQL: Item ignored
81/5 PL/SQL: SQL Statement ignored
81/25 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
84/5 PL/SQL: Statement ignored
84/26 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
88/5 PL/SQL: Statement ignored
88/8 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
93/5 PL/SQL: Statement ignored
93/8 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
98/5 PL/SQL: Statement ignored
98/8 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
LINE/COL ERROR
103/5 PL/SQL: Statement ignored
103/8 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
166/5 PL/SQL: Statement ignored
166/15 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
170/5 PL/SQL: Statement ignored
170/15 PLS-00320: the declaration of the type of this expression is inco mplete or malformed
----------------------------
The CREATE VIEW was my second option. But to no avail, it did not work as well. Here's the code...
--------------
CREATE VIEW assess_view AS select e.student_id, s.subj_code, s.subject_title, s.tuition_fee_type, s.lab_fee_type, f.amount from regist.enrol e, regist.offering o, regist.subject s, system.fee_details f where o.offering_id = e.offering_id AND s.subject_id = o.subject_id AND f.fee_no = s.tuition_fee_type;
-------------
The errors generated are:
-----------
ERROR at line 1:
ORA-01031: insufficient privileges
------------
I really don't know why PL/SQL can't accept my code. It's really giving me a pain in the head. I've been working with it for the past two days.
Hope you can help me with this.
Thank you very much.
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Wed May 28 03:13:51 CDT 2025
|