Creating a unique index frame on a one-to-many table and search

Hello

I was properly put in place of the full text index on multiple columns on the same table (using the MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a table of one-to-many data collection (with a CF of a lookup table), and I need to get columns through two of these tables. Code example below, several of my chatter after the code block:
CREATE TABLE SUBMISSION
( SUBMISSION_ID             NUMBER(10)          NOT NULL,
  SUBMISSION_NAME           VARCHAR2(100)       NOT NULL
);
 
CREATE TABLE ADVISOR_TYPE
( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
  ADVISOR_TYPE_NAME         VARCHAR2(50)        NOT NULL
);
  
CREATE TABLE SUBMISSION_ADVISORS
( SUBMISSION_ADVISORS_ID    NUMBER(10)          NOT NULL,
  SUBMISSION_ID             NUMBER(10)          NOT NULL,
  ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
  FIRST_NAME                VARCHAR(50)         NULL,
  LAST_NAME                 VARCHAR(50)         NULL,
  SUFFIX                    VARCHAR(20)         NULL
);

INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (1, 'Some Research Paper');
INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (2, 'Thesis on 17th Century Weather Patterns');
INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (3, 'Statistical Analysis on Sunny Days in March');

INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (1, 'Department Chair');
INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (2, 'Department Co-Chair');
INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (3, 'Professor');
INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (4, 'Associate Professor');
INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (5, 'Scientist');

INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (1,1,2,'John', 'Doe', 'PhD');
INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (2,1,2,'Jane', 'Doe', 'PhD');
INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (3,2,3,'Johan', 'Smith', NULL);
INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (4,2,4,'Magnus', 'Jackson', 'MS');
INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (5,3,5,'Williard', 'Forsberg', 'AMS');
 
COMMIT;
I want to be able to create a text index to group these fields:

SUBMISSION_ADVISORS. FIRST NAME
SUBMISSION_ADVISORS. LAST_NAME
SUBMISSION_ADVISORS. SUFFIX
ADVISOR_TYPE. ADVISOR_TYPE_NAME

I looked at DETAIL_DATASTORE and USER_DATASTORE, but examples of Oracle Docs for DETAIL_DATASTORE leave me a little confused. It seems that this should be fairly simple.

Ideally, I try to avoid creating new columns and keeping a minimum shutter adjustments. But I'm open to any suggestion. Thanks for your time and your thoughts.

-Jamie

I would create a procedure that creates a virtual with labels document, what is the multi_column_datatstore behind the scenes. Then I would like to use this procedure in a user_datastore, so the result is the same for several tables as a multi_column_datastore for a table. I would use auto_section_group or another type of Group of sections, so that you can search from WITHIN as with the multi_column_datastore. Please see the demo below.

SCOTT@orcl_11gR2> -- tables and data that you provided:
SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION
  2  ( SUBMISSION_ID           NUMBER(10)          NOT NULL,
  3    SUBMISSION_NAME           VARCHAR2(100)          NOT NULL
  4  )
  5  /

Table created.

SCOTT@orcl_11gR2> CREATE TABLE ADVISOR_TYPE
  2  ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
  3    ADVISOR_TYPE_NAME      VARCHAR2(50)          NOT NULL
  4  )
  5  /

Table created.

SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION_ADVISORS
  2  ( SUBMISSION_ADVISORS_ID      NUMBER(10)          NOT NULL,
  3    SUBMISSION_ID           NUMBER(10)          NOT NULL,
  4    ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
  5    FIRST_NAME           VARCHAR(50)          NULL,
  6    LAST_NAME           VARCHAR(50)          NULL,
  7    SUFFIX                VARCHAR(20)          NULL
  8  )
  9  /

Table created.

SCOTT@orcl_11gR2> INSERT ALL
  2  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
  3    VALUES (1, 'Some Research Paper')
  4  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
  5    VALUES (2, 'Thesis on 17th Century Weather Patterns')
  6  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
  7    VALUES (3, 'Statistical Analysis on Sunny Days in March')
  8  SELECT * FROM DUAL
  9  /

3 rows created.

SCOTT@orcl_11gR2> INSERT ALL
  2  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
  3    VALUES (1, 'Department Chair')
  4  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
  5    VALUES (2, 'Department Co-Chair')
  6  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
  7    VALUES (3, 'Professor')
  8  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
  9    VALUES (4, 'Associate Professor')
 10  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
 11    VALUES (5, 'Scientist')
 12  SELECT * FROM DUAL
 13  /

5 rows created.

SCOTT@orcl_11gR2> INSERT ALL
  2  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
  3    VALUES (1,1,2,'John', 'Doe', 'PhD')
  4  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
  5    VALUES (2,1,2,'Jane', 'Doe', 'PhD')
  6  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
  7    VALUES (3,2,3,'Johan', 'Smith', NULL)
  8  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
  9    VALUES (4,2,4,'Magnus', 'Jackson', 'MS')
 10  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
 11    VALUES (5,3,5,'Williard', 'Forsberg', 'AMS')
 12  SELECT * FROM DUAL
 13  /

5 rows created.

SCOTT@orcl_11gR2> -- constraints presumed based on your description:
SCOTT@orcl_11gR2> ALTER TABLE submission ADD CONSTRAINT submission_id_pk
  2    PRIMARY KEY (submission_id)
  3  /

Table altered.

SCOTT@orcl_11gR2> ALTER TABLE advisor_type ADD CONSTRAINT advisor_type_id_pk
  2    PRIMARY KEY (advisor_type_id)
  3  /

Table altered.

SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_advisors_id_pk
  2    PRIMARY KEY (submission_advisors_id)
  3  /

Table altered.

SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_id_fk
  2    FOREIGN KEY (submission_id) REFERENCES submission (submission_id)
  3  /

Table altered.

SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT advisor_type_id_fk
  2    FOREIGN KEY (advisor_type_id) REFERENCES advisor_type (advisor_type_id)
  3  /

Table altered.

SCOTT@orcl_11gR2> -- resulting data:
SCOTT@orcl_11gR2> COLUMN submission_name FORMAT A45
SCOTT@orcl_11gR2> COLUMN advisor      FORMAT A40
SCOTT@orcl_11gR2> SELECT s.submission_name,
  2           a.advisor_type_name || ' ' ||
  3           sa.first_name || ' ' ||
  4           sa.last_name || ' ' ||
  5           sa.suffix AS advisor
  6  FROM   submission_advisors sa,
  7           submission s,
  8           advisor_type a
  9  WHERE  sa.advisor_type_id = a.advisor_type_id
 10  AND    sa.submission_id = s.submission_id
 11  /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Some Research Paper                           Department Co-Chair John Doe PhD
Some Research Paper                           Department Co-Chair Jane Doe PhD
Thesis on 17th Century Weather Patterns       Professor Johan Smith
Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
Statistical Analysis on Sunny Days in March   Scientist Williard Forsberg AMS

5 rows selected.

SCOTT@orcl_11gR2> -- procedure to create virtual documents:
SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE submission_advisors_proc
  2    (p_rowid IN           ROWID,
  3       p_clob     IN OUT NOCOPY CLOB)
  4  AS
  5  BEGIN
  6    FOR r1 IN
  7        (SELECT *
  8         FROM      submission_advisors
  9         WHERE  ROWID = p_rowid)
 10    LOOP
 11        IF r1.first_name IS NOT NULL THEN
 12          DBMS_LOB.WRITEAPPEND (p_clob, 12, '');
 13          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.first_name), r1.first_name);
 14          DBMS_LOB.WRITEAPPEND (p_clob, 13, '');
 15        END IF;
 16        IF r1.last_name IS NOT NULL THEN
 17          DBMS_LOB.WRITEAPPEND (p_clob, 11, '');
 18          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.last_name), r1.last_name);
 19          DBMS_LOB.WRITEAPPEND (p_clob, 12, '');
 20        END IF;
 21        IF r1.suffix IS NOT NULL THEN
 22          DBMS_LOB.WRITEAPPEND (p_clob, 8, '');
 23          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.suffix), r1.suffix);
 24          DBMS_LOB.WRITEAPPEND (p_clob, 9, '');
 25        END IF;
 26        FOR r2 IN
 27          (SELECT *
 28           FROM   submission
 29           WHERE  submission_id = r1.submission_id)
 30        LOOP
 31          DBMS_LOB.WRITEAPPEND (p_clob, 17, '');
 32          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r2.submission_name), r2.submission_name);
 33          DBMS_LOB.WRITEAPPEND (p_clob, 18, '');
 34        END LOOP;
 35        FOR r3 IN
 36          (SELECT *
 37           FROM   advisor_type
 38           WHERE  advisor_type_id = r1.advisor_type_id)
 39        LOOP
 40          DBMS_LOB.WRITEAPPEND (p_clob, 19, '');
 41          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r3.advisor_type_name), r3.advisor_type_name);
 42          DBMS_LOB.WRITEAPPEND (p_clob, 20, '');
 43        END LOOP;
 44    END LOOP;
 45  END submission_advisors_proc;
 46  /

Procedure created.

SCOTT@orcl_11gR2> SHOW ERRORS
No errors.
SCOTT@orcl_11gR2> -- examples of virtual documents that procedure creates:
SCOTT@orcl_11gR2> DECLARE
  2    v_clob  CLOB := EMPTY_CLOB();
  3  BEGIN
  4    FOR r IN
  5        (SELECT ROWID rid FROM submission_advisors)
  6    LOOP
  7        DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
  8        submission_advisors_proc (r.rid, v_clob);
  9        DBMS_OUTPUT.PUT_LINE (v_clob);
 10        DBMS_LOB.FREETEMPORARY (v_clob);
 11    END LOOP;
 12  END;
 13  /
JohnDoePhDSome
Research PaperDepartment Co-Chair
JaneDoePhDSome
Research PaperDepartment Co-Chair
JohanSmithThesis on 17th Century
Weather PatternsProfessor
MagnusJacksonMSThe
sis on 17th Century Weather PatternsAssociate
Professor
WilliardForsbergAMS

Statistical Analysis on Sunny Days in

MarchScientist

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> -- user_datastore that uses procedure:
SCOTT@orcl_11gR2> BEGIN
  2    CTX_DDL.CREATE_PREFERENCE ('sa_datastore', 'USER_DATASTORE');
  3    CTX_DDL.SET_ATTRIBUTE ('sa_datastore', 'PROCEDURE', 'submission_advisors_proc');
  4  END;
  5  /

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> -- index (on optional extra column) that uses user_datastore and section group:
SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD (any_column VARCHAR2(1))
  2  /

Table altered.

SCOTT@orcl_11gR2> CREATE INDEX submission_advisors_idx
  2  ON submission_advisors (any_column)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  PARAMETERS
  5    ('DATASTORE     sa_datastore
  6        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP')
  7  /

Index created.

SCOTT@orcl_11gR2> -- what is tokenized, indexed, and searchable:
SCOTT@orcl_11gR2> SELECT token_text FROM dr$submission_advisors_idx$i
  2  /

TOKEN_TEXT
----------------------------------------------------------------
17TH
ADVISOR_TYPE_NAME
AMS
ANALYSIS
ASSOCIATE
CENTURY
CHAIR
CO
DAYS
DEPARTMENT
DOE
FIRST_NAME
FORSBERG
JACKSON
JANE
JOHAN
JOHN
LAST_NAME
MAGNUS
MARCH
PAPER
PATTERNS
PHD
PROFESSOR
RESEARCH
SCIENTIST
SMITH
STATISTICAL
SUBMISSION_NAME
SUFFIX
SUNNY
THESIS
WEATHER
WILLIARD

34 rows selected.

SCOTT@orcl_11gR2> -- sample searches across all data:
SCOTT@orcl_11gR2> VARIABLE search_string VARCHAR2(100)
SCOTT@orcl_11gR2> EXEC :search_string := 'professor'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> SELECT s.submission_name,
  2           a.advisor_type_name || ' ' ||
  3           sa.first_name || ' ' ||
  4           sa.last_name || ' ' ||
  5           sa.suffix AS advisor
  6  FROM   submission_advisors sa,
  7           submission s,
  8           advisor_type a
  9  WHERE  CONTAINS (sa.any_column, :search_string) > 0
 10  AND    sa.advisor_type_id = a.advisor_type_id
 11  AND    sa.submission_id = s.submission_id
 12  /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Thesis on 17th Century Weather Patterns       Professor Johan Smith
Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS

2 rows selected.

SCOTT@orcl_11gR2> EXEC :search_string := 'doe'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Some Research Paper                           Department Co-Chair John Doe PhD
Some Research Paper                           Department Co-Chair Jane Doe PhD

2 rows selected.

SCOTT@orcl_11gR2> EXEC :search_string := 'paper'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Some Research Paper                           Department Co-Chair John Doe PhD
Some Research Paper                           Department Co-Chair Jane Doe PhD

2 rows selected.

SCOTT@orcl_11gR2> -- sample searches within specific columns:
SCOTT@orcl_11gR2> EXEC :search_string := 'chair'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> SELECT s.submission_name,
  2           a.advisor_type_name || ' ' ||
  3           sa.first_name || ' ' ||
  4           sa.last_name || ' ' ||
  5           sa.suffix AS advisor
  6  FROM   submission_advisors sa,
  7           submission s,
  8           advisor_type a
  9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN advisor_type_name') > 0
 10  AND    sa.advisor_type_id = a.advisor_type_id
 11  AND    sa.submission_id = s.submission_id
 12  /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Some Research Paper                           Department Co-Chair John Doe PhD
Some Research Paper                           Department Co-Chair Jane Doe PhD

2 rows selected.

SCOTT@orcl_11gR2> EXEC :search_string := 'phd'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> SELECT s.submission_name,
  2           a.advisor_type_name || ' ' ||
  3           sa.first_name || ' ' ||
  4           sa.last_name || ' ' ||
  5           sa.suffix AS advisor
  6  FROM   submission_advisors sa,
  7           submission s,
  8           advisor_type a
  9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN suffix') > 0
 10  AND    sa.advisor_type_id = a.advisor_type_id
 11  AND    sa.submission_id = s.submission_id
 12  /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Some Research Paper                           Department Co-Chair John Doe PhD
Some Research Paper                           Department Co-Chair Jane Doe PhD

2 rows selected.

SCOTT@orcl_11gR2> EXEC :search_string := 'weather'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> SELECT s.submission_name,
  2           a.advisor_type_name || ' ' ||
  3           sa.first_name || ' ' ||
  4           sa.last_name || ' ' ||
  5           sa.suffix AS advisor
  6  FROM   submission_advisors sa,
  7           submission s,
  8           advisor_type a
  9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN submission_name') > 0
 10  AND    sa.advisor_type_id = a.advisor_type_id
 11  AND    sa.submission_id = s.submission_id
 12  /

SUBMISSION_NAME                               ADVISOR
--------------------------------------------- ----------------------------------------
Thesis on 17th Century Weather Patterns       Professor Johan Smith
Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS

2 rows selected.

Tags: Database

Similar Questions

  • How to find duplicate keys found when error ORA-01452: cannot CREATE a UNIQUE INDEX.

    Hi gurus,

    I fall for this stupid error

    "cannot CREATE a UNIQUE INDEX; duplicate keys found.


    It is that the Unique Index key is composed of multiple columns

    CREATE A UNIQUE KEY001AUTORISATIONS_APPORT ON TFT_AUTORISATIONS_APPORT INDEX

    (AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION)

    TABLESPACE KEYS_TFT NOPARALLEL NOLOGGING

    Now,.

    My question is, how to find duplicates keys blocking Index creation?

    Thanks if you can help

    Run this query to display the list of the duplicates already existing.

    Select AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION, count (1) as cnt

    of TFT_AUTORISATIONS_APPORT

    Group

    AUT_APPORTEUR, AUT_AGENCE, AUT_PRODUIT, AUT_OPTION, AUT_TARIF, AUT_DATE_AUTORISATION

    view count (1) > 1

    Concerning

    NJ

  • creating a unique index of instaed of using the primary key index

    Hello

    I heard in a debate sometimes it is better to create a unique index on a column and use it instead of using the primary key index in oracle. I did not understand what that the reason propely.

    Can someone please help me in this topic if it is valid.

    Thanks in advance

    On the surface, which does not seem reasonable... Volume of the DML is irrelevent to determine which column is the primary key for a table.

    My wild speculation a bit at a reasonable time could someone do...

    If you use synthetic primary keys (i.e. the keys generated by sequence) and that your tables are subject to large volumes of inserts such as there is a danger that the block "to the right" will be the source of contention block and worry not about analysis of beach on the column, you can create a reverse on this column (unique or non-unique) key index before creating the primary key constraint and to indicate Oracle to use this existing index to respect the primary key constraint.

    Obviously, however, this involves a lot of assumptions to arrive at a reasonable point. There may well be another set of assumptions that could also lead to a valid argument. Or it could be a myth that someone has heard and just repeats.

    Justin

  • Error ' t CREATE UNIQUE INDEX W_PROD_CAT_DH_U1 ON W_PROD_CAT_DH

    Hello

    I use OLIVIER 7.9.6.4

    and EBS Instance ORA12.1.3

    I get below error when I tried to run full load for the DAC order management

    CREATE A UNIQUE INDEX

    W_PROD_CAT_DH_U1

    WE

    W_PROD_CAT_DH

    (

    INTEGRATION_ID Asc

    DATASOURCE_NUM_ID Asc

    EFFECTIVE_FROM_DT Asc

    )

    NOLOGGING

    ORA-01452: cannot CREATE a UNIQUE INDEX. duplicate keys found

    Among the responsible 1,45,423 records 24 140 are duplicated.

    Apart from the removal of duplicates of records in DB is there any changes that I can do in Informatica mapping to limit duplicate records to be loaded into DB.

    Any question even face to face only one?

    Kind regards

    NN.

    Hello

    For those who have faced the question above.

    Here is the Solution.

    1. Informatica PowerCenter Designer, place you in the SIL_Vert\Mappings folder and open the "SIL_ProductCategoryDimension_Hierarchy" mapping in the mapping Designer tool.
    2. Change the qualifier Source SQ_W_PRODCAT_DS to display the dialog box change Transformations and switch to the Properties tab.
    3. Select the name of the attribute processing Sql Query and edit the substitution of sql to change the status of outer join left in w_product_d as:
    4. DATABASE W_PRODCAT_DS
    5. LEFT OUTER JOIN W_PRODUCT_D PROD ON
    6. BASE. PROD_ID = PROD. INTEGRATION_ID AND PROD. CURRENT_FLG = 'Y '.
    7. Save the details and archive.


    The changes described above helped me load management command successfully.


    Kind regards

    NN.


  • Creation of a PK via Create Unique Index key more OR through PK restrict only

    What is "significance" of the following difference: -.

    Some PK indexes in the database that I deal with are scripted by creating a Unique index first, then adding the PK constraint with syntax "using the index.

    Others simply create the PK using the addition of the primary key constraint syntax.

    We're much better than the other or where in the documentation would review it? I can't find that he discusses more probably looking in the wrong book.

    Thanks in advance. Bill

    Hi Bill,

    If you create a unique index first then add PK constraint or create a PK constraint directly, one and the same.

    Say, there is a unique index on the column 'a' and now you want to apply PK constraint on the same column, instead of dropping the index and re-create the same, you can use the existing one. It's ok if the amount of data is less, but for a huge amount of data, it is a killer.

    Here's a little comparison of the two cases:

    SQL> drop table t purge;
    
    Table dropped.
    
    SQL> create table t ( a number);
    
    Table created.
    
    SQL> create unique index t_idx on t(a);
    
    Index created.
    
    SQL> alter table t add constraint t_pk primary key (a) using index t_idx;
    
    Table altered.
    
    SQL> select uniqueness from user_indexes where index_name = 'T_IDX';
    
    UNIQUENES
    ---------
    UNIQUE
    
    SQL> select constraint_name, constraint_type, index_name from user_constraints where table_name = 'T';
    
    CONSTRAINT_NAME                C INDEX_NAME
    ------------------------------ - ------------------------------
    T_PK                           P T_IDX
    
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> drop table t purge;
    
    Table dropped.
    
    SQL> create table t ( a number);
    
    Table created.
    
    SQL> alter table t add constraint t_pk primary key (a);
    
    Table altered.
    
    SQL> select uniqueness from user_indexes where index_name = 'T_PK';
    
    UNIQUENES
    ---------
    UNIQUE
    
    SQL> select constraint_name, constraint_type, index_name from user_constraints where table_name = 'T';
    
    CONSTRAINT_NAME                C INDEX_NAME
    ------------------------------ - ------------------------------
    T_PK                           P T_PK
    
    SQL>
    

    I hope that the answer was clear.

    Concerning

    Asif Momen
    http://momendba.blogspot.com

  • Implementation error on step "Create Unique Index on flow table.

    Hello

    I'm getting following error on execution of the interface. It simple interface with text file as source and oracle table as the target. Primary key has been set on the Empno column in the target. I tried to use all the CKM but error remains the same. I disabled the journaling option as well. Here is the statement that it generates for unique indexes

    create a unique index ABC. "I have _Emp$ 'idx '.
    on ABC. "" I have$ _Emp ' ('Empno')


    I did not understand why she strives to create a unique index on the flow table, even when I turn off the option in CKM for does not create index. Even more later, I tried with the evolution of the seam, but error remains same. Initially, I tried with Oracle CKM (Create Index for the I$ Table), then turned off the option to create indexes, then tried out with CKM SQL and Oracle CKM, but result is the same.


    Any help is appreciated.

    Thank you
    -CHikk


    911: 42000: java.sql.SQLException: ORA-00911: invalid character

    java.sql.SQLException: ORA-00911: invalid character


    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)

    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)

    at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)

    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3057)

    at com.sunopsis.sql.SnpsQuery.executeUpdate (SnpsQuery.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt (SnpSessTaskSqlI.java)

    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask (SnpSessTaskSql.java)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep (SnpSessStep.java)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession (SnpSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand (DwgCommandSession.java)

    at com.sunopsis.dwg.cmd.DwgCommandBase.execute (DwgCommandBase.java)

    at com.sunopsis.dwg.cmd.e.i (e.java)

    at com.sunopsis.dwg.cmd.g.y (g.java)

    at com.sunopsis.dwg.cmd.e.run (e.java)

    at java.lang.Thread.run (unknown Source)

    Hello

    Just go to the topology, the physical Architecture, right-click on Oracle technology and another tab change the delimiter 'object' for nothing...

    That will fix it.

  • unique index on flow error

    Hi gurus,

    One of my work in ODI 10.1.3.5 fails to step: create a unique index on the flow table
    and
    throw this error: ORA-02158: invalid CREATE INDEX option

    in previous places of employment, he executed successfully but now his failure to get...

    I'm looking:

    1. What can be the reason of this failure.
    2. can I I skip this step by changing a setting in the flow control tab / (without checking the step by IKM (ignoring the error) - as he will ignore the other packages using the same IKM)
    3. the used IKM is the INCREMENTAL of the IKM ORACLE.

    Thank you
    Ravi

    Hi Ravi,

    I'll try to help you.

    1. What can be the reason of this failure.

    ODI will create a non-unique index running based on the PK (primary key) defined in the target data store. So, it could be because some invalid CREATE INDEX option is shown in the flow tab.

    2. can I I skip this step by changing a setting in the flow control tab / (without checking the step by IKM (ignoring the error) - as he will ignore the other packages using the same IKM)

    Better, the flow tab, you can do FLOW_TABLE_OPTION of virgins and try.

    3. the used IKM is the INCREMENTAL of the IKM ORACLE.

    Should be good.

    Thank you
    Guru

  • How to add a column to an existing unique index?

    Hello

    I have a unique index defined on 5 columns in a table. I want to add a column more to the unique index. Is there one solution other than to drop and create the index?

    Also please let me know which is the ideal way to do it. The table has about 80 million documents.


    Thanks in advance,
    Noble.

    None...

    but creating the new index before your previous fall, the previous will be helping to create the new index faster.

    Abhishek Gera

  • Unique index on two columns based on the conditon

    I have a table where I have two columns name and feed.
    create table test1 (name varchar(20), feed varchar(4));
    
    insert into test1 values('abc','L3');
    insert into test1 values( 'abc','Both');
    insert into test1 values('abc','L2');
    I want to create a unique index for the lines abc - L3 and cant abc - both together be inserted, rest the other flow values is not a problem, so the first two rows can not be there in the table.

    Please suggest

    Thajs
    create unique index test1_ind1 on test1 (name, case when feed = 'Both' then 'L3' else feed end );
    

    Who did what you asked...

    However, I highly doubt it does what you WANT.

    Please provide information on the requirements, and we the flesh that out a little better.

  • UNIQUE INDEX

    CREATE TABLE IMP_HAND
    (

    LOAD_TIME DATE NOT NULL,
    KVN_SEQ NUMBER (10) NOT NULL,
    CREATIONDATE DATE NOT NULL
    )

    Examples of data
    -----------------------------------------------------------------
    "|" delimiter of data



    LOAD_TIME | KVN_SEQ | CREATIONDATE
    -------------------------------------------------------------
    2011-03-07 17:12:33 | 15. 2011-03-08 17:12:33
    2011-03-07 18:12:33 | 15. 2011-03-08 17:12:33
    2011-03-07 19:12:33 | 15. 2011-03-08 17:12:33
    2011-03-07 19:17:39 | 15. 2011-03-08 17:12:33
    2011-03-07 19:52:51 | 15. 2011-03-08 17:12:33


    How can I create a unique index on the column LOAD_TIME, KVN_SEQ on the IMP_HAND table

    Hello

    Search "CREATE INDEX" in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/clauses002.htm#i1034458
    It has examples and explanations.

    You must create a unique constraint , which automatically creates a unique index.
    "CONSTRAINTS" are also in the manual of the SQL language.

  • Two tables that have a relationship as "many-to-many" and "one-to-many.

    I have the next two represents tables users and the other represents the items where each item can have an author (user) and of course, users can create a lot of articles, so the one-to-many relationship: -.

    1. users: -.
    User_id (primary_key)
    User_name
    User_sex
    user_address

    2.ARTICILES: -.
    Article_id
    Text
    Author_id (foreign key to the users.user_id)

    but the problem I have been facing is that, on another requirement each items can have several (users) approval before being published, so in this way have become the many-to-many relationship, so I created a third table called "trusts": -.

    3.approval: -.
    approval_id (foreign key to the users.user_id)
    article_id (foreign key to the articles.article_id)
    level.

    so is this a good approach to flow, or there is another way I can better build these tables.

    Hello
    Relationship seems to be ok for your current condition. but make sure you have sequence approval on your table to the approval, in case you should find the flow of approvals.

    See you soon
    Kanchana

  • Why is a unique index created implicitly on a CLOB column?

    Hello.

    On a 9.2.0.7 db I modified a table to change a column in a CLOB, I saw that a unique index was implicitly created for the new column.
    This is the normal of the alter behavior when you change a Long on the CLOB type? Why?

    It's strange to me because later I inserted 3 folders on the table with the same text in the CLOB column (I guess the backs of oneness does not refer to the ascii content). What is unique?
    SQL> select index_name, index_type, uniqueness from user_indexes where table_name = 'R2_CONFIG' and index_type = 'LOB';
    
    INDEX_NAME                     INDEX_TYPE                  UNIQUENES
    ------------------------------ --------------------------- ---------
    SYS_IL0000012898C00006$$       LOB                         UNIQUE
    Thanks in advance.

    fsanchezherrero wrote:

    I also noticed that I can not rebuild the index for the tablespace where the other indexes. Is this normal?

    As I said, Oracle maintains LOBINDEX internal. You can not just move to a different tablespace. And unless you're on 8.0, you can't even set/alter tablespace using ALTER TABLE, although Oracle allows you to specify CREATE TABLE:

    SQL> create table t(id number,c clob)
      2  lob(c) store as c_clob(index(tablespace example))
      3  /
    
    Table created.
    
    SQL> select index_name, index_type,tablespace_name from user_indexes where table_name = 'T';
    
    INDEX_NAME                     INDEX_TYPE                  TABLESPACE_NAME
    ------------------------------ --------------------------- ------------------------------
    SYS_IL0000109090C00002$$       LOB                         USERS
    
    SQL> drop table t
      2  /
    
    Table dropped.
    
    SQL> create table t(id number,c clob)
      2  lob(c) store as c_clob(tablespace example index(tablespace users))
      3  /
    
    Table created.
    
    SQL> select index_name, index_type,tablespace_name from user_indexes where table_name = 'T';
    
    INDEX_NAME                     INDEX_TYPE                  TABLESPACE_NAME
    ------------------------------ --------------------------- ------------------------------
    SYS_IL0000109093C00002$$       LOB                         EXAMPLE
    

    At least they fixed ALTER TABLE:

    SQL> alter table t modify lob(c) (index(tablespace userts))
      2  /
    alter table t modify lob(c) (index(tablespace userts))
                                       *
    ERROR at line 1:
    ORA-22853: invalid LOB storage option specification
    

    SY.

  • 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

  • When I change a column is a primary key the associated non-unique index to become unique?

    So basically I already tried this and it shows me that the associated index is not unique.

    create table employees2 in select * from employees;

    create index emp_idx on employees2 (employee_id);

    ALTER employees2 table add primary key (employe_id) using index emp_idx;

    Select * from user_indexes where index-name = "EMP_IDX";

    I was wondering if I right assuming that when you change a column to a primary key or unique while using a given index that does not have the respective index become unique.

    The textbooks I use are sometimes a little hard to understand because of the wording, also, I want to just ask someone with a little more experience than me.

    Thank you.

    your test did give the correct answer: the index is not unique if it serves to bear a unique or primary key constraint. Indeed, it is one of the benefits of the use of no unique indexes in support of UK/PK constraints (since it allows to set the unusable index before to make bulk loads; and, of course, they have also some disadvantages - for example, they need an additional logical reading to reach a line). Richard Foote explains the details in https://richardfoote.wordpress.com/2008/06/04/primary-keys-and-non-unique-indexes-whats-really-happening/ (and other items).

  • Duplicate display of unique indexes on diagram - how to remove?

    Hey people,

    A little new for the Modeler and I have a problem with a table I did where a unique index appears twice on my diagram.  I can't understand how to remove it.

    Any ideas?

    Thanks for the help!

    Eric

    In fact you need to look at the bitty little next to each icon and you will see that they are different. What you have is a unique index and a unique key constraint. Different objects in the database named but identical by the Data Modeler (which is automatically generated index when you declared the constraint). If you go to the properties of the table and click on the index node you will see. Now, click on the single key node and you will see the same name. Right-click on the table in the diagram and choose the DOF preview. After the create table code, you should see a create index command and create a unique alter constraint table.

    Why do you need both - constraint and different index information give the optimizer. You can do without one or the other - maybe. Tom Kyte wrote a note on this subject a while back on AskTom. If you're really curious, go here (I don't remember the details).

Maybe you are looking for