PL/SQL (MOSC)

MOSC Banner

Inserting LONG RAW Columns into a Table

edited Nov 12, 2013 12:11PM in PL/SQL (MOSC) 3 commentsAnswered
Hello:

We have Oracle 11G that consists of multiple schemas that have the same tables.

I would like to copy table EMPLOYEE for the multiple schemas into a single table BASE.EMPLOYEE that is in the BASE schema, using dynamic SQL, like this:

-- Load EMPLOYEE Table

DECLARE

v_DynSQL VARCHAR2 (32767);

RetVal VARCHAR2 (32767);

BEGIN

FOR con

IN ( SELECT TAB.OWNER,

EMPLOYEE_ID_NO,

LISTAGG (COLUMN_NAME, ',') WITHIN GROUP (ORDER BY COLUMN_ID)

ATTRIBUTES

FROM DBA_TAB_COLS TAB, BASE.EMPLOYEE_ID CTR

WHERE TABLE_NAME = 'EMPLOYEE'

AND TAB.OWNER = CTR.SCHEMA_NAME

GROUP BY OWNER, EMPLOYEE_ID_NO

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center