我正在尝试做以下事情,

select * into temp from (select * from student);


它给了我以下错误,

ERROR at line 1:
ORA-00905: missing keyword


在我的真实示例中,子查询(从学生中选择*)更为复杂。

我想在存储过程中使用它,所以我不想创建表本身。我只是想通过使用临时表使代码更易读。

最佳答案

然后,也许您需要执行以下操作:

declare
   type t_temp_storage is table of student%rowtype;
   my_temp_storage t_temp_storage;
begin
   select * bulk collect into my_temp_storage from student;
   for i in 1..my_temp_storage.count
    loop
    dbms_output.put_line('here I am '||my_temp_storage(i).stuid);
   end loop;
 end;

09-30 15:25
查看更多