[Oracle] Script auto create Table from DBLink

DECLARE v_select varchar2(2556); CURSOR c1 IS SELECT TABLE_NAME FROM ALL_TABLES@DBLINK WHERE OWNER = 'OWNER' AND TABLE_NAME NOT LIKE 'PLSQL%' AND TABLE_NAME NOT LIKE 'SQL%' AND TABLE_NAME NOT LIKE 'TEMP%'; BEGIN FOR table_rec in c1 LOOP v_select := 'CREATE TABLE CSL_HATINH.'||table_rec.TABLE_NAME||' AS (SELECT * FROM OWNER.'||table_rec.TABLE_NAME||'@DBLINK WHERE 0=1)'; EXECUTE IMMEDIATE v_select; COMMIT; END LOOP; END;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.