Question

Morgan Stanley
IN
Last activity: 5 Feb 2021 13:31 EST
Check if database table exists or not
Tried the below functions to check if a database table exists for not:
However pzIsTableExists doesnt seem to work:
pega_rulesengine_dbvalidationutils.pzIsTableExists(pega_rulesengine_dbvalidationutils.pzGetSchemaName(workPool), pega_rulesengine_dbvalidationutils.pzGetDatabaseName(workPool), pega_rulesengine_dbvalidationutils.pyGetTableFromClass(workPool))
And the below java code throws some FAIL case and hence the activity returns a failure message instead of success. I would like to handle it gracefully.
ClassDefinition classDef = db.getClassDef("History-a-b-c-Work"); try{ if (classDef != null) { final String databaseName = classDef.getDatabase(); final DatabaseInformation info = db.getDBInfo(databaseName); if (info != null) { try{ classDef.isMappedToExternalTable(); doesTableExist = true; } catch(Exception e) { doesTableExist = false; } } }