SELECT
name as DBNAME,
DECODE(open_mode, 'MOUNTED', 1, 'READ ONLY', 2, 'READ WRITE', 3, 'READ ONLY WITH APPLY', 4, 'MIGRATE', 5, 0) AS open_mode
FROM v$pdbs
WHERE CON_ID = '{#CON_ID}';