'R stop function on multiple objects

I have a simple script that has 10 sqlquery and sqlSave functions.

I am trying to create a sql table to capture when an error or warning occurs. Example I can write print("Sql QueryA loading!") into a table but in my case sql. then the sqlquery/sqlsave will run and then i write another print"Sql QueryA Saved" I can use

if(NROW(mysqlquery)!=0{sqlqA= sqlSave(serverdb,"tablename"and so on)}
else{stop(sqlSave("my error table" and so on)} 

But i would have to do this for every object, I dont understand how I can do this for all my objects for example if NROWS SqlA >0 then execute sqlsave if NROWS SqlB =0 the stop any code below and write the error to the error table.

This is probably a duplicate but looking at other questions i cant understand how i can get this to work. thanks to anyone that might be able to help.

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source