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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:50:47+00:00 2026-05-24T08:50:47+00:00

Please consider the following table structure on Oracle: create table DOCS ( DOC_NO NUMBER

  • 0

Please consider the following table structure on Oracle:

create table DOCS
(
  DOC_NO   NUMBER not null,
  DOC_TYPE VARCHAR2(5) not null,
  PMT_NO   NUMBER not null
);

In this table, the PMT_NO column has to be unique except when DOC_NO is the same and DOC_TYPE is different:

    DOC_NO DOC_TYPE     PMT_NO
---------- -------- ----------
         1 A                10 <-- good
         1 B                10 <-- good, DOC_NO is the same
         2 C                10 <-- NOT good, DOC_NO is different

PMT_NO cannot repeat and cannot have “holes” (i.e. 1, 2, 3, 5), so a sequence would not work. And there are many users inserting data at the same time.

Is there a way to create a unique key / unique index / function-based index for that condition?

Thanks!

  • 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-24T08:50:48+00:00Added an answer on May 24, 2026 at 8:50 am

    Maybe this is a normalization problem.

    You could pull out the relevant tuple into another table such that the row would be unique.

    In this case link doc_no to pmt_no, once (not repeated as you have shown).

    Then you can make a unique index on the pmt_no column of this link table.

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

Sidebar

Related Questions

Please consider the following scripts. Create Table: IF OBJECT_ID('Colortable') IS NOT NULL DROP TABLE
Please consider the following SQL Server table and stored procedure. create table customers(cusnum int,
Please consider the following table (created using a corresponding entity) request ------- id requestor
Please consider the following HTML: <td> Some Text <table>.....</table> </td> I need to manipulate
Please consider the following: DECLARE @xml XML SET @xml = '<Capture> <Data><DataType>Card Number</DataType><Value>1234567898765</Value></Data> <Data><DataType>Expiry
Please consider the following table 'mmm': select * from mmm; Output: +-------+-------+------+ | texto
Please Consider the following table : As you can see the Name column has
Please consider the following: <td style=width: 500px;> <div style=width: 400px;>SomeContent</div> </td> For some reason,
Please consider the following fork() / SIGCHLD pseudo-code. // main program excerpt for (;;)
Please consider the following scenario: map(T,S*) & GetMap(); //Forward decleration map(T, S*) T2pS =

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.