Understanding SAP HANA Update and Delete Rules

To avoid data integrity problems when updating or deleting data, you need to specify a primary key on your table.

This example uses DBTYPE= to create the primary key.

libname invty saphana server=mysrv1 port=30015 user=myusr1;

proc sql;
drop table invty.STOCK23;
quit;

data invty.STOCK23(DBTYPE=(RECDATE="date not null,primary key(RECDATE)") );
  input PARTNO $ DESCX $ INSTOCK @17
        RECDATE date7. @25 PRICE;
  format RECDATE date7.;
  datalines;

K89R  seal     34  27jul95  245.00
M447  sander   98  20jun95   45.88
LK43  filter  121  19may96   10.99
MN21  brace    43  10aug96   27.87
BC85  clamp    80  16aug96    9.55
KJ66  cutter    6  20mar96   24.50
UYN7  rod     211  18jun96   19.77
JD03  switch  383  09jan97   13.99
BV1I  timer    26  03jan97   34.50
;

These next examples show how you can update the table now that STOCK23 has a primary key.

proc sql;
update invty.STOCK23 set price=price*1.1 where INSTOCK > 50;
quit;

proc sql;
delete from invty.STOCK23 where INSTOCK > 150;
quit;
Last updated: February 3, 2026