I would suggest doing steps 1-3 from jrtwynam 's reply in a stored procedure in the database and "return" the match result for use by the next task in VC. That way the SQL functionality is encapsulated for use by other jobs if needed. Data can be “returned” using a sys_refcursor in one select statement.
Here’s how it would go in Oracle:
Assumptions:
2 databases you need to compare query results from, DB1 and DB2
Return Y if result match, N if they do not.
A database link exists in DB1 that points to DB2 called DB2LINK
The stored procedure will reside in DB1
Create a stored procedure in the database DB1:
CREATE OR REPLACE PROCEDURE ARE_DB_PROCS_DONE(prc OUT SYS_REFCURSOR) IS
BEGIN
OPEN prc FOR
SELECT
CASE
WHEN
(SELECT COUNT(*)
FROM TABLENAME) =
(SELECT COUNT(*)
FROM TABLENAME@DB2LINK
) THEN 'Y'
ELSE
'N'
END
FROM DUAL;
END ARE_DB_PROCS_DONE;
So the first task in the job would be a SQL task that calls this stored procedure. No parameters. The sys_refcursor result set output goes to STDOUT of the task.
proceed with step 4 from jrtwynam 's post only using the previous task's STDOUT, which will be either Y or N.
CAVEAT: the procedure needs exception error handling but you get the idea. It doesn't have to be one query either. If you don't have permissions to create a dblink (or the equivalent in your environment) you could always have multiple connects to the different databases, store the results in variables, do the compare, etc. Just make the last statement the open prc for the select of the result and you will get the output.
EDIT: P.S. With this stored procedure using a sys_refcursor OUT parameter mechanism, you can get data from the database into the STDOUT of the task for use in processing by VisualCron.
Edited by user
2019-04-05T17:14:01Z
|
Reason: Not specified