Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3662720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:26:54+00:00 2026-05-19T01:26:54+00:00

I have a stored procedure in Oracle 9i which inserts records in a table.

  • 0

I have a stored procedure in Oracle 9i which inserts records in a table. The table has a primary key built to ensure duplicte rows doesnot exists.

I am trying to insert a record by calling this stored procedure and it works first time properly. I am again trying to insert a duplicate record and expecting unique constraint violation error. But I am getting
ORA-01401 inserted value too large for column

I knew its meaning but my query is , if the value inserted is really large then how it got successful in the first attempt.

Table is

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)

Call is
EXEC SQL EXECUTE
BEGIN
keyadd(:id, :key, :wkey);
END;
END-EXEC;

Stored Procedure is

PROCEDURE keyadd(id IN VARCHAR2, key IN NUMBER, wkey IN VARCHAR2)
{
        BEGIN
        INSERT INTO KEY
            (   ID,
                KEY,
                INSERT_DATE,
                WORK_KEY)
            VALUES
            (
                id,
                key,
                SYSDATE,
                wkey
            );
        EXCEPTION
            ROLLBACK;
        COMMIT;
            RETURN;
        END;
}

First insert sqlca.sqlcode is [0]
Second insert sqlca.sqlcode is [-1401]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:26:55+00:00Added an answer on May 19, 2026 at 1:26 am
    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;
    /
    

    gives me the expected ORA-00001: Unique Constraint... error, not an ORA-01401. So, without further information its impossible to help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Oracle stored procedure which takes two parameters: a custom data type
I have a Java stored procedure which fetches record from the table using Resultset
I have a Stored procedure which schedules a job. This Job takes a lot
I'm inserting a row using an Oracle stored procedure which is configured to use
I have an Oracle table which contains event log messages for an application. We
I have sql stored procedure which pass and return some values: CREATE PROCEDURE [dbo].[GetMoney]
I'm trying to call an Oracle Stored Procedure which returns XMLType data, but all
I am using Oracle 11g, and I have a lot of stored procedure code
We have a stored procedure that has a select statement in it: select convert(int,
I have a stored procedure which updates a database using the parameters I supply

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.