|
I'd use this SQL to check for file existence, unless I had a reason
not to. I've not used this in a trigger before, but I've used code
like this in lots of SQL objects.
select char( case when TABLE_NAME is null then '0' else '1'
end )
from ( values( 1 ) ) as V
into :TABLE_EXISTS
left join QSYS2.SYSTABLES
on TABLE_SCHEMA = :MY_SCHEMA_NAME
and TABLE_NAME = :MY_TABLE_NAME
;
--Or, if you prefer:
values
coalesce ( (
select char( '1', 1 )
from QSYS2.SYSTABLES
where TABLE_SCHEMA = :MY_SCHEMA_NAME
and TABLE_NAME = :MY_TABLE_NAME
), '0' ) into :TABLE_EXISTS
I don't recall the RPG embedding rules for the 2nd SQL, but the 1st
one should embed with simple static SQL.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.