I’m pretty fan of SQLcl and lately, I’m using it for creating tables in development from production.

I query the table in production:

SYS@>select owner,object_name,object_type from dba_objects where object_name like '%TLOCATIONID%' and owner='USER';

OWNER         OBJECT_NAME                 OBJECT_TYPE       
------------- --------------------------- -------------------
USER          TLOCATIONID_EXPORT          TABLE             
USER          IDX_TLOCATIONID1            INDEX             

After that, while I’m connected to development, I use the bridge command for creating the table (like CTAS in sqlplus):

USER@>bridge TLOCATIONID_EXPORT as "jdbc:oracle:thin:USER/USER@"(select * from TLOCATIONID_EXPORT);

Se ha creado la tabla TLOCATIONID_EXPORT y se han insertado 246.872 filas

At the end, I query the new table:

USER@>select count(*) from TLOCATIONID_EXPORT;


%d bloggers like this: