oracle - 选择到Oracle中的临时表

标签 oracle plsql sqlplus

我正在尝试执行以下操作,

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

它给了我以下错误,
ERROR at line 1:
ORA-00905: missing keyword

在我的真实示例中,子查询(select * from student)更复杂。

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

最佳答案

那么也许你需要做这样的事情:

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;

关于oracle - 选择到Oracle中的临时表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28653276/

相关文章:

java - io错误:network adapter could not establish the connection

.net - OracleBulkCopy 与 SQL*Loader 性能对比

oracle - dbms_output 大小缓冲区溢出

oracle - MAP成员函数与Oracle中对象类型的成员函数有何不同

sql - 如何检查分配给 oracle 数据库中模式、角色的对象的权限(DDL、DML、DCL)?

oracle - 获取 SQL Plus 显示更详细的错误

java - Oracle 存储过程上的 Spring SimpleJdbcCall : Closed Connection accessing BLOB output parameter

mysql - 从oracle导出大数据

oracle - 如何在 SQLPlus 或 PL/SQL 中创建菜单

sql - oracle 行计数到 shell 脚本变量