aonestar
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_endday_gen_batch_report
Parameters
Name
Type
Mode
user_name
text
IN
status
text
INOUT
msg
text
INOUT
Definition
DECLARE SQL_GET_BATCH text = $$ Select id, batch_name --, output_type, output_target FROM batch_report b WHERE b.prop_id = %L and b.batch_type = 'endday' and b.enabled and b.output_type in ('email','file') $$; batch record; batch_count int = 0; report_count int = 0; BEGIN FOR batch in SELECT * FROM dblink(fn_conn_authen(), format(SQL_GET_BATCH, fn_prop_id())) AS (id int, batch_name text) LOOP report_count := report_count + sp_run_batch_report(batch.id, user_name); batch_count := batch_count +1; END LOOP; status := 'success'; msg := fn_qty(batch_count, 'batch', 'batches')||', '||fn_qty(report_count, 'report')||' generated'; END