Toad World® Forums

print results of updade or inserts statments to log

Hi,

I want to run “Execute Script” of update or insert statment

I look for indication for the script execute results

From what I saw on the site (variables, log etc), I noticed that there is a reference to the results of SELECT statements only

and not for UPDATE or INSERT.

In addition, Is it possible to run several legal update/insert/delete statment in the same script and see their full log?

From what I’ve tried - if there is an error, Log shows only the reason for thefirst fall of the first sentence and refers to all the rest

For example(1):

update Employee as Emp set Emp.ID = 1 where Emp.ID< 0

Result expected:

I want to see in the log how much rows were updated

For example(2):

My script is:

insert into Employee as Emp (ID, firstN, LastN) values(1, A, b);

Delete From Employee as Emp where Id=1;

I want see for each statment what were the results of execute it on DB.

Thank you for answer

Unfortunately not all databases provide the number of affected rows for UPDATE, INSERT, DELETE statements.

What database and driver do you use?

Regards

Aleksey

I use a DB2 databas. Is it posibble?

What kind of DB2 do you use – LUM, iSeries, zOS?

Regards

Aleksey

DB2 for LUW and DB2 for z/OS will return the number of rows updated\deleted so Toad will display that information on the messages tab as shown below:

se1.jpeg

But I am not sure if DB2 iSeries returns that data…

What would really be cool is if you could capture that number of rows affected in a variable so that you could use it later in a summary report or validation test with it.

Can you tell me how to redeem it?

Ok

Same with me

But it’s only when I’m running the query from the editor

I’m looking for how to see the same in the log, when I’m running the same query(delete/insert) by automation script

I would appreciate your help.

To Jeff Podlasek :

Ok

Same with me

But it’s only when I’m running the query from the editor

I’m looking for how to see the same in the log, when I’m running the same query(delete/insert) by automation script

I would appreciate your help.

Right now we only provide the number of rows returned from a select statement. Or when using the import wizard you will see in the log the number of rows read, inserted, and errored. But unfortunately we do not do this for inserts or updates. I entered QAT-7392 for this enhancement

Hi Debbie.

Thank you for answer

I would be happy if you let me know when improvement will take place in

I put a note in the task to update this thread when coded. You can always check release notes in Betas and GA releases