pl/sql中怎么建临时表

adhere 2004-08-09 11:49:14
在pl/sql中怎么建临时表?急.
create temp table student(name varchar2(20));
编译通不过
提示错误信息是PLS-00103,create找不到.
...全文
442 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wylwyl1130 2004-08-09
  • 打赏
  • 举报
回复
EXECUTE IMMEDIATE 'create global temporary table student(name varchar2(20))';
freddy2003 2004-08-09
  • 打赏
  • 举报
回复
SQL> create global temporary table student(name varchar2(20));

表被创建
wylwyl1130 2004-08-09
  • 打赏
  • 举报
回复
动态创建
dinya2003 2004-08-09
  • 打赏
  • 举报
回复
--这是动态执行DDL语句的例子,可以参考一下.

create or replace function test return varchar2 as
v_cursor number;
v_string varchar2(200);
v_row number;
begin
v_cursor:=dbms_sql.open_cursor;
v_string:='create table testdb (text varchar2(200))';
dbms_sql.parse(v_cursor,v_string,dbms_sql.native);
v_row:=dbms_sql.execute(v_cursor);
dbms_sql.close_cursor(v_cursor);
return ('成功执行'||v_row||'行!');
exception
when others then
dbms_sql.close_cursor(v_cursor);
return ('执行失败!'||sqlcode||sqlerrm);
raise;
end;

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧