-- Created on 2020/12/15 22:39 by ID200
DECLARE
  TYPE USER_TYPE IS TABLE OF SYSES_USERID%ROWTYPE INDEX BY BINARY_INTEGER;
  V_USER USER_TYPE;
  CURSOR CURSOR_TEST IS
    SELECT * FROM SYSES_USERID;
  V_CURSOR CURSOR_TEST%ROWTYPE;
BEGIN
  FOR I IN 1 .. 4 LOOP
    SELECT * INTO V_USER(I) FROM SYSES_USERID WHERE USERID = TO_CHAR(I);
    DBMS_OUTPUT.PUT_LINE(V_USER(I).USERNAME);
  END LOOP;
  OPEN CURSOR_TEST;

  LOOP
    FETCH CURSOR_TEST
      INTO V_CURSOR;
    IF CURSOR_TEST%NOTFOUND THEN
      EXIT;
    END IF;
  dbms_output.put_line(V_CURSOR.USERID||'  '||V_CURSOR.USERNAME);
  END LOOP;
  CLOSE CURSOR_TEST;

END;
Last modification:December 15th, 2020 at 07:38 am
如果觉得我的文章对你有用,请随意赞赏