0

如何在 oracle 中查看以下代码的输出并调用它?

DECLARE
       c_id e.id%type;
       c_name e.name%type;
       CURSOR c_e is
          SELECT id, name FROM e;
    BEGIN
       OPEN c_e;
       LOOP
          FETCH c_e into c_id, c_name;
        dbms_output.put_line(c_id||' '||c_name);
         EXIT WHEN c_e%notfound;
      END LOOP;
      CLOSE c_e;
   END;
   /
4

1 回答 1

0

尝试

create or replace procedure test_out
begin
   DECLARE
       c_id e.id%type;
       c_name e.name%type;
       CURSOR c_e is
          SELECT id, name FROM e;
    BEGIN
       OPEN c_e;
       LOOP
          FETCH c_e into c_id, c_name;
          dbms_output.put_line(c_id||' '||c_name);
          EXIT WHEN c_e%notfound;
      END LOOP;
      CLOSE c_e;
   END;
end;
exec test_out;
于 2013-10-10T23:00:47.317 回答