<p>What's the most efficient way of getting the value of the SERIAL column after the INSERT statement? I.e. I am looking for a way to replicate <code>@@IDENTITY</code> or <code>SCOPE_IDENTITY</code> functionality of MS SQL</p>

I have seen this used.
```
```
if LOCAL_SQLCA^.sqlcode = 0 then
/* return serial */
  Result := LOCAL_SQLCA^.sqlerrd[1]
else
/* return error code */
  Result := -(Abs(LOCAL_SQLCA^.sqlcode));
```
```