oracle存储过程中建临时表并插入数据后,怎么观察里面的数据
CREATEORREPLACEPROCEDURE"P_TEST_TEXT"isOLD_VALvarchar2(100):='{(38400,23),(37900,),(3...
CREATE OR REPLACE PROCEDURE "P_TEST_TEXT" is
OLD_VAL varchar2(100) := '{(38400,23),(37900,),(38950,23),(38098,),(39148,)}';
VAL1 varchar2(100) := substr(OLD_VAL, 2, length(OLD_VAL) - 2);
VAL2 varchar2(100);
VAL3 varchar2(100);
str varchar2(200);
cd number(10) := length(VAL1);
begin
str := 'CREATE GLOBAL TEMPORARY TABLE OLD_TABLE(zfc varchar2(100)) ON COMMIT DELETE ROWS';
execute immediate str;
WHILE cd > 0 LOOP
BEGIN
VAL2 := substr(VAL1, instr(VAL1, '('), instr(VAL1, ')'));
VAL3 := substr(VAL2,instr(VAL2, ',') + 1,instr(VAL1, ')') - instr(VAL2, ',') - 1);
str := 'insert into OLD_TABLE values(VAL1)';
execute immediate str;
VAL1 := substr(VAL1,length(VAL2) + 2,length(VAL1) - length(VAL2) - 1);
cd := length(VAL1);
END;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('发生异常...');
END P_TEST_TEXT;
请问,怎么才能将OLD_TABLE临时表的数据输出出来
select *没用,只是显示编译成功 展开
OLD_VAL varchar2(100) := '{(38400,23),(37900,),(38950,23),(38098,),(39148,)}';
VAL1 varchar2(100) := substr(OLD_VAL, 2, length(OLD_VAL) - 2);
VAL2 varchar2(100);
VAL3 varchar2(100);
str varchar2(200);
cd number(10) := length(VAL1);
begin
str := 'CREATE GLOBAL TEMPORARY TABLE OLD_TABLE(zfc varchar2(100)) ON COMMIT DELETE ROWS';
execute immediate str;
WHILE cd > 0 LOOP
BEGIN
VAL2 := substr(VAL1, instr(VAL1, '('), instr(VAL1, ')'));
VAL3 := substr(VAL2,instr(VAL2, ',') + 1,instr(VAL1, ')') - instr(VAL2, ',') - 1);
str := 'insert into OLD_TABLE values(VAL1)';
execute immediate str;
VAL1 := substr(VAL1,length(VAL2) + 2,length(VAL1) - length(VAL2) - 1);
cd := length(VAL1);
END;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('发生异常...');
END P_TEST_TEXT;
请问,怎么才能将OLD_TABLE临时表的数据输出出来
select *没用,只是显示编译成功 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询