Re: 4GL question
Posted in 1992
In article <1992Oct26.163233.16252@hpcvusn.cv.hp.com>, thaddeus@hpcvusd.cv.hp.com (Thaddeus Konar) writes: |> I am new to I4GL. When I insert a data into a table, where primary |> key is define as serial, how do I get back the assigned ID number. |> Right now I SELECT the row after INSERT with all the known values |> and read the PK column value. It seems to me that this is not efficient |> and there must be a better way. Indeed there is. The serial value assigned is returned in the sqlca record. This is actually documented, but so obscurely I never noticed it either, until I asked the mailing list. # this is just a convenience function, so that I don't have to look up # the trick for finding the serial value each time I want to use it. function serial_val() # there is some error checking that could be done here ... return sqlca.sqlerrd[2] end function -- Harry Bochner bochner@das.harvard.edu