我在pb中用嵌入式sql : insert into table_1 (select c_1,c_2,c_3 from table_2 order by asc )
執行總是出錯,我只要把 排序 :order by asc 去掉變成
insert into table_1 (select c_1,c_2,c_3 from table_2 )
就可以了,不知道怎麼原因,各位大俠指教。環境為Pb9 + Oracle10g
執行總是出錯,我只要把 排序 :order by asc 去掉變成
insert into table_1 (select c_1,c_2,c_3 from table_2 )
就可以了,不知道怎麼原因,各位大俠指教。環境為Pb9 + Oracle10g
SQL> insert into emp
2 (select * from emp order by empno asc);
insert into emp
(select * from emp order by empno asc)
ORA-00907: ȱʧÓÒÀ¨ºÅ
SQL>
SQL> insert into emp
2 (select * from emp) order by empno asc;
14 rows inserted
SQL>
SQL> insert into emp
2 select * from emp order by empno asc;
28 rows inserted
SQL>
SQL> insert into emp
2 (select * from emp) ;
56 rows inserted
奇怪的是order by为啥有时候报错有时候不报错
insert into table_1 (select * from (select c_1,c_2,c_3 from table_2 order by c_1 asc ))
insert into t_test select material_id from material_prod where rownum < 10 order by material_id
insert into t_test ( select material_id from material_prod where rownum < 10 ) order by material_id desc
這兩個sql插入的內容不一樣,前者是對material_prod排序後插入的最前9條,後者好像沒有什麼順序。
insert into table_1 select c_1,c_2,c_3 from table_2 order by 列名没有你的 asc