Question

19
Views
Close popover
Avinash Haridasu (Avinash.Haridasu)
Morgan Stanley

Morgan Stanley
IN
Avinash.Haridasu Member since 2014 285 posts
Morgan Stanley
Posted: February 5, 2021
Last activity: February 5, 2021

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;             }           }         }

Pega Platform 8.5.2 Data Integration