gpt4 book ai didi

hana - 不允许标量类型 : SQLSCRIPT

转载 作者:行者123 更新时间:2023-12-03 09:26:21 27 4
gpt4 key购买 nike

由于 SQL 知识有限,我在 HANA 数据库上编写了一个过程,这里是我的代码的一小部分。

CREATE PROCEDURE _SYS_BIC.claims(OUT percent_value distinct_values) 
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
READS SQL DATA AS
BEGIN
/*****************************
write your procedure logic
******************************/

declare orgid_artikel_sofort decimal(8,0):= 0;
declare matnr_ertrag varchar(18) :=null;
declare count_result_sofort BIGINT := 0;
declare count_value BIGINT := 0;
declare verhw_value BIGINT := 0;
declare vnthw_value BIGINT := 0;
declare refid_value decimal(9,0) := 0;
declare cntr BIGINT :=0;


RESULT_SOFORT = select "REFID", "ORGID_WE", "ARTIKEL", "ORGID_ARTIKEL", "HERSTELLER", sum("WERT")as WERT, sum("BZBAS_AW") as BZBAS_AW
from "SYSTEM"."T000_SOFORT"
GROUP BY "REFID", "ORGID_WE", "ARTIKEL", "ORGID_ARTIKEL", "HERSTELLER" ;

select count("refid") into count_result_sofort from :RESULT_SOFORT;

FOR RESULT_SOFORT IN 0 .. :count_result_sofort DO

select "REFID" into refid_value from :RESULT_SOFORT;

RESULT_ERTRAG = select "REFID", "LIFNR", "MATNR", "ORGID", "VNTHW", "VERHW" from "SYSTEM"."T000_ERTRAG" TO where :refid_value= "REFID" ;

select :ORGID_ARTIKEL into orgid_artikel_sofort from :RESULT_SOFORT ;

select "MATNR", "VNTHW", "VERHW" into matnr_ertrag. vnthw_value, verhw_value from :RESULT_ERTRAG;

If :orgid_artikel_sofort = :matnr_ertrag then
percent_value := (verhw_value)/(vnthw_va1ue/100);
End IF ;
END FOR ;

END ;

enter image description here

当我运行以下命令时出现错误

Error creating procedure; scalar type is not allowed: line 25 col 39 (at pos 1037) at ptime/query/checker/check_proc.cc:383

标量变量指定的是什么?我被困住了,请帮忙。

最佳答案

只是猜测,在第 32 行你有

SELECT :ORGID_ARTIKEL into ...

也许你的意思是

SELECT "ORGID_ARTIKEL" into ...

关于hana - 不允许标量类型 : SQLSCRIPT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20997537/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com