Informix

 View Only
  • 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
    ------------------------------

    #Informix


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

    IBM Champion
    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 Tue June 09, 2020 08:49 AM
    Edited by System Fri January 20, 2023 04:43 PM
    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
    ------------------------------