Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>--UPDATED---</strong></p> <p>Hi Popo,</p> <p>First off could you give more detail on what you mean when you say the rowid is assigned by a trigger?</p> <p>If you had a real identity column you would use the IDENTITY_VAL_LOCAL() function like this right after the INSERT: <code>SELECT IDENTITY_VAL_LOCAL() INTO myrowid FROM SYSIBM.SYSDUMMY1;</code> I'm not 100% on that syntax because I generally use embedded SQL and it works differently there so you might have to play with it. IBM documentation is at <a href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzscaidentity.htm" rel="nofollow noreferrer">http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzscaidentity.htm</a>.</p> <p>However since you are doing something more complicated, I think this alternate method might work. You'll need to re-format your INSERT to be wrapped in a SELECT.</p> <pre><code>SELECT myrowid INTO myrowid FROM FINAL TABLE ( INSERT INTO myfile (myrowid, other_stuff) VALUES (default, 'blah') ) </code></pre> <p>You'll need to adjust for the proper field names and so on but I think this will do the trick. There's not much documentation but if you want to see it go to <a href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzbackup.htm" rel="nofollow noreferrer">http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzbackup.htm</a> and scroll all the way down to the bottom of the page.</p> <p>Cheers</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload