Capturing output of a SQL query in a variable and using the variable as a pre process check.

Discussion created by Krishna_Chaitanya_9624 on Aug 24, 2017
Latest reply on Aug 25, 2017 by Pete Wirfs
I have a table which captures the errors of a procedure.I want to check the number of rows is this table before executing a SQL job and if the count of this table returns 0 only then should the SQL JOB execute.

SQL query to check count of the table :

select count(*)
  from tcs_mis_ss_refresh_log
  where batch in ('MIS_DAILY_1A','MIS_DAILY_1B') and err_msg is not null;

I have gone through PREP_PROCESS_VAR and PREP_PROCESS but  couldnt understand how to use it.