将 CLOB 传递给 Sys 过程 SAP HANA
Pass CLOB TO Sys procedure SAP HANA
如何在不出错的情况下将 clob 传递给系统过程?
我正在努力通过
CALL SYS.GET_PROCEDURE_OBJECTS(CREATE PROCEDURE "IA_ATP"."ia_xsjob.xsjob_procedures_folder::atp_procedure" ( )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS BEGIN
DROP TABLE IA_ATP.ATP;
CREATE COLUMN TABLE IA_ATP.ATP AS (SELECT ATP_VIEW.*, UTCTOLOCAL(CURRENT_UTCTIMESTAMP,'EST') AS CREATE_TS FROM IA_ATP.ATP_VIEW WHERE
OPEN_PRICE_REQUESTS <>0
OR TOTAL_ON_HAND <> 0
OR OPEN_CUSTOMER_ORDERS <> 0
OR OPEN_CUSTOMER_DELIVERIES <> 0
OR OPEN_OUTBOUND_STOS <> 0
OR ATP <> 0
OR NEGATIVE_ATP <> 0
OR BLOCK_STOCK <> 0
);END;
程序 "SYS"."GET_PROCEDURE_OBJECTS"
尚未记录为一般用途。
但我成功地从 SQL 脚本上下文中调用了它:
有一个过程定义:
create procedure pr_test (in i int)
as
begin
declare a, b int;
select :i into a from dummy;
select count(*) into b from objects;
select :a, :b, :a*:b from dummy;
end;
call pr_test(10);
将此源代码分配给一个CLOB
变量并使用此变量调用系统过程:
do begin
declare proc_source clob;
proc_source :='create procedure pr_test (in i int)
as
begin
declare a, b int;
select :i into a from dummy;
select count(*) into b from objects;
select :a, :b, :a*:b from dummy;
end;';
CALL SYS.GET_PROCEDURE_OBJECTS(:proc_source);
end;
从系统视图获取程序结果PROCEDURE_OBJECTS
:
select * from procedure_objects;
SCHEMA_NAME PROCEDURE_NAME OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE_ID OBJECT_TYPE START_POSITION END_POSITION
SYSTEM PR_TEST PUBLIC DUMMY 128 SYNONYM 100 105
SYSTEM PR_TEST SYS DUMMY 32 TABLE 100 105
SYSTEM PR_TEST PUBLIC OBJECTS 128 SYNONYM 141 148
SYSTEM PR_TEST SYS OBJECTS 31 VIEW 141 148
SYSTEM PR_TEST PUBLIC DUMMY 128 SYNONYM 189 194
SYSTEM PR_TEST SYS DUMMY 32 TABLE 189 194
如何在不出错的情况下将 clob 传递给系统过程?
我正在努力通过
CALL SYS.GET_PROCEDURE_OBJECTS(CREATE PROCEDURE "IA_ATP"."ia_xsjob.xsjob_procedures_folder::atp_procedure" ( )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS BEGIN
DROP TABLE IA_ATP.ATP;
CREATE COLUMN TABLE IA_ATP.ATP AS (SELECT ATP_VIEW.*, UTCTOLOCAL(CURRENT_UTCTIMESTAMP,'EST') AS CREATE_TS FROM IA_ATP.ATP_VIEW WHERE
OPEN_PRICE_REQUESTS <>0
OR TOTAL_ON_HAND <> 0
OR OPEN_CUSTOMER_ORDERS <> 0
OR OPEN_CUSTOMER_DELIVERIES <> 0
OR OPEN_OUTBOUND_STOS <> 0
OR ATP <> 0
OR NEGATIVE_ATP <> 0
OR BLOCK_STOCK <> 0
);END;
程序 "SYS"."GET_PROCEDURE_OBJECTS"
尚未记录为一般用途。
但我成功地从 SQL 脚本上下文中调用了它:
有一个过程定义:
create procedure pr_test (in i int)
as
begin
declare a, b int;
select :i into a from dummy;
select count(*) into b from objects;
select :a, :b, :a*:b from dummy;
end;
call pr_test(10);
将此源代码分配给一个CLOB
变量并使用此变量调用系统过程:
do begin
declare proc_source clob;
proc_source :='create procedure pr_test (in i int)
as
begin
declare a, b int;
select :i into a from dummy;
select count(*) into b from objects;
select :a, :b, :a*:b from dummy;
end;';
CALL SYS.GET_PROCEDURE_OBJECTS(:proc_source);
end;
从系统视图获取程序结果PROCEDURE_OBJECTS
:
select * from procedure_objects;
SCHEMA_NAME PROCEDURE_NAME OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE_ID OBJECT_TYPE START_POSITION END_POSITION
SYSTEM PR_TEST PUBLIC DUMMY 128 SYNONYM 100 105
SYSTEM PR_TEST SYS DUMMY 32 TABLE 100 105
SYSTEM PR_TEST PUBLIC OBJECTS 128 SYNONYM 141 148
SYSTEM PR_TEST SYS OBJECTS 31 VIEW 141 148
SYSTEM PR_TEST PUBLIC DUMMY 128 SYNONYM 189 194
SYSTEM PR_TEST SYS DUMMY 32 TABLE 189 194