如何在SAP HANA中为变量分配列值

2020-09-28 12:13发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)嗨, 在这里,我尝试根据使用过...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

在这里,我尝试根据使用过程订购的数量给予折扣。 但是我不知道如何在过程中将column的值分配给变量。

这是我的代码:

创建列表" KABIL_PRACTICE"。" SALES_IF_ELSE"
 (
 " SALES_ID"整数,
 " PRODUCT_ID"整数,
 " QTY"整数,
 " DISCOUNT"整数,
 " SALES_AMOUNT"双
 );

 " SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值(1,101,15,1500)插入到" KABIL_PRACTICE"中;
 " SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值(2,102,25,2500);将其插入" KABIL_PRACTICE"。
 值" 3,103,35,3500";" SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值插入到" KABIL_PRACTICE"中;
 值" 4,104,40,4000"中的" SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")插入到" KABIL_PRACTICE"中;
 " SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值(5,105,27,2700);将其插入" KABIL_PRACTICE"。
 " SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值(6,106,32,3200)插入;并插入" KABIL_PRACTICE"中。
 值(7,107,19,1900);" SALES_IF_ELSE"(" SALES_ID"," PRODUCT_ID"," QTY"," SALES_AMOUNT")值插入到" KABIL_PRACTICE"中;


 创建过程" KABIL_PRACTICE"。" IF_ELSE_DISC"
  语言sqlscript
  一开始
   声明QTY整数;
    " SALES_IF_ELSE":=数量;从" KABIL_PRACTICE"中选择"数量"。
  如果(数量> 25)
  然后
  更新" KABIL_PRACTICE"。" SALES_IF_ELSE"设置为" DISCOUNT" = 5;
  否则,如果
  更新" KABIL_PRACTICE"。" SALES_IF_ELSE"设置为" DISCOUNT" = 1;
  万一;
  万一;
  结束;
 

有人帮助我。...

3条回答
暮风yp
2020-09-28 12:48

能否请您多解释一下您想要达到的目标? 您是要计算单个条目的折扣(如果是,限制条件在哪里),还是要更新所有条目的折扣?

在您当前的示例中,尝试读取单个" QTY"值没有太大意义,因为结果将始终是数组而不是单个值。

关于,
弗洛里安

一周热门 更多>