All the above is nice, but if you need to
then the following trick is the one and only way.
First learn how to create spool files or export result sets from the source db command line client. Second learn how to execute sql statements on the destination db.
Finally, create the insert statements (and any other statements) for the destination database by running an sql script on the source database. e.g.
SELECT '-- SET the correct schema' FROM dual;
SELECT 'USE test;' FROM dual;
SELECT '-- DROP TABLE IF EXISTS' FROM dual;
SELECT 'IF OBJECT_ID(''table3'', ''U'') IS NOT NULL DROP TABLE dbo.table3;' FROM dual;
SELECT '-- create the table' FROM dual;
SELECT 'CREATE TABLE table3 (column1 VARCHAR(10), column2 VARCHAR(10));' FROM dual;
SELECT 'INSERT INTO table3 (column1, column2) VALUES (''', table1.column1, ''',''', table2.column2, ''');' FROM table1 JOIN table2 ON table2.COLUMN1 = table1.COLUMN1;
The above example was created for Oracle's db where the use of dual is needed for table-less selects.
The result set will contain the script for the destination db.