Home » RDBMS Server » Server Utilities » export from 2 tables with different columns
export from 2 tables with different columns [message #71852] Wed, 22 January 2003 06:25 Go to next message
Kieron
Messages: 6
Registered: October 2000
Junior Member
Hi,

Here is the problem.

2 Tables:

SQL> create table emp (entity varchar2(2));

Table created.

SQL> create table company (country varchar2(2));

Table created.

SQL> insert into emp values('AU');

1 row created.

SQL> insert into emp values('GB');

1 row created.

SQL> insert into company values ('AU');

1 row created.

SQL> insert into company values ('GB');

1 row created.

The question is, how to export these two tables in one export command (into one dump file), with only the 'AU' data.

I am aware of the query parameter for the export command, but this only allows you to have the same column in both tables, ie.

exp query="where entity='AU'" tables=emp,company

When it gets to the company table it errors with a unknown column error.

A tricky way to solve this? Without creating the column and copying the data into the new column.

Thanks and Regards,
Kieron
Re: export from 2 tables with different columns [message #71854 is a reply to message #71852] Wed, 22 January 2003 07:02 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
you can use queries in export.
But How can you query two tables, with any relation?
that kind of sql does not even work in sql*plus.
try creating a view of both tables (using some join condition) and export the view.
else
you have to export just the tables without any queries.
Re: export from 2 tables with different columns [message #71856 is a reply to message #71852] Wed, 22 January 2003 07:11 Go to previous messageGo to next message
Kieron
Messages: 6
Registered: October 2000
Junior Member
A view was my original idea, but it seems that export does not allow one to export from a view.

I am aware that it cannot be done in SQL*Plus, I was just wondering if anyone had any bright ideas.

Thanks for the suggestion,
Regards,
Kieron
Re: export from 2 tables with different columns [message #71858 is a reply to message #71856] Wed, 22 January 2003 09:52 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
stil,
you can create a temp table and export this table
which has data from both the tables.
create table temptab as
(select ...... from
 table1 , table2
 where...
..);

Previous Topic: Re: Microsoft Visual Basic Run-time Error '3360' Query is too complex
Next Topic: Oracle Trigger Compilation Error
Goto Forum:
  


Current Time: Tue May 14 19:42:15 CDT 2024