Toad World® Forums

Append Query


#1

Hi, Hope somebody can tell me how to create an append query.
The following task done in Access I would like to mimic in TDA because my tables are in oracle:
Here is the steps in MS Access:
I create a query with Table1 and Table2; I added some conditions to identify the records that are in Table 1 but are not in Table 2.
In Access, I just select type, Append, and then when I run the query, the records found in Table1 are appended in Table2. I want to duplicate the same task in my oracle tables but I do not find the way to do this. When I join 2 tables, I do not have the option to select the Insert Statement. Is it possible to append records by using the query builder?


#2

We do not currently have an Append statement type. You can build one very easily by doing one of the two actions below.

A) If your query contains columns equal to all columns in the append table simply send the query to the editor and add “Insert into tablename”

IE:
INSERT INTO DEBTEST.TABLEA
select 1 from dual; --Here TABLEA only has one column that is a number column

B) If your query does not contain all columns for the destination table, go to the object palette and locate the destination table. Right Click and choose, ‘Generate SQL |To Editor | insert Statement’. This will send to an editor an insert statement with all columns listed. Delete the columns you do not need and replace the ‘VALUES(…’ with the Select statement.

IE:
INSERT INTO DEBTEST.TABLEB
(C, H, CT)
select ‘1’,‘2’, ‘3’ from dual;

That should get you by. I did add CR73,097 to add an Append statement type to the editor.

Debbie