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。