使用Oracle 11g我想如何將new_table的行輸出到假脫機文件並對我正在採取的方法進行完整性檢查。PL SQL代碼來從兩個模式和多個視圖獲得可能的差異數據具有相同的意見,並應具有相同的數據
我不能做一個選擇使用變量,因爲我在看很多視圖和字段是不同的每個。
當我在一個測試視圖(其中我修改了基表與第二個模式不同)後,我得到了所需的結果集。
但是我怎麼能得到這個輸出爲dbms_output.print_line?還是有更好的解決方案?
謝謝。
DECLARE
sql_stmt varchar2(400);
cursor c1 is SELECT view_name from all_views where owner = 'ownerx’ AND view_name like 'xxx_%' OR view_name like 'yyy_%' order by view_name;
BEGIN
for i IN c1 loop
sql_stmt := 'create table new_table as select * FROM schemaa.'||i.VIEW_NAME||' minus ' || 'select * FROM schemab.'||i.VIEW_NAME;
execute immediate sql_stmt;
dbms_output.put_line(sql_stmt);
-- Wish to list the result set from new_table via dbms_output.put_line()
execute immediate 'drop table new_table';
END;
感謝Aleksej的及時回覆。我會檢查出來的。 – user3797654
Aleksej。這很好!謝謝。 – user3797654