This discussion is archived
7 Replies Latest reply: Oct 12, 2012 1:42 AM by 965843 RSS

Rename FK and PK, that exceed 30 characters name limit

965843 Newbie
Currently Being Moderated
Hi,

I am trying to write a custom script (Rhino) to change all the FK and PK names, that are more than 30 characters long.
I have to do that, because I get the DDL script from Infosphere Data Architect, whitch ignores this Oracle restriction.

I wrote this script, but it does not what I want. Insted of changing the name it changes the PK / UK Index names. Can anybody please help me.

tables = model.getTableSet().toArray();
for (var t = 0; t<tables.length;t++){
table = tables[t];
indexes = table.getKeys();
for (var i = 0; i < indexes.length; i++) {
index = indexes;
if((index.isFK() || index.isPK()) && index.GetName().length > 30){
index.SetName('TEST');
}
}
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points