stored procedure using the IF NOT EXISTS

时间:2015-10-30 21:56:00

标签: oracle stored-procedures plsql

I am researching issues regarding oracle. I'm creating stored procedures and boot the following errors I also show them in the picture, I hope to help me resolve the error.

[enter image description here]

2 个答案:

答案 0 :(得分:1)

您可以在过程中添加变量v_count number :=0;以检查值是否存在。

示例:

CREATE OR REPLACE PROCEDURE PROCEDURE_NAME(PARAMETERS) IS
V_COUNT NUMBER := 0;

BEGIN
SELECT COUNT(1)
INTO V_COUNT
FROM YOUR_TABLE
WHERE .. .

IF V_COUNT = 0 THEN INSERT ... 
ELSIF UPDATE ... 
COMMIT;
END IF;

END;

答案 1 :(得分:0)

合并是一种方法。另一种方式是

{{1}}

我不会试图转录你的截图