SQL Queries - Common SQL Queries - How to check the database type

Purpose of Query

The purpose of this query is to check a database and determine its type (management, central, local).

Applicable CAST Version

ReleaseYes/No
8.3.x

Applicable RDBMS

RDBMSYes/No
CSS

Query for CSS

SELECT
       CASE PACKAGE_NAME
              WHEN 'BASE_LOCAL'
              THEN 'Local'
              WHEN 'ADG_FULL_CENTRAL'
              THEN 'Central'
              WHEN 'PMC_MAIN'
              THEN 'Management'
              ELSE 'P'
       END AS DATABASETYPE,
       VERSION
FROM   SYS_PACKAGE_VERSION
WHERE  PACKAGE_NAME IN ('BASE_LOCAL'      ,
                        'ADG_FULL_CENTRAL',
                        'PMC_MAIN')

Query result example

“Central”;“8.0.0.1”

Query result interpretation

The query will determine if the databases is a local central or management database and provide that information in the first column and then provide the version in the second column.

Notes/comments

Related Pages