我在做一個過程。稱爲PRC_CHECKING_PROCEDURE
。這個過程的作用是檢查行是否存在。在執行查詢時在過程中包含主鍵值
我有這樣的查詢:Insert into tab1 (code, text) (1 ,'test')
代碼是主鍵。
程序的作用是爲上面的查詢做了檢查,因此程序將使它這樣的方式:
declare cnt;
begin
select count(1) into cnt from tab1 where code = ?? (here is my question how to pass the value)
if count =0 then
'Insert into tab1 (code, text) (1 ,'test')
end if;
end;
我的問題是有辦法,我可以通過主鍵的值並放入程序?
你想檢查代碼值,試圖插入..已經存在。? –