mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 11:11:08 +08:00
commit
f1c20abc7d
@ -154,12 +154,14 @@ public class ObReaderUtils {
|
|||||||
} else {
|
} else {
|
||||||
schema = "(select sys_context('USERENV','current_schema') from dual)";
|
schema = "(select sys_context('USERENV','current_schema') from dual)";
|
||||||
}
|
}
|
||||||
|
//OceanBase oracle模式下需要使用position排序获取正确的联合主键顺序
|
||||||
sql = String.format(
|
sql = String.format(
|
||||||
"SELECT cols.column_name Column_name " +
|
"SELECT cols.column_name Column_name " +
|
||||||
"FROM all_constraints cons, all_cons_columns cols " +
|
"FROM all_constraints cons, all_cons_columns cols " +
|
||||||
"WHERE cols.table_name = '%s' AND cons.constraint_type = 'P' " +
|
"WHERE cols.table_name = '%s' AND cons.constraint_type = 'P' " +
|
||||||
"AND cons.constraint_name = cols.constraint_name " +
|
"AND cons.constraint_name = cols.constraint_name " +
|
||||||
"AND cons.owner = cols.owner and cons.OWNER = %s",
|
"AND cons.owner = cols.owner and cons.OWNER = %s " +
|
||||||
|
"order by cols.position " ,
|
||||||
tableName, schema);
|
tableName, schema);
|
||||||
}
|
}
|
||||||
LOG.info("get primary key by sql: " + sql);
|
LOG.info("get primary key by sql: " + sql);
|
||||||
|
Loading…
Reference in New Issue
Block a user