Rexx/SQL

A Rexx interface to SQL databases

Version 2.5

10 October 2006


MYGETINSERTID()

Returns the last unique identifier for an inserted or updated row where the column is defined as AUTO_INCREMENT.

Applicable to MySQL databases only.

Arguments:

none
Returns:
success: the unique identifier
failure: a negative number
Example:
Call sqlconnect( 'c1', 'username', 'password', 'localhost' )
Call sqlcommand( 't1', 'create table table1 (pkid1 integer primary key, col1 string )'
Call sqlcommand( 't1', 'create table table2 (pkid2 integer primary key, fkid1 integer, col1 string )'
Call sqlcommand( 'i1', 'insert into table1 values( null, "string value") )'
id = mygetinsertid()
Call sqlcommand( 'i2', 'insert into table2 values( null,' id ', "string value")' )
Call sqldisconnect( 'c1' )
          

Copyright © Mark Hessling 1997-2004 <mark@rexx.org>


Return to Table of Contents
Last updated 10 August 2006