asa可以union,为什么不能minus,如何实现2个结果集的差集?
我在Interactive SQL里可以用union做合集,为什么不能做minus差集,请问如何实现?谢谢!
另外我建了一个视图,在Sybase Central里可以看到,但用PB连就是看不到这个视图?
还有我建了一个触发器:
ALTER trigger hmgs.tr_gsda before insert,update on
hmgs.csi_gsda
referencing new as new_gsda
for each row
begin
declare sys_date DATETIME;
select GETDATE(*) into sys_date;
--IF INSERTING THEN
set new_gsda.sbrq=sys_date;
--END IF;
--IF UPDATING THEN
-- IF (new_gsda.shbz <> old_gsda.shbz) or (new_gsda.status <> old_gsda.status) THEN
set new_gsda.sbrq=sys_date
-- END IF;
--END IF;
end
如果把2处的注释去掉,就报错ASA Error-131:Syntax error near 'THEN'
请问语法哪里有错误?谢谢!
[解决办法]
不支持MINUS,用LEFT JOIN+RIGHT JOIN 解决
select * from 视图 能否成功
asa12:
ALTER trigger hmgs.tr_gsda before insert,update on
hmgs.csi_gsda
referencing new as new_gsda
BEGIN
declare sys_date DATETIME;
select GETDATE(*) into sys_date;
IF INSERTING THEN
set new_gsda.sbrq=sys_date;
END IF;
IF UPDATING THEN
IF (new_gsda.shbz <> old_gsda.shbz) or (new_gsda.status <> old_gsda.status) THEN
set new_gsda.sbrq=sys_date;
END IF;
END IF;
END