Sequence Names not to be hard-coded

Posted by malikzam@gmail.com on 17-Sep-2014 02:40

/*
I have created a sequences named 'S1' and 'S2'.
it is a requirement to change the sequence names at runtime based
on some conditions and not to be hard-coded.
I was wondering if I could succesfully run the below query.
Any help in this regard will be highly appreciated.
*/


  DEF VAR A AS CHAR.
  A = 'DM'.
  DISP STRING ( NEXT-VALUE ( STRING(A))).

Posted by Mike Fechner on 17-Sep-2014 02:42

Depending on your OE-Release you can use DYNAMIC-NEXT-VALUE.
 

All Replies

Posted by Mike Fechner on 17-Sep-2014 02:42

Depending on your OE-Release you can use DYNAMIC-NEXT-VALUE.
 

Posted by malikzam@gmail.com on 17-Sep-2014 02:59

/*Following code works for me.

Dyanmic-next-value works with database name*/

 DEF VAR A AS CHAR.

 A = 'S1'.

 DISP string(DYNAMIC-NEXT-VALUE(A,'dbname')).

Posted by malikzam@gmail.com on 17-Sep-2014 03:00

Thanks Mike ... Much appreciated ...

Posted by Mike Fechner on 17-Sep-2014 03:02

Or when there is only a single DB connected:
 

DISP DYNAMIC-NEXT-VALUE(A,LDBNAME(1)) .

This thread is closed