我尝试执行存储过程,但遇到以下问题。
我不知道字符串格式是否有问题。
这是我的错误信息:
错误:查询'MERGE INTO GTN..ON_ORDER_REPORT_TSS_TEST a的执行中出现意外错误12
使用QUANTISENSE_PROD_STAGE..VW_CURRENT_VIEW_OF_LINE_SHEET_HIST b
ON TRIM(a.channel)= TRIM(上(b.channel_desc))
和TRIM(a.style_colour)= TRIM(b.style_opt_numb)
和TRIM(a.season_code)= TRIM(b.season_cd)
和a.STYLE_COLOUR ='IG1501S-034121'
匹配之后
更新SET a.REVISED_IN_STORE_DT = b.REVISED_IN_STORE_DT || '00:00:00', a.PLANNED_IN_STORE_DT = b.PLANNED_IN_STORE_DT || '00:00:00';'
这是我的存储过程的代码:
CREATE OR REPLACE PROCEDURE USP_UPDATE_LINE_SHEET_TEST(CHARACTER VARYING(ANY))
RETURNS CHARACTER VARYING(ANY)
LANGUAGE NZPLSQL AS
BEGIN_PROC
DECLARE
TABLENAME ALIAS FOR $1;
SQL TEXT;
SQLFULL varchar(4000);
BEGIN
SQL := 'MERGE INTO GTN..'||TABLENAME||' a
USING QUANTISENSE_PROD_STAGE..VW_CURRENT_VIEW_OF_LINE_SHEET_HIST b
ON TRIM(a.channel) = TRIM(upper(b.channel_desc))
and TRIM(a.style_colour) = TRIM(b.style_opt_numb)
and TRIM(a.season_code) = TRIM(b.season_cd)
and a.STYLE_COLOUR = ''IG1501S-034121''
WHEN MATCHED THEN
UPDATE SET a.REVISED_IN_STORE_DT = b.REVISED_IN_STORE_DT || '' 00:00:00'',
a.PLANNED_IN_STORE_DT = b.PLANNED_IN_STORE_DT || '' 00:00:00'';';
EXECUTE IMMEDIATE SQL;
END;
END_PROC;
该如何解决该错误?