如何通过存储过程从包含多个字段的记录变量中将数据插入表中?
场景是:
create or replace
PROCEDURE CAN_PRICE AS
TYPE REC IS RECORD(FILLER VARCHAR2(20),PACKAGE_SIZE VARCHAR2(20),WHOLESALE_PRICE VARCHAR2(20),DEALERMBA VARCHAR2(20),DEALER_PRICE VARCHAR2(20),UNIT_OF_MEASURE VARCHAR2(20),PART_SYMBOL VARCHAR2(20),CORE_CHANGE VARCHAR2(20),FILLER1 VARCHAR2(20),PART_CLASS VARCHAR2(20),TRADE_PRICE VARCHAR2(20),RETAIL_PRICE VARCHAR2(20));
TYPE T1 IS TABLE OF NUMBER;
CURSOR C1 is SELECT ROW_NUMBER FROM TEMP1 WHERE TRADE_PRICE LIKE '%SEE%';
T T1;
R REC;
P VARCHAR2(20);
P1 NUMBER;
BEGIN
OPEN C1;
FETCH C1 BULK COLLECT INTO T;
CLOSE C1;
FOR i IN T.FIRST .. T.LAST
LOOP
SELECT PART_NUMBER INTO P FROM TEMP1 WHERE ROW_NUMBER =T(i);
SELECT FILLER,PACKAGE_SIZE,WHOLESALE_PRICE,DEALERMBA,DEALER_PRICE,UNIT_OF_MEASURE,PART_SYMBOL,CORE_CHANGE,FILLER1,PART_CLASS ,TRADE_PRICE,RETAIL_PRICE INTO R FROM TEMP1 WHERE ROW_NUMBER=T(i)+1;--FOR EXCHANGE ROW
SELECT TO_NUMBER(WHOLESALE_PRICE) INTO P1 FROM TEMP1 WHERE ROW_NUMBER=T(i)+2;--FOR CORE CHARGE
EXECUTE(' INSERT INTO CHR_CS_BL_1.BL_MACS_CAN_PRICE(FILLER,
PACKAGE_SIZE,
WHOLESALE_PRICE,
DEALERMBA,
DEALER_PRICE,
UNIT_OF_MEASURE ,
PART_SYMBOL,
CORE_CHANGE,
PART_NUMBER,
FILLER1,
PART_CLASS ,
RETAIL_PRICE ,
CORE_CHG )
VALUES
(R.FILLER,R.PACKAGE_SIZE,TO_NUMBER(R.WHOLESALE_PRICE) ,TO_NUMBER(R.DEALERMBA),TO_NUMBER(R.DEALER_PRICE),
R.UNIT_OF_MEASURE,R.PART_SYMBOL,R.CORE_CHANGE,P,R.FILLER1,R.PART_CLASS ,TO_NUMBER(R.TRADE_PRICE),TO_NUMBER(R.RETAIL_PRICE),P1)');
END LOOP;
END;
---我想在表BL_MACS_CAN_PRICE中插入HELR IN RECORD VARIABLE R的值? 如何实现?