@@ -591,18 +591,31 @@ const getDbVersion = async logger => {
591591 const fallbackDbVersion = '21c' ;
592592
593593 try {
594- const versionTable = await execute (
595- "SELECT VERSION FROM PRODUCT_COMPONENT_VERSION WHERE product LIKE 'Oracle Database%'" ,
594+ const dbVersionResponse = await execute (
595+ "SELECT version_full FROM product_component_version WHERE product LIKE 'Oracle Database%'" ,
596596 ) ;
597-
598- logger . log ( 'info' , versionTable , 'DB Version' ) ;
599-
600- const majorVersion = versionTable ?. [ 0 ] ?. [ 0 ] ?. split ( '.' ) . shift ( ) ;
597+ const dbVersion = dbVersionResponse ?. [ 0 ] ?. [ 0 ] ;
598+ logger . log ( 'info' , dbVersion , 'DB Version' ) ;
599+ const versionParts = dbVersion ?. split ( '.' ) ;
600+ const majorVersion = versionParts ?. [ 0 ] ;
601601
602602 if ( ! majorVersion ) {
603603 return fallbackDbVersion ;
604604 }
605605
606+ const minorVersion = versionParts ?. [ 1 ] ;
607+
608+ // For Oracle 23+, use the minor version to determine the target version
609+ // e.g., 23.26.1.0.0 -> 26ai or 23ai (fallback)
610+ if ( majorVersion === '23' && minorVersion ) {
611+ const targetVersion = `${ minorVersion } ai` ;
612+ if ( versions . includes ( targetVersion ) ) {
613+ return targetVersion ;
614+ }
615+
616+ return versions . includes ( '23ai' ) ? '23ai' : fallbackDbVersion ;
617+ }
618+
606619 const foundDbVersion = versions . find ( version => version . startsWith ( majorVersion ) ) ;
607620
608621 return foundDbVersion || fallbackDbVersion ;
0 commit comments