对不起,如果这个问题有点过于宽泛,我经常使用反向工程来读取ODI11g中的.TXT文件。
我想知道是否有任何方法来修改或创建RKM(不确定这是否负责),默认情况下,RKM为字符串数据类型分配列的物理和逻辑长度为300。
由ODI 11g分配的默认长度为50。
有办法编辑这个吗?
发布于 2019-08-09 08:18:51
您可以使用下一个Groovy脚本对物理长度和长度进行大量更改。
转到ODI > Tools > Groovy > New Script并复制粘贴下一个Groovy代码:
//Created by DI Studio
import ro.ns.odi.proxy.*
import oracle.odi.domain.model.*
import oracle.odi.domain.model.finder.*
import oracle.odi.domain.xrefs.expression.*
import oracle.odi.languages.support.*
IOdiEntityFactory odiFactory=OdiEntityFactory.createInstance(odiInstance)
IOdiBasicTemplate odiTemplate=odiFactory.newOdiTemplate()
String TABLE_NAME="SB_FINANCIALS_NEW_UU" //change with what you need
String MODEL_CODE="FILE" //change with what you need
odiTemplate.executeInTransaction{IOdiCommandContext ctx->
IOdiEntityManager odiManager=ctx.getSupportingOdiInstance().getTransactionalEntityManager()
IOdiDataStoreFinder dataStoreFinder=odiManager.getFinder(OdiDataStore)
OdiDataStore dataStore=dataStoreFinder.findByName(TABLE_NAME,MODEL_CODE)
assert dataStore!=null : "No data store was found. Please review the model code and data store name"
for (OdiColumn column:dataStore.columns){
println "Analyzing column ${column.name} with type ${column.dataType.name}, length ${column.getLength()} and scale ${column.scale}"
String dataTypeName=column.dataType.name
column.fileFieldDescriptor.bytes=4000 //change with what you need
//column.fileFieldDescriptor?.bytes=3000
column.length=4000 //change with what you need
column.dataType.name="String"
switch(dataTypeName){
case "String":
//column.scale=2
//column.fileFieldDescriptor?.decimalSeparator="x"
println "--Column Modified"
break
case "Numeric":
//column.scale=2
//column.fileFieldDescriptor?.decimalSeparator="x"
println "--Column Modified"
break
}
}
}阅读Groovy代码并更改:
https://stackoverflow.com/questions/57008020
复制相似问题