本文介绍了在select语句中使用时,表存在于存储过程中,但在insert语句中使用时则不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当在存储过程中使用的表another_schema.Dw_table仅用于获取其工作的数据,但是当我在Insert语句中使用它时抛出PL / SQL:ORA-00942表或视图不存在。
我尝试过:
When table another_schema.Dw_table used in store procedure only to fetch the data its working there but when I used in Insert statement it throws PL/SQL: ORA-00942 table or view does not exist.
What I have tried:
create or replace procedure tpk.sp_Test_proc
IS
err_code NUMBER;
err_msg VARCHAR (500);
v_tbl_cnt NUMBER;
v_tbl_valid NUMBER;
Begin
SELECT COUNT(*) INTO v_tbl_cnt FROM USER_TABLES
WHERE TABLE_NAME IN (UPPER('Tbl1'),UPPER('tbl2'),UPPER('tbl3'));
IF(v_tbl_cnt =3) THEN
EXECUTE IMMEDIATE 'TRUNCATE TABLE Tbl1';
EXECUTE IMMEDIATE 'TRUNCATE TABLE Tbl2';
EXECUTE IMMEDIATE 'TRUNCATE TABLE Tbl3';
EXECUTE IMMEDIATE 'DROP TABLE Tbl1';
EXECUTE IMMEDIATE 'DROP TABLE Tbl2';
EXECUTE IMMEDIATE 'DROP TABLE Tbl3';
EXECUTE IMMEDIATE
'CREATE global temporary TABLE tbl1
( Id Integer... )'
Insert into tbl1
Select * from another_schema.Dw_table /* In this line it throws error Table does not exist */
end if;
end;
推荐答案
这篇关于在select语句中使用时,表存在于存储过程中,但在insert语句中使用时则不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!