时间:2011-01-06 15:47:01

标签: oracle stored-procedures plsql

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

CREATE TABLE KEY
(
  ID  VARCHAR2(25 BYTE),
  KEY         NUMBER(4)                      NOT NULL,
  INSERT_DATE    DATE,
  WORK_KEY    VARCHAR2(128 BYTE)
);

CREATE UNIQUE INDEX SACHINIDX ON KEY
(ID, KEY);


create or replace PROCEDURE keyadd(id IN VARCHAR2, key IN NUMBER, wkey IN VARCHAR2)
is
        BEGIN
        INSERT INTO KEY
            (   ID,
                KEY,
                INSERT_DATE,
                WORK_KEY)
            VALUES
            (
                id,
                key,
                SYSDATE,
                wkey
            );

        COMMIT;

--      EXCEPTION when others then
--          ROLLBACK;
end keyadd;
/

begin
  keyadd('one', 1, '59FC9AD0FA5A8932836824B0489B73252C120301A2205154C096B4EB213FA983D5E500B62A469439');
  keyadd('one', 1, '905BD61AAEC986ACF887DBA7C04D650B61A8818ABEBE1720D810B4A426EB9220558B530D5119315F');
end;
/

给出了预期的ORA-00001: Unique Constraint...错误,而不是ORA-01401。所以,如果没有进一步的信息,它就无法提供帮助。

答案 2 :(得分:0)