回覆列表
-
1 # lhsag1991
-
2 # 使用者3920320951631
CREATE OR REPLACE PROCEDURE list_xs_name as
str_sql varchar2(2000);
begin
str_sql := "create global temporary table xs_name (xh int,name varchar2(255),kc varchar2(255),fs int) on commit preserve rows";
execute immediate str_sql;
str_sql := "select * from xs_name";
execute immediate str_sql;
dbms_output.put_line(str_sql);
END;
這個過程就行了。。create or replace procedure wymauthid current_useris vn_ctn number(2);begin select count(*) into vn_ctn from user_all_tables a where a.table_name like upper("invbasdoc"); if vn_ctn > 0 then execute immediate "drop table invbasdoc"; end if; execute immediate "create table invbasdoc as select * from test_abcd";end ;原來的過程中:execute immediate "drop table invbasdoc"; 當如果資料庫中不存在這張表的時候就會報錯的。。上面是對資料庫中是否存在表進行了判斷,因此能夠避免“表不存在”這樣的錯誤。。