on 10-21-2021 6:45 AM
Hi. I'm trying to create a table in hana cloud. According to hana cloud sql reference, "on update" should work fine, but it keeps generate syntax error.
My question is, how can I create a table that automatically updates a certain column, using "on update" query? (in this case, it should change REG_DATE when the row is updated).
Many thanks. That works. So...since your answer also excluded the <on update current_timestamp> part, is it safe to assume that there are no such method to implement that functionality?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my original database (which is mariadb), the DDL for the table is like the following statments.
CREATE TABLE `app_info` (
`APP_INFO_NDX` bigint(20) NOT NULL ',
`APP_OS` varchar(100) NOT NULL COMMENT,
`APP_VER` varchar(100) NOT NULL COMMENT,
`APP_DETAIL` varchar(1000) DEFAULT NULL,
`USE_YN` varchar(20) NOT NULL COMMENT,
`APP_REG_DT` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ,
`ATTACH_GRP_NO` bigint(20) NOT NULL,
PRIMARY KEY (`APP_INFO_NDX`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
The problematic point is written in bold. It seems like hana db does not support <on update current_timestamp> query, which is available in mariadb. I want it working properly in hana cloud as well, because I need to know the last modification timestamp of updated record rows. I've tried to use a trigger, but it is not working in hana db. Any suggestions or ideas to solve this problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi kimkeunho
CREATE TABLE app_info (
APP_INFO_NDX bigint NOT NULL,
APP_OS varchar(100) NOT NULL,
APP_VER varchar(100) NOT NULL,
APP_DETAIL varchar(1000) DEFAULT NULL,
USE_YN varchar(20) NOT NULL,
APP_REG_DT timestamp NOT NULL DEFAULT current_timestamp ,
ATTACH_GRP_NO bigint NOT NULL,
PRIMARY KEY (APP_INFO_NDX)
)
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.