Creating a new number sequence in Oracle for OIR in Windchill

How to create a new sequence in Oracle that can be used to generate number of an object type and how to hook it up in OIR.

Add Comment
1 Answer(s)

Below are the steps to create new sequence:

1. Create a new file “create_<mysequence>_sequence.sql”  in <Windchill_Home>/db/sql directory and <Windchill_Home>/db/sql3 directory.

2. Add the below code to the sql file:

//exec WTPK.createSequence('<Sequence Name>', <Initial Number>, <Increment>)

For eg,
exec WTPK.createSequence('PartSequence_seq', 1, 20)


3. Execute the script from the windchill shell

//<Windchill_Home>/db/execute_sql_script.bat create_<mysequence>_sequence.sql

For eg,
<Windchill_Home>/db/execute_sql_script.bat create_newseq_sequence.sql


This will create a new sequence with name PartSequence_seq in the Oracle database. After the sequence is created, we can use the generated sequence in our Object Initialization Rule (OIR).
Below are the steps:
Edit the OOTB rule.xml file and use the newly created sequence.

<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">

Upload the OIR to see the changes take effect.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.