Skip to Content
0
Former Member
Nov 03, 2005 at 07:56 PM

Using SAP Number Range Objects vs. Using Oracle SEQUENCE

339 Views

Hi -

I'm just wondering if anyone out there has investigated using SAP number range objects vs. the Oracle SEQUENCE (which needs to be executed using native SQL) - and could recommend which way would be better.

I'm definitely leaning toward the SAP solution b/c of the flexibility of the number range.

I need to generate a sequential number which I'm using as a primary index to a table. I've identified the following ways to do this:

- SAP number range object ... where you setup a number range object using the OYSN transaction - and then in your code, you use the following functions:

number_range_enqueue - to lock number range object

number_get_next - to get the next sequential number

number_range_dequeue - to unlock number range object

- Or you can use the native Oracle SEQUENCE function - and within your code call native sql to get the next value. Example is below

EXEC SQL .

SELECT MySequence.NEXTVAL

INTO :W_NEXT_SEQUENCE_ID FROM DUAL

ENDEXEC.