New to DTS and need to take the next step -
07-27-2004
, 03:33 PM
I'm trying to convert an Oracle Database process to SQL Server.
The original process ran from a UNIX cron and executed an Oracle Stored
procedure that updated a table in a remote database and then updated the
local database to reflect the changes. Here is the code:
CREATE OR REPLACE PROCEDURE "PROD"."MAX_TRANS" AS
CURSOR upd_cur IS
SELECT
TRNSTS,
ORIGIN,
PRTNUM,
PRTDSC,
UPCCOD,
COMCOD,
NDCCOD,
....
FROM usr_prt_ext
WHERE trnsts IN ('I','U')
AND prtfam IS NOT NULL
AND untwgt IS NOT NULL
AND qltcod IS NOT NULL
AND typcod IS NOT NULL
AND prtnum IS NOT NULL
FOR UPDATE OF TRNSTS ;
upd_rec upd_cur%ROWTYPE;
BEGIN
OPEN upd_cur;
LOOP
FETCH upd_cur INTO upd_rec;
EXIT WHEN upd_cur%NOTFOUND;
INSERT INTO usr_PRT_EXT@dcs values (
upd_rec.TRNSTS,
upd_rec.ORIGIN,
upd_rec.PRTNUM,
upd_rec.PRTDS
....
upd_rec.CLRWAY);
UPDATE usr_prt_ext
SET trnsts = null
WHERE current of upd_cur;
END LOOP;
CLOSE upd_cur;
commit;
END;
The first half of this statement was easy. I just went to the DTS import
wizard, imported the tables then modified that same script to update the
remote table based on the where clause above. The problem I'm having is that
I don't know how to implement the above update statement. How do I update
the Oracle table to reflect the migration of this data? Remember this is
really the first time I've ever used DTS to do this type of work. Please be
detailed in your response.
tks
ken. |