Hi,
Try this:
IF @transaction_type in ('A') AND (@OBJECT_TYPE='97')
BEGIN
IF exists (SELECT T0.[OpprId] FROM OOPR T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode WHERE T1.[OprCount] >1 and
t0.opprid = @list_of_cols_val_tab_del )
Begin
SET @error = 123
SET @error_message = 'There are open Oppor for this customer'
End
End
Concept is:
Only open opportunity will appear in OCRD table. The above SPTN will block if count is more than one.
Thanks & Regards,
Nagarajan