救急:查询正确,但无法把查询结果插入另一张表???
-- 准备实验环境,创建t01、t02表,并在t01表中插入实验数据
create table t01(num number);
insert into t01 values(1);
insert into t01 values(3);
insert into t01 values(5);
insert into t01 values(7);
insert into t01 values(9);
insert into t01 values(2);
insert into t01 values(4);
insert into t01 values(6);
insert into t01 values(8);
insert into t01 values(10);
commit;
create table t02(num number);
-- 测试一,不使用PL/SQL,直接查询
select num
from
(
select num
from t01
order by num desc
) tmp01
where rownum<=5;
-- 测试二,使用PL/SQL匿名块,将查询结果插入t02表,子查询使用order by
begin
insert into t02(num)
select num
from
(
select num
from t01
order by num desc
) tmp01
where rownum<=5;
end;
/
-- 测试三,使用PL/SQL匿名块,将查询结果插入t02表,子查询“不”使用order by
begin
insert into t02(num)
select num
from
(
select num
from t01
) tmp01
where rownum<=5;
end;
/
create table t01(num number);
insert into t01 values(1);
insert into t01 values(3);
insert into t01 values(5);
insert into t01 values(7);
insert into t01 values(9);
insert into t01 values(2);
insert into t01 values(4);
insert into t01 values(6);
insert into t01 values(8);
insert into t01 values(10);
commit;
create table t02(num number);
-- 测试一,不使用PL/SQL,直接查询
select num
from
(
select num
from t01
order by num desc
) tmp01
where rownum<=5;
-- 测试二,使用PL/SQL匿名块,将查询结果插入t02表,子查询使用order by
begin
insert into t02(num)
select num
from
(
select num
from t01
order by num desc
) tmp01
where rownum<=5;
end;
/
-- 测试三,使用PL/SQL匿名块,将查询结果插入t02表,子查询“不”使用order by
begin
insert into t02(num)
select num
from
(
select num
from t01
) tmp01
where rownum<=5;
end;
/
...全文
相关推荐
优秀资料(2021-2022年收藏)如何防范金融诈骗.doc
虚假中奖诈骗:通过邮件、短信或互联网发送中奖信息,然后以各种名义要求缴纳费用。5. 汇钱救急诈骗:利用受害人亲友信息,假装亲人需要紧急救助,要求汇款。6.
SQL Server查询分析器使用与实战详解
建模阶段的建筑师🛠️。
【Hadoop与大数据50】毛波(逸客)-大数据分析与挖掘在淘宝的应用与挑战
- **展现个性化**:根据不同用户的需求提供个性化的数据分析结果。- **即席化**:利用搜索引擎等技术,实现多维度的数据查询和分析,支持用户即席定制并快速获取反馈。
MySQL数据库Drop Down后的紧急处置
**时间点恢复**:根据binlog中的`Xid`(事务ID)和`Query`(SQL查询)信息,可以定位到特定时间点的数据库状态,从而实现时间点恢复。
如何防范金融诈骗收集.docx
**要登录正确的网站或通过银行的专用热线或到银行的营业网点进行查询咨询:** 使用正确的官方网站或服务热线可以有效避免访问钓鱼网站或遭受欺诈的风险。 3.


