SELECT COUNT(*)
INTO :isTablePresent
FROM FROM SYSCAT.TABLES
WHERE SYSCAT.TABLES.TABSCHEMA = 'MYSCHEMANAME' AND
SYSCAT.TABLES.TABNAME = 'MYTABLENAME'
;
--If isTablePresent == 0 then the table does not exist, if isTablePresent == 1 the table exists, other values are impossible.
db2 -tvf myscript.db2 => option flags
db2 connect to sample => SQL statement
db2 list tables for user => DB2 command
db2 ? => general CLP help
db2 ? options => current CLP options settings
db2 ? help => help for syntax online help
db2 ? backup => help for a specific DB2 command
db2 ? sql0117N => help for a specific SQLCODE
db2 ? 42501 => help for a specific SQLSTATE
db2 ? 01 => help for a specific class code