oracle如何创建临时表

时间:2024-10-28 23:13:59

1、打开plsql连接数据,填上用户名密码连接oracle数据。

oracle如何创建临时表

2、连接成功后,打开sql窗口。

oracle如何创建临时表

3、接下来创建临时表,语句为:create global temporary table test(id number) on commit delete rows;

oracle如何创建临时表

4、向临时表中插入语句,然后查询临时表;可以看到在当前窗口中可以查到数据。如果点击commit或者rollback之后,则查询不到插入的数据。

oracle如何创建临时表
oracle如何创建临时表

5、另外一种临时表为会话级别的临时表:create global temporary table test_pre(id number) on commit pres髫潋啜缅erve rows;查询临时表可以看到只能在当前窗口中查到,另外再打开一个窗口查询则查询不到。

oracle如何创建临时表

6、这就是oracle两种临时表的创建和区别;我们可以根据需要来使用不同的临时表完成响应的功能。

oracle如何创建临时表
© 手抄报圈