Hi,
Having the following:
create table test1 (name varchar2(10),order_id number);
insert into test1 values ('a1',1);
insert into test1 values ('a3',1.5);
insert into test1 values ('a4',2);
insert into test1 values ('a2',1.3);
commit;
I want to have only integer in order_id:
'a1',1
'a2',2
'a3',3
'a4',4
You cannot use the NAME column to sort!
I tried with no success:;
UPDATE (SELECT name, order_id
FROM test1
ORDER BY order_id)
SET order_id = ROWNUM;
Does not produce the expecting result because the order by is not used.
Then I tried this
UPDATE (SELECT name,order_id, rownum new_num
FROM (SELECT name, order_id
FROM test1
ORDER BY order_id))
SET order_id = new_num;
Produce an ORA-01732 because the inline view becomes non updatable due to the virtual column ROWNUM!
Should be simple but I can't see it!?:|
Thanks
Christophe