Note that there are some explanatory texts on larger screens.

plurals
  1. POWierd PL SQL invalid cursor
    primarykey
    data
    text
    <p>When running the following code I get a ORA-01001: invalid cursor Not sure whats going on, I converted it to a procedure and it started happening;</p> <pre><code>CREATE OR REPLACE PROCEDURE p_student_from_class_list (p_stu_id IN NUMBER) IS --Declaring a variable -- v_date date; --Creating a Cursor to find data from using the p_stu_id paramenter-- CURSOR enrollments_cursor IS SELECT enrollment_date, stu_id, class_id, status FROM enrollments WHERE stu_id = p_stu_id; BEGIN /*Changing the date so the code looks for the classes for the student which was entered in the bind variable above for the last 10 years*/ v_date := add_months(SYSDATE, -120); FOR v_enrollment_record IN enrollments_cursor LOOP --Displays the student's enrollment date, class ID and Current Status for each class &gt;they taken in last 10 years,from the value which was entered in the bind variable-- IF v_enrollment_record.enrollment_date between v_date AND SYSDATE THEN DBMS_OUTPUT.PUT_LINE('Enrollment Date: ' ||v_enrollment_record.enrollment_date ||' Class ID: '||v_enrollment_record.class_id ||' Status: '||v_enrollment_record.status); END IF; END LOOP; --Closing the cursor -- CLOSE enrollments_cursor; --Application Express processes the statement-- COMMIT; --Telling Application Express the procedure has finished-- END p_student_from_class_list; --Anonymous Block to run the Procedure-- BEGIN p_student_from_class_list(--Student ID--); END; </code></pre> <p>as I said the code was working when it was got in a procedure but for some reason creating it as a procedure now gives this error. I have been racking my brain trying to work this out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload