user78706
user78706

Reputation:

Oracle script client that exports query result as UPDATE statement

I use Quest TOAD for Oracle and Quest SQL Navigator for Oracle as my database query tools of choice.

These tools allow me to export the query results grid as INSERT statements.

For example

SELECT dummy  
FROM dual;

exports to

INSERT INTO dual
(DUMMY)
VALUES
('X')
/

Is there an Oracle database query tool that exports query results as UPDATE statements?

For example

SELECT dummy  
FROM dual;

would export to

UPDATE dual
SET dummy = 'X'
/

Upvotes: 2

Views: 3212

Answers (3)

GGS_DDU
GGS_DDU

Reputation: 1

You can export the Insert query first, insert into a backup table. Then update the target table with the backup table with PK.

UPDATE (SELECT tr.id, 
               tr.name a,
               tr.desc b,
               bk.name A,
               bk.desc B
          FROM target tr,
               backup bk
         WHERE tr.id = bk.id)
   SET a = A,
       b = B

Upvotes: 0

user330315
user330315

Reputation:

Try this one: http://www.sql-workbench.net

Upvotes: 3

Zsolt Botykai
Zsolt Botykai

Reputation: 51603

I don't know if there are other tools (wasn't able to find one, to be precise).

What I used to do for this to export the data as CSV, then hack a quick awk script to generate the desired UPDATEs.

Upvotes: 0

Related Questions