HHH-15757 SELECT without FROM

This commit is contained in:
LLEFEVRE 2023-10-16 15:27:42 +02:00 committed by Christian Beikov
parent 498dce1dda
commit 2bfaa419f3
2 changed files with 6 additions and 5 deletions

View File

@ -924,7 +924,7 @@ public class OracleDialect extends Dialect {
@Override
public String getCurrentTimestampSelectString() {
return "select systimestamp from dual";
return getVersion().isSameOrAfter( 23 ) ? "select systimestamp" : "select systimestamp from dual";
}
@ -971,7 +971,7 @@ public class OracleDialect extends Dialect {
@Override
public String getSelectGUIDString() {
return "select rawtohex(sys_guid()) from dual";
return getVersion().isSameOrAfter( 23 ) ? "select rawtohex(sys_guid())" : "select rawtohex(sys_guid()) from dual";
}
@Override
@ -1189,7 +1189,7 @@ public class OracleDialect extends Dialect {
@Override
public String getCurrentSchemaCommand() {
return "SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL";
return getVersion().isSameOrAfter( 23 ) ? "select sys_context('USERENV','CURRENT_SCHEMA')" : "SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL";
}
@Override

View File

@ -540,7 +540,7 @@ public class OracleSqlAstTranslator<T extends JdbcOperation> extends SqlAstTrans
@Override
protected String getFromDualForSelectOnly() {
return getFromDual();
return getDialect().getVersion().isSameOrAfter( 23 ) ? super.getFromDualForSelectOnly() : getFromDual();
}
private boolean supportsOffsetFetchClause() {
@ -609,7 +609,8 @@ public class OracleSqlAstTranslator<T extends JdbcOperation> extends SqlAstTrans
appendSql( valueBinding.getColumnReference().getColumnExpression() );
}
appendSql( " from dual)" );
appendSql( getFromDualForSelectOnly() );
appendSql( ")" );
renderMergeSourceAlias();
}