RE: Table -> Generate Statement -> MERGE

John Dorlon <[email protected]> Fri, 21 Dec 2012 21:54:23 +0000
Newsgroups gmane.comp.db.oracle.toad.free
Message-ID <4120B436C765EC43A31CC3E2A13D36A6263A7A7F@ALVMBXW02.prod.quest.corp>
Yeah, that's long overdue.  Thanks for the reminder.  I'll get to it soon.

From: [email protected] [mailto:[email protected]] On Behalf Of MCALLISTER, MICHAEL CTR AETC AETC/A3IS
Sent: Friday, December 21, 2012 2:41 PM
To: [email protected]
Subject: [toad] Table -> Generate Statement -> MERGE



I'd like to suggest that along with being able to generate a basic insert, update and select statement for a table, it would be nice if TOAD could generate a basic merge statement as well. You could leave the USING portion of the merge statement blank, but still generate the update and insert clauses for me with all the columns of the table. As an example, consider the following table:-

CREATE TABLE EXAMPLE_TBL
(
COL1 VARCHAR2 (50),
COL2 VARCHAR2 (50)
);

Generate for me the following merge statement:-

MERGE INTO example_tbl d
USING (/* insert your merge source here */) s
ON (/* insert your merge condition here */)
WHEN MATCHED
THEN
UPDATE SET d.col1 = s.col1, d.col2 = s.col1
WHEN NOT MATCHED
THEN
INSERT (d.col1, d.col2)
VALUES (s.col1, s.col2);

Regards,

Mike McAllister
Principal Systems Engineer
Decypher
DSN: 487-3751
Commercial: (210) 652-3751
Cell: (512) 423-7447
Email: [email protected]<mailto:michael.mcallister.4.ctr%40us.af.mil>