Re: how to copy table content from one to another with order [message #19692] |
Wed, 03 April 2002 23:03 |
Nick
Messages: 64 Registered: February 2000
|
Member |
|
|
the follwing works for a single column permanent sort on x:
create table temp as
select *
from orig;
create index x
on temp (x);
declare
v_sql varchar2(254);
cursor_id integer;
result integer;
begin
cursor_id:=dbms_sql.open_cursor;
v_sql := 'drop table orig';
dbms_sql.parse(cursor_id,v_sql,1);
result := dbms_sql.execute(cursor_id);
v_sql := 'create table orig as '||
'select a, b, c, rownum as sequence, x from temp '||
'where x > ''-9999999999999''';
dbms_sql.parse(cursor_id,v_sql,1);
result := dbms_sql.execute(cursor_id);
dbms_sql.close_cursor(cursor_id);
end;
/
drop table temp;
select * from orig;
|
|
|