zOs/SQL/CRETRIPA
SET CURRENT SQLID='S100447';
drop tablespace dgdb9998.a077a;
commit;
CREATE TABLESPACE A077A
IN DGDB9998
USING STOGROUP GSMS
PRIQTY 48 SECQTY 100
ERASE NO
FREEPAGE 0 PCTFREE 10
GBPCACHE CHANGED
TRACKMOD YES
NUMPARTS 3
BUFFERPOOL BP2
LOCKSIZE ANY
LOCKMAX SYSTEM
CLOSE YES
COMPRESS YES
CCSID EBCDIC
DEFINE YES
MAXROWS 255;
--
CREATE TABLE GDB9998.TWK077A
(WK077PART SMALLINT NOT NULL with default,
WK077KEY INTEGER NOT NULL,
WK077Txt CHAR(20) not null with default)
IN DGDB9998.a077A
partition by (wk077part)
( partition 1 ending at (0),
partition 2 ending at (1),
partition 3 ending at (2)
)
;
commit;
create trigger gdb9998.twk077a1Insert no cascade before insert
on gdb9998.twk077a referencing New as New
for each row mode db2sql
set WK077PART = MOD(new.WK077KEY, 3)
;
create trigger gdb9998.twk077a1Update no cascade before
update of WK077PART, WK077KEY
on gdb9998.twk077a referencing New as New
for each row mode db2sql
set WK077PART = MOD(new.WK077KEY, 3)
;
insert into gdb9998.twk077a values (77, 30, 'dreissig');
insert into gdb9998.twk077a (wk077key, wk077txt)
values(31, 'einUndDreissig');
insert into gdb9998.twk077a values (77, 32, 'zweiUndDreissig');
select * from gdb9998.twk077a;
update gdb9998.twk077a set wk077Part = 99;
select * from gdb9998.twk077a;
insert into gdb9998.twk077a
select wk077Key + 55, wk077Key + 10, '+zenh'
from gdb9998.twk077a;
insert into gdb9998.twk077a
select wk077Key + 55, wk077Key + 20, '+zwan'
from gdb9998.twk077a;
insert into gdb9998.twk077a
select wk077Key + 55, wk077Key + 55, '+ff'
from gdb9998.twk077a;
select * from gdb9998.twk077a;
commit;