Hello All,
Through procedure I am trying to insert data into the target(EX_92) table(with schema flexibility)
Source table data
| ID | PRODUCT_CODE | PRODUCT_NAME | PRICE | COLOR | TYPE |
| 1 | 1 | rugg | 101.22 | ||
| 2 | 1 | rugg | 101.22 | ||
| 3 | 2 | book | 200.32 | BLUE | Y |
Target table QUERY
drop table EX_P2;
CREATE COLUMN TABLE EX_P2(
ID INTEGER PRIMARY KEY,
PRODUCT_CODE VARCHAR(3),
PRODUCT_NAME NVARCHAR(20),
PRICE DECIMAL(5,2)
) WITH SCHEMA FLEXIBILITY;
Procedure to insert above records with additional columns into the target table(EX_P2)
| Procedure |
|---|
drop procedure "DS_O1"."PROC"; create procedure "DS_O1"."PROC"(IN max_value INTEGER, IN schema_name varchar(40), IN table_name varchar(40), IN column_list varchar(400)) LANGUAGE SQLSCRIPT AS BEGIN DECLARE maxid integer :=0; DECLARE INSERT_STR VARCHAR(1000) :=''; select max(ID) into maxid from "DS_O1"."EX_P2"; select :maxid from dummy; INSERT_STR :='insert into "' || 'DS_O1' ||'"."EX_P2" ('||:column_list||') (select ' ||:column_list||' FROM "'||:schema_name||'"."'||:table_name||'"' || ' where ID >' || :max_value || ')'; EXECUTE immediate(:INSERT_STR); END; |
Now while executing above procedure
CALL "DS_O1"."PROC" ( 0, 'DS_O1', 'TMP_EXL2','ID,PRODUCT_CODE,PRODUCT_NAME,PRICE,COLOR,STATUS,TYPE');
I am getting the following error
Could not execute 'CALL "DS_O1"."PROC" ( 0, 'DS_O1', 'TMP_EXL2','ID,PRODUCT_CODE,PRODUCT_NAME,PRICE,COLOR,STATUS,TYPE')' in 23 ms 564 µs .
SAP DBTech JDBC: [7]: feature not supported: [7] "DS_O1"."PROC": line 18 col 1 (at pos 779): [7] (range 3): feature not supported: cannot add column to flexible table when ddl autocommit is off