Sql developer针对具有自动增量ID的INSERT语句的存储过程

时间:2017-07-17 15:44:43

标签: stored-procedures oracle-sqldeveloper sql-insert auto-increment unique-constraint

当我尝试运行插入语句的存储过程时,我遇到了问题。我得到错误:违反了唯一约束,我不明白为什么因为我将主键设置为序列或自动增量。 这是我的存储过程:

create or replace PROCEDURE SACUVAJCUSTOMERDETAILNADA 
(
ID_ OUT CUSTOMERDETAILNADA.ID%TYPE,
FIRSTNAME_ IN CUSTOMERDETAILNADA.FIRSTNAME%TYPE
,LASTNAME_ IN CUSTOMERDETAILNADA.LASTNAME%TYPE
,MAIDENNAME_ IN CUSTOMERDETAILNADA.MAIDENNAME%TYPE
 MOTHERSMAIDENNAME_ IN CUSTOMERDETAILNADA.MOTHERSMAIDENNAME%TYPE
)AS
BEGIN
 INSERT INTO CUSTOMERDETAILNADA(FIRSTNAME,LASTNAME,MAIDENNAME,MOTHERSMAIDENNAME)
 VALUES(FIRSTNAME_,LASTNAME_,MAIDENNAME_,MOTHERSMAIDENNAME_)
RETURNING CUSTOMERDETAILNADA.ID INTO ID_;
END SACUVAJCUSTOMERDETAILNADA;

Thanks in advance for any suggestions!

0 个答案:

没有答案