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 8782243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:31:17+00:00 2026-06-13T20:31:17+00:00

When export sql scripts by SQL Developer there are multiple options available, but either

  • 0

When export sql scripts by SQL Developer there are multiple options available, but either way there have to generate a UNIQUE INDEX on primary key like this

CREATE UNIQUE INDEX "SYS_C0018099" ON "TRANSACTION" ("ID") 

and add PRIMARY KEY to the same table and same column

ALTER TABLE "TRANSACTION" ADD PRIMARY KEY ("ID")

So the question is: does it looks like kind of redundancy? I thought creating a primary key on a column should by default create an unique index on that column too? So why the first command is necessary?

And this may cause data redundancy?

I am on Oracle 11g so please share any ideas about why it should look like above.

Thanks in advance.

  • 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-06-13T20:31:18+00:00Added an answer on June 13, 2026 at 8:31 pm

    There is no redundancy – or only a little bit 🙂

    The second command will use the index available if exists. Otherwise(if first DDL does not exists) will create an index.

    The split into two commands is useful when you had given a proper name to the index and want to keep it.

    UPDATE: The link indicated by Thomas Haratyk is a must read, I really like it: http://viralpatel.net/blogs/understanding-primary-keypk-constraint-in-oracle/

    UPDATE2: a_horse_with_no_name is right, it can be done in a single statement like:

    alter table TRANSACTION
    add CONSTRAINT pk_test PRIMARY KEY (id);
    

    So, it will keep the name(won’t create a sysblalbla object name) and if you use the ‘USING INDEX’ keyword you can specify index atributes, for example storage atributes.

    But again, you will not have any problems with those two statements, only an index is created.

    Probably SQL Developer prefer to get a ddl per object and there might be cases when it’s better its way.

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

Sidebar

Related Questions

I have been thinking of a way to export data from SQL to Excel.
I have an InnoDB MySQL database. When I export a SQL dump, how does
I have one SQL server database which was created using Import/Export Wizard from an
Can we have multiple SQL* PLUS connections in a shell script? I have written
I need to export database from SQL Server 2005 to SQL scripts (like we
I exported a database schema from one server using SQL Developer (Tools-> Database Export).
I have an SSIS package that performs the following. Run a SQL script Export
I have been researching a way to get the SQL statements that are built
I have a bunch of SQL scripts (with shell script wrappers) to unload data
I ran into a issue about Import/Export on SQL Server. I have a database

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.