procedure dbconnect (init integer) is test_count number; begin select count(1) into test_count from ALL_DB_LINKS where db_link = 'LAKMINS'; IF test_count = 0 THEN EXECUTE IMMEDIATE q'[CREATE PUBLIC DATABASE LINK LAKMINS CONNECT TO userfor1c IDENTIFIED BY *** USING 'LAKMINS']'; commit; ELSE EXECUTE IMMEDIATE q'[DROP PUBLIC database link LAKMINS]'; EXECUTE IMMEDIATE q'[CREATE PUBLIC DATABASE LINK LAKMINS CONNECT TO userfor1c IDENTIFIED BY *** USING 'LAKMINS']'; commit; END IF; end; procedure dbdisconnect (init integer)is begin EXECUTE IMMEDIATE q'[DROP PUBLIC database link LAKMINS]'; commit; end; procedure CardsLoad (init integer) is begin dbconnect(1); EXECUTE IMMEDIATE q'[TRUNCATE TABLE SUPERMAG.SMCARD]'; INSERT INTO SUPERMAG.SMCARD SELECT * FROM SUPERMAG.SMCARD@LAKMINS; commit; dbdisconnect(1); end;
ALTER SESSION CLOSE DATABASE LINK LAKMINS;