×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
7.3 Knowledge center
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzahg/welcome.htm
Database, Reference, SQL Reference, Statements, CREATE TABLE,
WITH DEFAULT CURRENT TIMESTAMP
CREATE TABLE QTEMP.JR
(
MYCHAR CHAR(5),
MYTS TIMESTAMP WITH DEFAULT CURRENT TIMESTAMP
);
INSERT INTO QTEMP.JR (MYCHAR) VALUES('A');
SELECT * FROM QTEMP.JR;
myts has the time the transaction was completed.
UPDATE QTEMP.JR
SET MYCHAR='B'
WHERE MYCHAR='A';
SELECT * FROM QTEMP.JR;
The value of myts did not change from the insert.
See also these cool functions from 7.3:
create table qtemp.jr2
(
mychar char(5),
CreatedTS timestamp with default current timestamp,
audit_user VARCHAR(128) GENERATED ALWAYS AS (SESSION_USER),
audit_op CHAR(1) GENERATED ALWAYS AS (DATA CHANGE OPERATION),
Row_Change_TS timestamp for each row on update as row change timestamp not
null
);
insert into qtemp.jr2 (mychar) values('#ENFB');
select * from qtemp.jr2;
#ENFB, 2017-08-22 08:51:26.570501, ROB, I, 2017-08-22 08:51:26.570546
update qtemp.jr2
set mychar='Rocks'
where mychar='#ENFB';
select * from qtemp.jr2;
Rocks, 2017-08-22 08:51:26.570501, ROB, U, 2017-08-22 08:53:28.175547
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.