在HANA数据库中使用NEWUID()函数

时间:2019-07-03 07:00:23

标签: sql hana

我正在尝试使用NEWUID()函数生成唯一数字,但由于语法可能存在错误,因此无法执行代码。

我该如何纠正呢?

谢谢。

{
  "name": "users-manager-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "serve": "vue-cli-service serve --mode local",
    "build_dev": "vue-cli-service build --mode dev",
    "build_stg": "vue-cli-service build --mode stg",
    "build_prod": "vue-cli-service build --mode prod"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "babel-polyfill": "^6.26.0",
    "css-vars-ponyfill": "^1.16.2",
    "deepmerge": "^3.3.0",
    "em-common-vue": "^0.1.0",
    "fibers": "^4.0.1",
    "innersvg-polyfill": "0.0.2",
    "lodash": "^4.17.11",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.23",
    "sass-loader": "^7.1.0",
    "vue": "^2.5.21",
    "vue-i18n": "^8.8.0",
    "vue-material-design-icons": "^3.0.0",
    "vue-router": "^3.0.1",
    "vuetify": "^2.0.0-beta.5",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.3.0",
    "@vue/cli-plugin-eslint": "^3.3.0",
    "@vue/cli-service": "^3.5.3",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0",
    "sass": "^1.22.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-template-compiler": "^2.5.21",
    "vuetify-loader": "^1.0.5"
  }
}

应生成如下数字:

IT1225-513613161514161

1 个答案:

答案 0 :(得分:0)

代码对我来说没问题。您有Wat错误讯息吗?您能否进一步说明一下您使用的HANA版本?

我执行了以下类似的SQL代码,并且有效:

CREATE PROCEDURE GENERATINGN (IN p_docentryt NVARCHAR(50))
LANGUAGE SQLSCRIPT 
AS
BEGIN
SELECT cast("ItemCode" || '-' || NEWUID() as nvarchar(50)) AS "UNIQUEIDENTIFIER"
FROM (
  SELECT 'my-ItemCode' as "ItemCode" FROM DUMMY
);
END;