Data Management Platform: tSQLTemplate ignores SQl exception
Hello,
I am working on an ETL job that executes some custom T-SQL code in a tSQLTemplate component. Part of this custom T-SQL code is to check for missing table entries, and throw an exception using "throw 52015, @message,1;" to trigger an exception if certain entries are missing. This exception is then to be shown in the Talend console.
While this approach has worked using Talend 5.6.2, after migrating to Talend 7.1.0, the exception is not reliably shown in the console. To be precise, it only shows if the custom T-SQL code starts with "throw 52015, @message,1;". If this statement is preceded with any other statements, the exception seems to be ignored by Talend.
The T-SQL code I want to use is like:
declare @msg varchar(255); select top 1 @msg = 'lnk: at least one missing hub seq for table stg' from stg.stage_table stg where ( not exists (select 1 from cdw.hub_table1 b where b.bk_id = stg.bk_id1 ) or not exists (select 1 from cdw.hub_table2 c where c.bk_id = stg.bk_id2 ) );
if @msg like 'lnk: at least one missing hub seq for%' throw 52015, @msg, 1 ;