1
REFCURSOR를 받고 데이터 조작을 수행하는 함수를 실행하려고합니다.RefCursor를 함수에 전달할 때 커서가 유효하지 않습니다.
var some_cursor REFCURSOR;
exec :some_cursor := SCHEMA.test_getcursor;
print some_cursor;
variable res varchar2;
exec :res := SCHEMA.second_function(:some_cursor, 'Other_parameter');
print res;
지금, 처음 test_getcursor
기능, 커서를 엽니 다 간단한 함수 인 선택 쿼리를 수행하고 커서를 반환
some_cursor
도 잘 인쇄됩니다.
second_function
을 호출하고 refcursor를 전달하면 문제가 발생합니다.
type cursor_row
IS RECORD
(field_1 some_field1%type,
field_2 some_field2%type,
field_3 some_field3%type);
new_row cursor_row;
BEGIN
LOOP
fetch PASSED_IN_REFCURSOR INTO new_row --this is where the function fails
...data manipulation...
EXIT WHEN PASSED_IN_REFCURSOR%NOTFOUND;
END LOOP;
CLOSE PASSED_IN_REFCURSOR;
END;
내가 점점 오전 오류가 Invalid Cursor
입니다 :
기능은 다음과 같은 코드가 있습니다.
내가 만든 유형이 참조 커서와 동일한 수의 행과 데이터 유형을 가지고 있다고 확신합니다.
이 경우 내가 뭘 잘못하고 있니?
print some_cursor;
이 제거 : 나는, PL/SQL 10.2
함수와 저장 프로 시저의 사용에는 차이가 있습니까? 함수를 사용하고 똑같은 동작을하는 것처럼 보입니다.'Error report : Cursor is closed '라고 다시 돌아옵니다. – Victor