Skip to Main Content

SQL Developer Data Modeler

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add/change datatype column (scripting)

HuScJan 15 2015 — edited Jan 21 2015

Hello,

I am writing a script to add default columns and their values to tables. So far for me it's possible to add columns to an existing table in the model.

Next I want to add the value for datatype. I found out there's a method called getDataType(). Until now, I didn't find the 'setter; for this property.

Like other scripts, I started with create a table with columns and then using the API to read the values.

A simplified version of my code:

// get columns array

var myTab = model.getTableSet().getByName("T_POSITIONS");

colArray = myTab.getElementsCollection().toArray();

 

// loop over columns

for(i = 0; i < colArray.length; i++){

  var dataType = colArray[i].getDataType();

  model.getAppView().log(colArray[i] + " has datatype " + dataType );

  colArray[i].setDataType("VARCHAR2 (1)");

}

An error occurs when I want to run this script: Cannot find function setDataType in object ID.

I cannot find the right method to add/modify the datatype property.

Any tip would be appreciated.

This post has been answered by Philip Stoyanov-Oracle on Jan 16 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2015
Added on Jan 15 2015
4 comments
1,470 views