Skip to main content

Hi Everyone,

 

in the past we have been able to change the “Next number” in a number stack for some parts of the system using a very simple sql update script where we update the next number (using sql) to be what we want it to be.

 

Has anyone (In IFS Cloud) found out how to change the “Next handling Unit id” using a simple sql script?

 

Thanks in advance,

Steve Barker

Hi Steve,

 

could you please share the SQL code you used to use in the past.

 

Thank you,
Peter


Hi Peter

The next number for a handling unit comes from the HANDLING_UNIT_SEQ database sequence.

To change the next value in Oracle you would need to calculate how much you want to change the value by and then update the sequence accordingly using

alter sequence HANDLING_UNIT_SEQ increment by xx

You then need to cause the next value to be generated by using

select HANDLING_UNIT_SEQ .NEXTVAL from dual

You must then reset the increment back to 1

alter sequence HANDLING_UNIT_SEQ . increment by 1

 

I have never done this for IFS, this approach is purely the way to achieve a sequence reset in Oracle, but hopefully it may help you.

 


@sbarker ​@pr-upa the way IFS is handling these is by using Oracle DB sequences. Basically in the DB you have the HANDLING_UNIT_SEQ where you can check the current value or next value.

Please note that when you query nextval, it increases the seq.

So, if you have some custom logic built (maybe an event action with PL/SQL code) invoking the sequence could tell you what’s the next number.

select handling_unit_seq.currval from dual;

select handling_unit_seq.nextval from dual;

If you wanna change what the next number would be you could use an alter sequence statement, altough I would advise against going this route:

ALTER SEQUENCE sequence_name RESTART START WITH new_value;


Many thanks for your help guys!


Reply