PLSQL??????α?????4??????
???????????? ???????[ 2012/9/20 10:00:43 ] ????????
????????/?????α?????????SQL???α????????open????????????????????????for update????
??????????????????????У?OPEN c_cursor?????debug????????'--afater open'?????
????select * from v$lock where sid in (select distinct sid from v$session where username='PLSQL')????????м?????????????????PLSQL????????.??fetch??????У?Oracle????????????????????For update??????fetch????????????????session?и??2????????????.??????ο??????????blog http??//blog.csdn.net/kkdelta/article/details/7183981????????????.close cursor?????????for update?????????????????????
??????????????????DBMS_OUTPUT.PUT_LINE??DBMS_LOCK.SLEEP?????????????????????????????DBMS_OUTPUT.PUT_LINE????????洢????????????????????????????PL/SQL Developer?????debug?????????????????
??????sqlplus??????α?????????·????
????variable c refcursor;
????exec open :c for SELECT ISBN?? TITLE FROM BOOKS WHERE rownum < 5 FOR UPDATE;
????print c;
????rollback;
???????exec open ?????????????????????????????????????
????PLSQL?л??????????α????????????α????????α??????????????α?????????α?????????????????????????????????????洦?????????α??????????????????????????????????????????洦?????????????????????洦???????????????????????????????????
????????????α???????????????裺
????1?????????REF CURSOU??????????磺
????TYPE ref_cursor_type IS REF CURSOR;
????2?????????????????????α???????磺
????cv_ref REF_CURSOR_TYPE??
????3??????????????SQL????????
????OPEN cursor_variable_name
????FOR select_statement;
????????????α???????????????????
DECLARE
TYPE refcur_type IS REF CURSOR;
book_refcur refcur_type ;
v_isbn varchar2(100);
v_title varchar2(100);
BEGIN
OPEN book_refcur FOR
SELECT ISBN?? TITLE FROM BOOKS WHERE rownum<3;
FETCH book_refcur INTO v_isbn??v_title;
WHILE book_refcur%FOUND LOOP
DBMS_OUTPUT.PUT_LINE(v_isbn||': '||v_title);
FETCH book_refcur INTO v_isbn??v_title;
END LOOP;
CLOSE book_refcur;
-- open cursoe with another sql statement
DBMS_OUTPUT.PUT_LINE('------- open cursoe with another sql statement');
OPEN book_refcur FOR
SELECT ISBN?? category FROM BOOKS WHERE rownum<3;
FETCH book_refcur INTO v_isbn??v_title;
WHILE book_refcur%FOUND LOOP
DBMS_OUTPUT.PUT_LINE(v_isbn||': category is: '||v_title);
FETCH book_refcur INTO v_isbn??v_title;
END LOOP;
CLOSE book_refcur;
END;
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11