Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Q: copy table functionality in PL/SQL?
rune.slinning_at_bigfoot.com wrote:
>
> Hi!
>
> I need functionality to copy large tables from one schema to another, and it
> would be nice if I could use the SQL*Plus COPY command from within a PL/SQL
> procedure. I want to copy the tables in PL/SQL so I can hanle
> errors/exceptions.
>
> The tables I'll be copying have 450 000+ rows so I need a big rollback
> segment to copy this with an insert statement like: "insert into ... select *
> from ..."
>
> Is there anybody out there who have implemented a copy procedure/function
> using PL/SQL??
>
> Rune
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
Quick and Dirty One...
c integer; s integer;
c := dbms_sql.open_cursor;
dbms_sql.parse( c,'create table '||new_table||' as select * from
'||
old_table||' unrecoverable',dbms_sql.native );
s := dbms_sql.execute(c);
dbms_sql.close_cursor(c);
exception when others then
dbms_sql.close_cursor(c);
raise;
end;
--
"The only difference between me and a madman is that I am not mad." Received on Wed Jun 24 1998 - 03:06:20 CDT