Insert, based on condition (constraint unique key)

Hello
Need help with checing the uniqeness of value before inserting

for example
have two table

Book book_owner years and need to inserting 100 rows in the table, but there are a few unique constraints challenged on the table where need to chek the value existing or not, if the value is exisitn jump insertion otherwise insert the value

Here is an example

Insert in the BOOK (BOOK_ID, CNT, ALT_CNT, ROW_INSERT_TMSTMP, ROW_LAST_UPDT_TMSTMP, BOOK_ID)
Values (SEQ_BOOK_ID.nextval, 50, 500, sysdate, sysdate, ' 123456');
commit;
/
Insert into BOOK_OWNER (BOOK_OWNER_ID, BOOK_ID, USER_ID) Values (SEQ_BOOK_OWNER_ID.nextval, SEQ_BOOK_ID.currval, "456");
commit;
/

Insert in the BOOK (BOOK_ID, CNT, ALT_CNT, ROW_INSERT_TMSTMP, ROW_LAST_UPDT_TMSTMP, BOOK_ID)
Values (SEQ_BOOK_ID.nextval, 50, 500, sysdate, sysdate, ' 678901');
commit;
/
Insert into BOOK_OWNER (BOOK_OWNER_ID, BOOK_ID, USER_ID) Values (SEQ_BOOK_OWNER_ID.nextval, SEQ_BOOK_ID.currval, ' 678');
commit;
/

Insert in the BOOK (BOOK_ID, CNT, ALT_CNT, ROW_INSERT_TMSTMP, ROW_LAST_UPDT_TMSTMP, BOOK_ID)
Values (SEQ_BOOK_ID.nextval, 50, 500, sysdate, sysdate, ' 5123987');
commit;
/
Insert into BOOK_OWNER (BOOK_OWNER_ID, BOOK_ID, USER_ID) Values (SEQ_BOOK_OWNER_ID.nextval, SEQ_BOOK_ID.currval, ' 896');
commit;
/

in the Book table BOOK_ID has the unique constraint and the data type is varchar type
BOOK_OWNER table USER_ID) has the unique constraint and as a varchar data type

I use oracle 10g

Double post!

Tags: Database

Similar Questions

  • PL/SQL insert based on conditions

    I'd appreciate any help I can get. I learn PL/SQL and have stumbled upon a problem, so please help me to find an appropriate way to deal with this situation I am running Oracle 11 GR 2

    My diagram:

    CREATE TABLE "ENTRY"
    (
    'TYPE' VARCHAR2 (5 CHAR) ,
    'TRANSACTION' VARCHAR2()5 TANK),
    'OWNER' VARCHAR2 (5 CHAR)
    ); 

    CREATE TABLE "VIEW"
    (
    'TYPE' VARCHAR2 (5 CHAR) ,
    'TRANSACTION' VARCHAR2 (5 CHAR),
    'OWNER' VARCHAR2 (5 CHAR)
    ); 

    CREATE TABLE "REJECTED"
    (
    'TYPE' VARCHAR2 (5 CHAR) ,
    'TRANSACTION' VARCHAR2 (5 CHAR),
    'OWNER' VARCHAR2 (5 CHAR)
    );

    My sample data:

    insert into entry (type, transaction, owner) values (11111, 11111, 11111);
    insert into entry (type, transaction, owner) values (22222, 22222, 22222);

    Now for the confusing part, I wrote this procedure which has to copy the values from the table ENTRY in the table VIEW if a record is no specific combination (transaction AND owner). If such an association exists in the table for VIEW this record should then go to the REJECTED table. This procedure done that but on the executions of the procedure, I get more entries in the REJECTED table so my question is how do to limit inserts them into the table of REJECTED - if a record already exists in the REJECTED table then do nothing.

    create or replace PROCEDURE COPY AS 
    v_owner_entry ENTRY
    .owner%TYPE;
    v_transaction_entry ENTRY
    .transaction%TYPE; 
    v_owner
    VIEW.owner%TYPE;
    v_transaction
    VIEW.transaction%TYPE; 

    begin 

    begin 
    select e.owner, e.transaction, v.owner, v.transaction
    into v_owner_entry, v_transaction_entry, v_owner, v_transaction
    from entry e, view v
    where e.owner = v.owner and e.transaction = v.transaction; 


    EXCEPTION
    when too_many_rows
    then insert into REJECTED ( TYPE, TRANSACTION, OWNER ) SELECT s1.TYPE, s1.TRANSACTION, s1.OWNER FROM ENTRY s1; 

    when no_data_found THEN  insert into VIEW ( TYPE, TRANSACTION, OWNER ) SELECT s.TYPE, s.TRANSACTION, s.OWNER FROM ENTRY s; 
    end;
    end;

    Any suggestions guys?

    See you soon!

    UPDATE

    Sorry if the original message was not enough - clear the procedure must replicate data (on a daily basis) of DB1 to DB2 and insert in the VIEW or REJECTED depending on the conditions. Here is a picture, it would be perhaps more clearly:

    replicate.jpg

    Hello

    your procedure could look something like this:

    declare
      -- Local variables here
      i integer;
    begin
      -- Test statements here
      INSERT INTO REJECTED
      (TYPE, TRANSACTION, OWNER)
      SELECT ENTRY.TYPE, ENTRY.TRANSACTION, ENTRY.OWNER
        FROM ENTRY, VIEW
       WHERE ENTRY.OWNER = VIEW.OWNER
         AND ENTRY.TRANSACTION = VIEW.TRANSACTION
         AND NOT EXISTS
       (SELECT NULL
                FROM REJECTED VW2
               WHERE VW2.OWNER = ENTRY.OWNER
                 AND VW2.TRANSACTION = ENTRY.TRANSACTION);
    
    INSERT INTO VIEW
      (TYPE, TRANSACTION, OWNER)
      SELECT TYPE, TRANSACTION, OWNER
        FROM ENTRY
       WHERE NOT EXISTS (SELECT NULL
                FROM VIEW
               WHERE ENTRY.OWNER = VIEW.OWNER
                 AND ENTRY.TRANSACTION = VIEW.TRANSACTION);
    COMMIT;
    end;
    

    Edited: Use SQL syntax

  • Must insert based on condition

    Hi friends,

    I have a form with the following fields

    Course_name, duration, on_date

    A person several can log into the app with a form of opening with the fields above...

    After having all the details in the form of filling and if he pressed 'Send' button, then it will insert in the table...

    *) Assume that assume, if a person (for the first time) is logging into the application and fills it with the following details in the form

    -> course name: oracle
    -> Duration: 21:00 pm
    -> date: 11/06/2011

    and if he pressed the means of the "submit" button, it will insert in the table...

    *) Guess if person B is accessing the request (for the first time, once) and if he meets with the same means (i.e) of following details

    -> course name: oracle
    -> Duration: 21:00 pm
    -> date: 11/06/2011

    It should not be allowed to 'submit' and we must say the error message like

    * "This duration for this course and this date is already reserved by the other person, in order to select another date" * "

    (IE), it should not insert into the table... Because the content of the coursename, duration, date is already inserted...

    It's that these three columns of the row of suceeding values must not be equal. How can I achieve this.


    Kind regards
    Mini

    Hey Mini,

    Change uppercase in the where clause similar to below and this should solve your problem.

    SELECT
      1
    FROM
      course
    WHERE
      UPPER(course_name) = UPPER(:P1_COURSE_NAME)
    AND
      duration = :P1_DURATION
    AND
      date = :P1_DATE
    

    Thank you

    Paul

    Published by: Paul Broughton on June 11, 2011 13:41

  • Disable the unique key constraint

    Hello

    Is it possible to disable a unique key constraint?
    I tried the following code:

    ALTER TABLE table_name
    DISABLE the CONSTRAINT uk_constraint_name

    that seems to work fine, but when I try to insert or update a record that the unique constraint is still on. However, Toad in the United Kingdom is marked as disabled.

    What do I need to drop the UK and re-create it after my updates?

    Thank you

    The behavior that I have demonstrated that during
    a. you have an existing UNIQUE Index
    b. you add a Unique key constraint (with the same or another name, any - except that the error message contains the name of the index is different, if the constraint is disabled)

    OTOH, if you set the Unique key on the table without pre-existing index constraint, Oracle creates an Index. If you disable this constraint, Oracle removes the Index.
    So, if it is a small table and you can afford to recreate the Index each time, you can follow this method.

    SQL> create table t_2 (col_1 number, col_2 varchar2(5));
    
    Table created.
    
    SQL> alter table t_2 add constraint t_2_uk unique (col_1);
    
    Table altered.
    
    SQL> select index_name, uniqueness, status from user_indexes where table_name = 'T_2';
    
    INDEX_NAME                     UNIQUENES STATUS
    ------------------------------ --------- --------
    T_2_UK                         UNIQUE    VALID
    
    SQL> insert into t_2 values (1,'a');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> alter table t_2 disable constraint t_2_uk;
    
    Table altered.
    
    SQL> insert into t_2 values (1,'b');
    
    1 row created.
    
    SQL> select index_name, uniqueness, status from user_indexes where table_name = 'T_2';
    
    no rows selected
    
    SQL>SQL> select constraint_name, constraint_type, status from user_constraints where table_name = 'T_2';
    
    CONSTRAINT_NAME                C STATUS
    ------------------------------ - --------
    T_2_UK                         U DISABLED
    
    SQL> alter table t_2 enable constraint t_2_uk;
    alter table t_2 enable constraint t_2_uk
    *
    ERROR at line 1:
    ORA-02299: cannot validate (AWRADMIN.T_2_UK) - duplicate keys found
    
    SQL> delete t_2 where col_2 = 'b';
    
    1 row deleted.
    
    SQL> alter table t_2 enable constraint t_2_uk;
    
    Table altered.
    
    SQL> select index_name, uniqueness, status from user_indexes where table_name = 'T_2';
    
    INDEX_NAME                     UNIQUENES STATUS
    ------------------------------ --------- --------
    T_2_UK                         UNIQUE    VALID
    
    SQL>
    

    Hemant K Collette

  • SQL statement error INSERT The conflicted with the FOREIGN KEY constraint

    I recently installed a reporting for vmware vsphere software, but I get a SQL error. I opened a request for assistance with vmware, but so far they have not come up with a solution. The error is caused by: com.microsoft.sqlserver.jdbc.SQLServerException: instruction INSERT The conflicted with the FOREIGN KEY constraint 'FK_CB_VSM_NETWORK_VC_ID '. The conflict occurred in database 'VCChargebackVCC02', table "dbo." " CB_VSM_SERVER', column 'VC_ID '. I don't know a lot about SQL, so I'm lost in the extent of troubleshooting is concerned. If anyone has any ideas I'd love to hear them.

    SQL questions are better posed on Technet.  They are better equipped to manage the

    http://social.technet.Microsoft.com/forums/en-us/categories/

  • ODI is recovering not Unique key constraint

    I created a table with script below and reverse engineering it.

    create table test
    (primary_id number,
     unique_not_null_ID number not null,
      col3 number,
     col4 varchar2(200),
     col5 varchar2(2000),
    primary key (primary_id),
    unique (unique_not_null_ID) 
    )
    

    But all looking in the constraint of the data store only the primary key is here

    Also, within the quick edit tab Interface is show

    (1) Primary_id: = UK and CN of check

    (2) Unique_not_null_id: = CN is the Coachman


    So, why there no Unique constraint picked up?


    I think then it will only mark it too fast Edition.

    Hi spear,

    Please note that during standard reverse engineering unique keys are not reverse engineering. Then you need to either do reverse engineering on measurement or add a unique touch to the ODI level.

    https://docs.Oracle.com/CD/E28280_01/integrate.1111/e12643/create_rev_model.htm#ODIDG225

  • Unique key violation - the DB adapter

    Hello

    I have a composite SOA (deployed in clusters of 4 nodes) who questions database and calls a stored procedure (which invokes the records in multiple tables). Now, when I'll be large amount of data in the source database, the composite is mark and tries to insert the records in the target database. But sometimes error cases dating violation of unique key constraint while inserting records into the target database.

    Is locks of adapter DB table before inserting the records so that others may not violate the constraints and they will be able to see changes made by other SOA forums?

    Thank you!

    Yes, certainly not DbAdapter... the problem is the way you do your check and the lack of a facility of mutex in BPEL... Assuming you are using BPEL...

    Ideal scenario...

    1 check key has... There is no instance

    example 1 - insert the key... was ok

    example 2 - check button has exist......

    instance 2 - updates of key has... ok

    Parallel scenario...

    1 check key has... There is no instance

    2 check key has... There is no instance

    example 1 - insert the key... was ok

    example 2 - Insert key a... failure... duplicate a key...

    Hope you get what I'm trying to show here... There is nothing there to prevent another instance to check the existence of the key even before the first instance commits the transaction that inserted the key...

    BPEL is not a mutex AFAIK... something like the statement "synchronized" in Java for example...

    https://docs.Oracle.com/javase/tutorial/essential/concurrency/locksync.html

    Thus, you must use a different approach, for example, try and introduce first always, if the insertion fails try and update... It's 'thread safe' than the approach that you use...

    Much better is to is to abandon controls at all and always insert using the key substitution, such as sequences or guid... If you insert an Oracle database, simply use a sequence, or use the function generate GUIDs BPEL...

    https://en.Wikipedia.org/wiki/Surrogate_key

    See you soon,.

    Vlad

  • Unique key and foreign key in the view of materialzied

    Hello world
    I have one main site and 4 materialized view sites.
    In my main site, I did a main group that contains my tables participating in replication.
    I have a table that has a primary key, foreign key constraint unique.
    In my first materialized view site I did group for my opinion

    BEGIN
    DBMS_REPCAT. () CREATE_MVIEW_REPGROUP
    gname = > "hr_repg"
    Master = > "orc1.com"
    propagation_mode = > 'ASYNCHRONOUS');
    END;
    /

    BEGIN
    DBMS_REFRESH. DO)
    name = > 'mviewadmin.hr_refg ',.
    list = > ",
    next_date = > SYSDATE,.
    interval = > 'SYSDATE + 1/144',.
    implicit_destroy = > FALSE,
    rollback_seg = > ",
    push_deferred_rpc = > TRUE,
    refresh_after_errors = > FALSE);
    END;
    /

    Then I created the materialized view

    HR.test CREATE MATERIALIZED VIEW
    COOL OFF QUICKLY WITH A PRIMARY FOR THE UPDATE KEY
    AS SELECT * FROM [email protected]
    /

    BEGIN
    DBMS_REPCAT. () CREATE_MVIEW_REPOBJECT
    gname = > "hr_repg"
    sName = > 'hr ',.
    oname = > 'test ',.
    Type = > "SNAPSHOT."
    min_communication = > TRUE);
    END;
    /

    BEGIN
    DBMS_REFRESH. ADD)
    name = > 'mviewadmin.hr_refg ',.
    list = > "hr_test.test"
    Lax = > TRUE);
    END;
    /

    When I check the test (materialized view) table in the site of the materialized view to a primary key, but it has no foreign key forced unique having the base table and because my test materialized view can be changed I need to have these 2 constraint on my my materialized view. You have an idea why these 2 constraint were not created on my materialized view? And what should I do to have these two constraints.

    Thanks in advance

    On MView is created automatically only PK. Other constraints (check, not null, unique or FK) should be created manulay. Indexes also.
    But be careful with the FK.
    On ORACLE8, I found lines that are inserted to updatable mview back in deleted updating process, then inserted (downloaded on the main site). When FK is with on delete cascade that the lines of the child tables (mviews are removed too). And when the child mview is updated before mview parent you found the child missing lines.
    When CF is on delete restrict that you refresh the process fails.

  • How to avoid the report query needs a unique key to identify each line

    Hello

    How to avoid the error below

    The report query needs a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column.

    I have master-detail tables but without constraints, when I created a query as dept, emp table he gave me above the error.

    Select d.deptno, e.ename

    by d, e emp dept

    where e.deptno = d.deptno

    Thank you and best regards,

    Ashish

    Hi mickael,.

    Work on interactive report?

    You must set the column link (in the attributes report) to something other than "link to display single line." You can set it to 'Exclude the column link' or 'target link to Custom.

  • Why we cannot create more than one primary key on a table. Why we create several unique key on a table. Please explain if anyone have details of this.

    Why we cannot create more than one primary key on a table. Why we create several unique key on a table. Please explain if anyone have details of this.

    «a primary key has semantic meaning, it is to be immutable (never change of value), unique and not null.»

    a unique constraint is simply "at any time, these values are unique - they can change and they can be null.

    You use a unique when constraint

    (a) you do not already have a primary key for a table can have only one
    (b) you allow NULL values in attributes
    "(c) to allow you to update the values in the attributes.

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:5541352100346689891

  • table partitioned and unique keys

    I really don't understand why Oracle does not apply in some cases, unique keys.

    Let's say I have a table

    create table t (t_type not null, t_key not null, id not null, not null value)

    list partition (t_type)

    (

    type1 partition values ('ppp1"),

    rest of partition (default) values

    ) as

    Select "ppp" | rownum, rownum, rownum, rownum of double connect by rownum < = 100;

    And following changes in the indices for unique keys

    -1

    create index idx_1 on t (t_key, id);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -2

    create index idx_1 on t (t_key, id, t_type);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -3

    create index idx_1 on t (t_key, id, t_type) local;

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -4

    create an index only idx_1 on t (t_key, id);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -5

    create an index only idx_1 on t (t_key, id, t_type);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -6

    create an index only idx_1 on t (t_key, id, t_type) local;

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -7

    create index idx_1 on t (t_key, t_type, id) local;

    ALTER table t add t_uk unique constraint (t_key, t_type) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -8

    create an index only idx_1 on t (t_key, t_type, id) local;

    ALTER table t add t_uk unique constraint (t_key, t_type) using index idx_1;

    Drop index idx_1;

    I got the set of questions:

    1. first and second cases were performed with success while 4th and 5th failed.

    The only difference is that the overall index in 4th and 5th cases are unique.

    It is unclear why ' ORA-14196: specified index cannot be used to apply the constraint. ' has occurred.

    2. in the third case index is similar to that in second place with the only difference that it is local.

    Still, it is not clear why it failed with ORA-14196.

    3 and the last question why ORA-14196 arose in 8 cases, while the 7th, it didn't.

    The only difference is the local index in 8 cases is unique.

    Thank you

    Hi Alex

    (1) index 4 and 5 cannot be used to police the unique constraint as a unique index must have the same list of column under duress. Index 4, to establish in a non-unique index or to remove the column id of the index. To index 5, you will need to make a non-unique index or remove the columns id and index t_type.

    (2) 3 index cannot be used to the unique constraint of police that it is a local index and is not partitioned column (t_type) in both the definition of index/constraint. If allowed, this would require Oracle having to visit each partition to ensure that any new value of t_key is truly unique, that would not scale. Include the t_type column in the constraint and the index to both t_type and t_key as of the columns (so move the id column 3rd position) and it would be successful.

    (Index 3) 8 fails for the same reason as in 1). It's a unique index with a different column from the constraint list. Remove the id column of the index or to make it a non-unique index and it will be successful.

    In summary, a unique index MUST have the same list of column than the constraint and a local index MUST have the partitioning columns in both the definition of index/constraint.

    See you soon

    Richard Foote

    http://richardfoote.WordPress.com/

  • Engineering problems the surrogate with Unique key primary key

    SDDM 3.3.0.747 with 2 problems (at least so far).  I hope that the problem comes from this recruit SDDM and I forgot a setting. PROBLEM 1 I don't want to start a religious debate on substitution vs natural keys but I'm having a problem correctly both the logic model of engineering.  I'm a rookie when it comes to SDDM but have many years of experience with the Designer. By default, only I wish I had a natural UID (UK) and a surrogate mother based on a primary key UID (PK) which is used for foreign keys.  The problem I have with engineering is I can successfully engineer the substitute PK, engineer of the FK with the PK, but cannot get the unique key to contain surrogate keys in the child table.  If I check the identification property in relationships, the PK columns and the UK are included in the child PK and the United Kingdom contains no columns. The installation program, I've defined two reference entities, PROBABILITY and GRAVITY with unique keys natural defined.  I also have a child entity RISK_ASSESMENT with links to entities of the PROBABILITY and SEVERITY and both have the "use surrogate keys:": check box selected.  The unique key of the entity RISK_ASSESMENT includes links to PROBILITY and GRAVITY.  None of the entities have a PK or replacement of the defined keys and they all have the checkbox "Create a surrogate key" checked.  In addition the following preferences are defined: Data Modeling/model/logic NO checked - use and the first Unique key as primary key value NOT checked - name - Keep under the name of the from attribute Checked - entity carrier to create controlled key - use surrogate PROBLEM 2 key relationship when the foreign key columns are engineered I want names have a prefix 'FK_"but they don't.  Models are defined as follows: Data Modeler/assignment of Standard/Templates Foreign Key name: FK_ {children} {parent} foreign key column: engineer FK_ {Ref column} relational model/General checked Options - translation name Marcus Bacon apply

    Once more, I designed without removing anything and still no FK to the United Kingdom of the child.

    There is a synchronization problem in DM 4.0 EA1. This will be fixed for the production version.

    Philippe

  • Constraint Unique NOT NULL in Data Modeling

    I created unique constraints in the relational model and I am trying to figure out how to make a NOT NULL constraint.

    Let's say the name of the table's category with cat_id, cat_name, sort columns.

    I create in SQL 'category ALTER TABLE MODIFY (category CONSTRAINT NOT NULL xxx_cat_name_nn);', but there is no data entry point inside the Modeler in the [properties unique key - xxx_cat_name_nn] dialog box, that I can find, that allows me to tell him that it is a NOT NULL constraint. I'm sure that there is a way, but I just fall over my own feet, trying to find.

    Any help would be greatly appricated.

    Published by: 991065 on February 28, 2013 13:40

    Hello

    You can make the column NOT NULL by disabling the "Allow nulls" property for the column.
    If you want a named STEP forced to NULL value, you must also set the property "Not Null Constraint Name" (under the default tab and the constraint of the column properties dialog box).

    David

  • Potential problems for tables without primary keys and unique keys

    GoldenGate 11.2.1.0.3/Solaris 10
    DB: Oracle for Oracle (Source and target is 11.2.0.3)
    Topology: unidirectional


    In our one-way configuration GG, little of the tables being replicated is not a primary key or a Unique key.

    Last week when we have implemented GG for the test, we received warnings for these table below.
    GGSCI > add trandata WMHS_UD.crtn_dtl
    
    2013-01-12 11:34:33  WARNING OGG-00869  No unique key is defined for table 'CRTN_DTL'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.
    
    Logging of supplemental redo data enabled for table WMHS_UD.crtn_dtl.
    Replication seems to work very well for these tables.

    Googling, I think that there may be performance degradation when you replicate tables without PK or the United Kingdom.

    But are there other potential problems such as data of a certain kind not replicated to the lack of PK/UK?

    It really depends on the data.

    By default, GG is combining all columns as a virtual primary key but don't no conflict control by default. So when you can be sure that the record you insert into the table is unique, then it will work.
    BUT as soon as you insert the same record, which is already inserted, then you will encounter problems.

    Let me show what happens when you use an initial charge because it makes it easier to describe:
    We start at 10:00 the capture for a table. Now, you insert a record at 10:00 in the tables. When you now start an initial charge to 10.02, then check you have inserted in the database to 10.01 will be repeated two times. During the IPL as the initial charge is made to 10.02 and it includes data of 10.01 AND it will be replicated again through the process of capture/replicate.

  • Number of unique key in a table column

    Hi all...


    Please help me with this problem. Looking for the number of threads, but could not understand how do.


    I have a master form / retail users (main table) and responsibilities (detail table).
    The problem is with the table Details (responsibilities), the detail is "" "FORM TABULAR" ".
    A user can have the following responsibilities RESP1, RESP2, RESP3, RESP4 (it's a '' select list' ")


    When the administrator creates users, they will strike "" Add line"," once they choose a responsibility of the selection list.
    When they hit add line once again, "'chosen responsibility should display in the selection list.


    EX: when they select RESP "RESP1' in the first row, if they hit add line once again,"RESP1"does not present it as an option for users to select.


    EX: If the user already has an RESP "" RESP3"" in the database, "'' RESP3" ' should not display if they try to add another RESP.

    Each select list should display different values depend on the values they have chosen so far *.

    -> we can put constaint unique key on this column or put validation on this page, but I'm looking for the implementation


    Please check the following application example:


    http://Apex.Oracle.com/pls/Apex/f?p=42177


    Please help me in this task

    Thank you

    There is no way to declaratively in the Apex to do this.

    In version 4.x:
    1. There is no declarative way to dynamically filter a list of values in a tabular presentation. For each line, the LOV is actually pre-built on a hidden row zero when the page first appears.
    2. to do this, you will need to come up with a process, possibly including AJAX, to fill an array of values to the selection list, delete the values in the table if they have been selected on the other lines of the page and then re - fill the selection on the new list online.

    In version 3.x:
    1 lines are stored in the database every time that you add a row (actually the page saves and repainted with a new line). You can set your LOV SQL to return the values valid less those already stored in the database that the user adds lines.
    2. However, that won't necessarily work 100% if you look at a page with several lines already on it and want to update the existing lines and you need in any case a sort of validation or a unique constraint.

    It is not impossible, but it's very very labor intensive and maintainability is more difficult if another developer a year or two down the road to inherit this page you.

    I'd really like to tell your business analyst or key functional end users what they ask for is not supported by Apex first review (and to tell you the truth, it is indeed non-supported, so you are not lying down or fake apology) and they consider like allowing more traditional validation via a unique constraint and page validation.

Maybe you are looking for