我正在运行一个 netezza sql 进程作为 shell 脚本的一部分,并且在其中一个 sql 代码中,如果来自 2 个不同表的行数不匹配,我希望它引发错误或异常。
SQL 代码:
/* The following 2 tables should return the same number of rows to make sure the process is correct */
select count(*)
from (
select distinct col1, col2,col3
from table_a
where week > 0 and rec >= 1
) as x ;
select count(*)
from (
select distinct col1, col2, col3
from table_b
) as y ;
如何比较 2 行计数并在 netezza SQL 进程中引发异常/错误,以便在 2 行计数不相等时退出进程?