I am trying to create a table DDL in SAP HANA that populates UUID
when the user inserts records to the TEST table.
CREATE TABLE TEST
(
TEST_ID NUMBER(10) NOT NULL,
TEST_NAME NVARCHAR2(50) NOT NULL,
UUID NVARCHAR2(100) SYSUUID NOT NULL
);
But this statement fails and came to know calling SYSUUID in DDL is not supported.
Then I tried to create a trigger as follows
CREATE TRIGGER TEST_TR
AFTER INSERT ON DIM
REFERENCING NEW ROW newRow
BEGIN
UPDATE TESTSET UUID = SYSUUID WHERE TEST_ID = :newRow.TEST_ID;
END;
now got the error message
SAP DBTech JDBC: [451]: modification of subject table in trigger not allowed: DEMO.TEST
Then I created a procedure to populate UUID as follows
create procedure Test(IN Testid Number) language SQLSCRIPT AS
BEGIN
UPDATE TESTSET UUID = SYSUUID WHERE TEST_ID = :Testid ;
END;
and calling this procedure in tigger
CREATE TRIGGER TEST_TR
AFTER INSERT ON DIM
REFERENCING NEW ROW newRow
BEGIN
CALL Test(:newRow.TEST_ID);
END;
Now get the following error
Could not execute 'CREATE TRIGGER TEST_TR AFTER INSERT ON DIM REFERENCING NEW ROW newRow BEGIN CALL ...' in 95 ms 671 µs .
SAP DBTech JDBC: [7]: feature not supported: call procedure is not supported in trigger
Please suggest a way to implement this SAP HANA. I dont like to implement this via application code.
I would like DB to populate UUID when the user inserts a record to the table.