Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export data on sql developer without depending on the Database name

Im making an export of data on sql developer, and im getting the database name or user name before every table, like this:

Insert into FAUSTO.CLIENT (ID, Name) ...

So the database in this case is FAUSTO. I want this export to be independent of database name. I have another script that creates the schema and then i run some scripts that inserts data. So, no matter the database name, it should work always.

Thanks

like image 964
Fausto Sanchez Avatar asked Feb 06 '23 17:02

Fausto Sanchez


1 Answers

This is slightly unintuitive, but in the SQL Developer Export Wizard, uncheck the 'Show schema' option from the Export DDL section, before unticking that whole section.

Export Wizard dialog

The insert statements honour that setting even if you exclude the DDL.

With that turned off the generated script looks like:

--------------------------------------------------------
--  File created - Thursday-June-23-2016   
--------------------------------------------------------
REM INSERTING into A
SET DEFINE OFF;
Insert into A (NAME,AGE) values ('Tom',1);
Insert into A (NAME,AGE) values ('John',2);
...

If I export again but leave that 'show schema' checkbox on instead I get:

--------------------------------------------------------
--  File created - Thursday-June-23-2016   
--------------------------------------------------------
REM INSERTING into STACKOVERFLOW.A
SET DEFINE OFF;
Insert into MYSCHEMA.A (NAME,AGE) values ('Tom',1);
Insert into MYSCHEMA.A (NAME,AGE) values ('John',2);
...
like image 194
Alex Poole Avatar answered Feb 09 '23 06:02

Alex Poole