Informix

nested-group-icon.png

DB2

Expand all | Collapse all

Why can't I use sequences directly in a view?

  • 1.  Why can't I use sequences directly in a view?

    Posted Thu December 12, 2019 02:55 AM
    Hi,
    The customer wants to use the sequence value of the remote Informix server.
    However, using view to lookup the nextval value gives error 8319.


    So I created a view that references the nextval value using a user-defined function as shown below.


    Neither oracle nor db2, including Informix, can reference the nextval and currval values in the View.
    Why can't I use sequences directly in a view?
    Does this restriction maintain the integrity of the database or is it for some other purpose?


    ------------------------------
    SangGyu Jeong
    Software Engineer
    Infrasoft
    Seoul Korea, Republic of
    ------------------------------


  • 2.  RE: Why can't I use sequences directly in a view?

    Posted Sat June 06, 2020 08:51 PM

    I guess the developers did not think it would be useful

    Normally you get the next value directly from the sequence, why would you need a view?

    Regards,
    David.

    ------------------------------
    David Williams
    ------------------------------



  • 3.  RE: Why can't I use sequences directly in a view?

    Posted 29 days ago
    Edited by SangGyu Jeong 29 days ago
    Hello David,

    Thanks for your response.

    The reason I reproduced this problem is that my customer was trying to reference a sequence object on a remote server.

    In fact, this was an issue for customers using db2, but I was personally curious and tested it in my Informix environment.

    ------------------------------
    SangGyu Jeong
    Software Engineer
    Infrasoft
    Seoul Korea, Republic of
    ------------------------------