我要的kingbase的存储过程不是函数
时间: 2024-01-02 09:03:33 浏览: 65
非常抱歉,我的回答有误。在Kingbase中,存储过程的创建方式与函数类似,只需要将返回类型改为`void`即可。以下是修改后的Kingbase存储过程语句:
DROP PROCEDURE IF EXISTS schema_change;
CREATE PROCEDURE schema_change() AS $$
BEGIN
CREATE TABLE IF NOT EXISTS "bis_record_upload_list" (
"pkid" serial NOT NULL,
"hash_code" character varying(255) DEFAULT NULL,
"path" character varying(255) DEFAULT NULL,
CONSTRAINT "bis_record_upload_list_pk" PRIMARY KEY ("pkid"),
CONSTRAINT "bis_record_upload_list_hash_code_key" UNIQUE ("hash_code")
);
IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = 'bis_record_upload_list' AND column_name = 'hash_code') THEN
ALTER TABLE "bis_record_upload_list" ADD COLUMN "hash_code" character varying(255) DEFAULT NULL;
END IF;
END;
$$ LANGUAGE PLPGSQL;
CALL schema_change();
DROP PROCEDURE IF EXISTS schema_change;
阅读全文