Oracle中,寫儲存過程,如何比較兩條記錄是否相同,兩條記錄分別來自兩張表,表結構相同

2022-12-01 21:45:16 字數 1351 閱讀 1101

1樓:匿名使用者

declare

v_count pls_integer;

begin

select count(*) into v_countfrom

(select * from tb1 whereminus

select * from tb2 where ...

);if v_count=0 then

dbms_output.put_line ('2條資料完全相等');

else

dbms_output.put_line ('2條資料不完全相等');

end if

end;

2樓:匿名使用者

利用minus語法。

v_count number;

select count(*) into v_count from(select * from tbl1 where ***minus

select * from tbl2 where ****)if v_count=0 then

相同else

不相同end if;

在oracle中 怎樣對比兩個資料庫中相同表的資料? 20

3樓:匿名使用者

如果是兩個資料庫的話,建議建立一個dblink,通過dblink取兩個資料庫中相同的表,然後看你要求是比對出相同的,還是不同的資料,用sql+函式就能搞定了!

4樓:dl_會飛的青蛙

你是兩個資料庫還是一個庫下的兩個user!~如果是一個庫裡的兩個user

select * from sanwa_admin.mu010,ucoop.mc00030

在表前面加上使用者名稱就可以了!~

你還是詳細說下吧!~

5樓:my天狼星

是不是跨資料庫啊

6樓:匿名使用者

先取一個表的count

可以使用union取交集求count,看條相同資料的數量是否一致

儲存過程怎麼使用兩個表中相同的引數來查詢資料?

7樓:匿名使用者

select 表2.customername,表2.orderid,表2.content

from 表1,表2

where 表1.customername=表2.customername and 表1.customerid=輸入的customerid

oracle儲存過程引數例項,oracle儲存過程引數例項

create or replace procedure bak table info tablename in varchar2 50 issql varchar2 200 out mes varchar2 200 begin sql select from tablename execute im...

oracle 儲存過程報錯 pls 00103 求查錯

其中username counter rolename 是傳入引數,傳入引數不能賦值,即第7 8行語句有問題,建議刪除。建議在plsql工具中編輯,方便。擴充套件資料 儲存過程 stored procedure 是在大型資料庫系統中,一組為了完成特定功能的sql 語句集,儲存在資料庫中,經過第一次編...

oracle定義儲存過程時什麼時候需要使用

oracle 的儲存過程裡沒有declare的語法,觸發器和plsql塊才是declare 如果要定義變數,後面直接跟is的 create or replace procedure c ispara number begin end 你在寫儲存過程的時候是 create or replace p n...