The BIGSERIAL / SERIAL8 data types

IBM® Informix® database supports the BIGSERIAL and SERIAL8 data types for auto-generated 64 bit integer sequences.

The BIGINT data type can be used to store data from BIGSERIAL SERIAL8 values.

Note however that SQLCA.SQLERRD[2] is defined as an INTEGER and therefore cannot be used to get the last generated serial. To retrieve the last generated BIGSERIAL or SERIAL8, you must use the dbinfo() SQL function as in the following code example:

MAIN
  DEFINE new_val BIGINT
  INSERT INTO mytable VALUES ( 0, 'aaaa' )
  SELECT dbinfo('bigserial') INTO new_val
    FROM systables WHERE tabid=1
  DISPLAY new_val
END MAIN