SAP HANA AFL插件库升级后之前生成的存储过程升级方法(PAL升级方法)

简介:

在AFL库升级之后,之前创建的存储过程需要进行相应的升级,这个时候一般需要重新运行AFL_WRAPPER_GENERATOR。在前面的例子中,我们知道在重新运行该存储过程的时候,因为之前已经生成相应的存储过程,则一定会报错。如何应对这种情况?

之前已生成的实例: http://www.cnblogs.com/omygod/archive/2013/05/03/3056971.html

 

SAP HANA提供两种方法:

1. 手工删除之前的存储过程及表类型,再重新运行AFL_WRAPPER_GENERATOR。该方法在之前的文章中已有提及:

http://www.cnblogs.com/omygod/archive/2013/05/04/3059728.html

DROP PROCEDURE _SYS_AFL.PAL_TS_S;
DROP TYPE _SYS_AFL.PAL_TS_S__TT_P1;
DROP TYPE _SYS_AFL.PAL_TS_S__TT_P2;
DROP TYPE _SYS_AFL.PAL_TS_S__TT_P3;

CALL SYSTEM.AFL_WRAPPER_GENERATOR ('PAL_TS_S', 'AFLPAL', 'SINGLESMOOTH', PAL_TS_SIGNATURE);


 

2. SAP Note 1830239提供解决方法,该文主要从该方法进行探讨

SAP Note 1830239具体内容为:

Summary

Symptom


You run AFL_WRAPPER_GENERATOR and get an error like:

"SAP DBTech JDBC: [423]: liveCache error: [423] SYSTEM.AFL_WRAPPER_GENERATOR: line 35 col 1 (at pos 1718): liveCache error exception: liveCache error: registration finished with errors, see indexserver trace"

And in the indexserver trace there is a message like:

"cannot use duplicate user-defined type name - PAL_TS_S__TT_P2: line 1 col 22 (at pos 21): line 1 col 22 (at pos 21)"


Other terms


AFL error, PAL

Reason and Prerequisites


You are using AFL_WRAPPER_GENERATOR to generate a procedure to call a PAL Application Function. The procedure was already generated before in a previous call to the wrapper generator. Now you are facing duplicates.

The PAL manual describes how all tables types and the procedure itself have to be dropped manually in advance. But this step  was not perfomed (successfully).


Solution


Instead of dropping all relevant table types and the procedure manually the counter part to AFL_WRAPPER_GENERATOR called AFL_WRAPPER_ERASER can be used.

Please proceed as follows:

1. Connect to the database as user SYSTEM via Hana Studio. 2. Copy the attached file afl_wrapper_eraser.txt to a sql window and execute it. 3. Grant the execution of afl_wrapper_eraser to the relevant user:

           grant execute on system.afl_wrapper_eraser to ...

4. Connect as this user and run system.afl_wrapper_eraser for the procedure causing trouble.




Header Data

   
Release Status: Released for Customer
Released on: 05.04.2013  11:20:16
Master Language: English
Priority: Correction with medium priority
Category: Program error
Primary Component: BC-DB-HDB-AFL SAP HANA Application Function Library

Affected Releases

Release-Independent

 

 

该Note所阐释的方法如下:

1. 生成系统存储过程AFL_WRAPPER_ERASER。sql语句如下:

CREATE PROCEDURE afl_wrapper_eraser(IN procOrig VARCHAR(100)) LANGUAGE SQLSCRIPT
AS
v_num integer := 0;
v_sqlscript VARCHAR(32767) := '';
proc VARCHAR(32767) := UPPER(:procOrig);
CURSOR c_parameter_table_name FOR
   SELECT TABLE_NAME
        FROM "SYS"."TABLES"
        WHERE SCHEMA_NAME = '_SYS_AFL'
        AND TABLE_NAME like :proc || '__TT_P%';
BEGIN

-- proc
select count(1) into v_num from SYS.PROCEDURES where SCHEMA_NAME = '_SYS_AFL' and PROCEDURE_NAME = :proc;
if :v_num > 0 then
   v_sqlscript := 'drop procedure _SYS_AFL.' || proc;
   exec :v_sqlscript;
end if;

-- type
select count(1) into v_num from SYS.TABLES where SCHEMA_NAME = '_SYS_AFL' and TABLE_NAME like :proc || '__TT_P%';
if :v_num > 0 then
   v_sqlscript := 'drop type _SYS_AFL.';
   FOR cur_row_detail AS c_parameter_table_name DO
        v_sqlscript := :v_sqlscript || cur_row_detail.TABLE_NAME;
        exec :v_sqlscript;
        v_sqlscript := 'drop type _SYS_AFL.';
   END FOR;
end if;

END;
 
2. 如果运行该存储过程的为其他用户,我们需要对其他用户进行授权:

GRANT EXECUTE ON SYSTEM.AFL_WRAPPER_ERASER TO User1;

该方法会删除方法及相应的table type。

3. 重新运行AFL_WRAPPER_GENERATOR。

 

实例如下:

CALL SYSTEM.AFL_WRAPPER_ERASER ('PAL_TS_S');

CALL SYSTEM.AFL_WRAPPER_GENERATOR ('PAL_TS_S', 'AFLPAL', 'SINGLESMOOTH', PAL_TS_SIGNATURE);

专注于企业信息化,最近对股票数据分析较为感兴趣,可免费分享股票个股主力资金实时变化趋势分析工具,股票交流QQ群:457394862
分类:  SAP HANA

本文转自沧海-重庆博客园博客,原文链接:http://www.cnblogs.com/omygod/archive/2013/05/04/3059841.html,如需转载请自行联系原作者
目录
相关文章
|
存储 Oracle 关系型数据库
mysql存储过程调试方法
mysql存储过程调试方法
815 0
|
7月前
|
Oracle 关系型数据库 数据库
SAP内核(KERNEL)升级
SAP内核(KERNEL)升级
143 1
|
SQL 存储 JavaScript
SAP HANA 详细介绍
SAP HANA 详细介绍
1009 0
|
存储 Oracle Java
[亲测可用]hibernate调用Oracle存储过程|Spring Data JPA调用Oracle存储过程方法
[亲测可用]hibernate调用Oracle存储过程|Spring Data JPA调用Oracle存储过程方法
|
大数据
为什么要学习SAP HANA
大数据最近几年是一个比较火的名词,2015年读过一本叫做《大数据时代》的书,航空机票的例子让我记忆犹新。如今工作中接触到SAP HANA,勾起了我心中对大数据的欲望。
114 1
|
存储 缓存 算法
「内存数据库」SAP HANA的不可告人的秘密
「内存数据库」SAP HANA的不可告人的秘密
|
存储 SQL Oracle
Oracle 存储过程和方法全攻略:实战详解调用技巧与注意事项
Oracle 存储过程和方法全攻略:实战详解调用技巧与注意事项
930 0
|
存储 缓存 算法
「首席看HANA」SAP HANA的秘密- 不要告诉任何人
「首席看HANA」SAP HANA的秘密- 不要告诉任何人
|
大数据
《CIO指南:如何使用SAP HANA平台处理大数据》电子版地址
CIO指南:如何使用SAP HANA平台处理大数据
105 2
《CIO指南:如何使用SAP HANA平台处理大数据》电子版地址
【SAP Hana】JAVA代码访问SAP HANA
【SAP Hana】JAVA代码访问SAP HANA
151 0