Home » SQL & PL/SQL » SQL & PL/SQL » Copy from -- append
Copy from -- append [message #4386] Wed, 04 December 2002 08:33 Go to next message
jerome
Messages: 13
Registered: May 2000
Junior Member
Hi all,

I am using copy -- append to copy data from a Db into another one.

No problem, it works fine from SQLPlus Worksheet.

However, as this process is to be run back end, I want to run it from a procedure, but I am not able to do it, the procedure is as follow:
<<<
create or replace procedure sp0_GerRates
(
XRateSource in varchar2,
GetDate in date
)
as
begin
set copycommit 1
set arraysize 2000
copy from User/pwd@Server -
append urf_XRATE -
using select * from table where source = XRateSource and rateDT = GetDate;
end;
>>>
Unfortunately I am not able to compile it without error...

Does anyone know how to use Copy -- append within a procedure?

Thanks in advance

Jerome
Re: Copy from -- append [message #4391 is a reply to message #4386] Wed, 04 December 2002 11:31 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
COPY and the SET commands are part of SQL*Plus syntax, not PL/SQL syntax. In PL/SQL, you would need a defined database link to the source data, and then in the target database:

insert /*+ append */ -- hint optional
  into urf_xrate
 select *
   from table@dblink_name
  where source = XRateSource
    and rateDT = GetDate;
Re: Copy from -- append [message #4395 is a reply to message #4386] Wed, 04 December 2002 22:14 Go to previous messageGo to next message
seng
Messages: 191
Registered: February 2002
Senior Member
Try Dynamic Sql in PL/SQL. You can find in Oracle Document regards this Dynamic SQL. Hope this is helping.
Re: Copy from -- append [message #4409 is a reply to message #4395] Thu, 05 December 2002 10:31 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Dynamic SQL is not needed at all for this - it is just a matter of using the appropriate syntax for your environment (SQL*Plus or PL/SQL).
Previous Topic: Will trigger executes even my insert sql fails?!!
Next Topic: Problems with dates
Goto Forum:
  


Current Time: Wed May 15 17:27:55 CDT 2024