oracle: select C1,rownum from (select C1 from table order by C1);
小狼: 這樣做不到的. identity函數必須要三個參數,而且要用在select into語句中才行. select C1,identity(int,1,1) C2 into #temptable1 from table; select * from #temptable1 order by C1;Oracle中可以先新建一個序列,借助序列的nextval來達到你的要求.
我是說你的SQL Server中那樣做不到. Oracle很好.
Oracle:select c1,rownum from ( select c1 from table order by c1 )
select C1,rownum from (select C1 from table order by C1);
這樣做不到的.
identity函數必須要三個參數,而且要用在select into語句中才行.
select C1,identity(int,1,1) C2 into #temptable1 from table;
select * from #temptable1 order by C1;Oracle中可以先新建一個序列,借助序列的nextval來達到你的要求.
Oracle很好.
from (
select c1 from table
order by c1
)
select c1,rownum
from (
select c1 from table
order by c1
)
你这样做不行的,ORACLE不支持子查询中ORDER BY, 我也是没多久才发现这个问题. 不信你试试.
你的版本可能不支持,我的8.1.6支持