Create the primary key on the target

Y at - it no IKM which would create the primary key on target after having read the instructions for the source?

Thank you
Dinesh.

Hi Dinesh,

You can customize a KM to create a primary key on the target
The target table will be created with the mention of the primary key constraint in the data target store.

Steps: -.

Customiuse creating target step of the table and I create $ step table.

for example: -.

original train target table KM walk (IKM Oracle Simple incremental update): -.

create table< %="snpRef.getTable" ("l",="" "a",="" "targ_name")="" %="">
(
     <%=snpRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] NULL", ",\n\t", "")%>
)

custom STAGE: -.

create table< %="snpRef.getTable" ("l",="" "a",="" "targ_name")="" %="">
(
     <%=snpRef.getTargetColList("", "[COL_NAME]\t[DEST_CRE_DT] NULL", ",\n\t", "")%>

CONSTRAINT constraint_name PRIMARY KEY (< %="snpRef.getColList" ("",="" "[column]",="" ",",="" "",="" "pk")="" %="">)
)

Note:- The code above described here is just a sample of reference. I did not test the syntax.

Kind regards
Its

Tags: Business Intelligence

Similar Questions

  • Need to create a primary key by using sequence in a table with records.

    Hello
    I want to create a primary key for a table that is already having a huge number of records. Am thinking to create the primary key by using a sequence generator. Could someone tell how can I do this using SQL or PL - SQL.

    Kind regards
    SK

    Hello

    Try this...

    SQL> select * from emp;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    
    14 rows selected.
    
    SQL> create sequence emp_empno_seq
      2  start with 1
      3  minvalue 1
      4  maxvalue 999999999999999999999
      5  increment by 1
      6  nocache
      7  noorder
      8  nocycle;
    
    Sequence created.
    
    SQL>
    SQL> ed
    Wrote file afiedt.buf
    
      1  update emp
      2* set empno=emp_empno_seq.nextval
      3  /
    
    14 rows updated.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from emp;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
             1 SMITH      CLERK           7902 17-DEC-80        800                    20
             2 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
             3 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
             4 JONES      MANAGER         7839 02-APR-81       2975                    20
             5 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
             6 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
             7 CLARK      MANAGER         7839 09-JUN-81       2450                    10
             8 SCOTT      ANALYST         7566 19-APR-87       3000                    20
             9 KING       PRESIDENT            17-NOV-81       5000                    10
            10 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
            11 ADAMS      CLERK           7788 23-MAY-87       1100                    20
            12 JAMES      CLERK           7698 03-DEC-81        950                    30
            13 FORD       ANALYST         7566 03-DEC-81       3000                    20
            14 MILLER     CLERK           7782 23-JAN-82       1300                    10
    
    14 rows selected.
    

    Thank you
    Prakash P

  • I'm trying to map a network drive. I created the target folder on the shared computer, but the folder does not appear when I try to map?

    I have a network machine, 4 machines and a fifth small office which acts as a server.  I created a folder target on the server.  Then, I try to map a drive on one of the four other machines that have access to this folder target on the server.  However, the target folder will not appear when I go to the other machine card.

    Hey Dano,

    Your question is more complex that most seem to be on the answers. I suggest that you re-post on our TechNetforums where computer professionals can help you.

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

    I hope this helps.

  • Call a page after you have created a primary key?

    Hello

    I have a form on a table with a button create on this subject. When I click on the button CREATE and brings back me to this report which shows my new record, the primary key is created. Here, everything's fine.

    Now, I want to create a branch to a new page (after treatment), passing the value of my new primary key to this page. But it seems that this value is zero (if I look in the URL there is no value)

    For example, I need to create a new customer, then pass the primary key of my client to a new page. But it does not work... someone can help me?

    Thank you

    Mathieu

    You should take a look in your SRM process and he'll say

    Return key in point

    You must put the name of the key (primary) here like this:

    P1_PRIMARY_KEY

    If you create a new record, the process will get the primary key and set the item with this value. You can refer to this element in your conditional branch and it'll pass this value to your target page. That's essentially what Scott said in his first response.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Why create a primary key on a VIEW?

    One of our developers found that you can define a primary key on a VIEW. What are the circumstances which justify the something like that?

    -= Chuck

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:636499119911

    "
    Tom,

    I'm a little confused on the constraints on views. According to the documentation, they are not applied. Then
    What is the use for the constraints on views?

    According to the "SQL Reference": documents

    Constraints of view (the view and the column level or attribute) are declarative. It's
    Oracle does not apply to them. However, the operations on views are subject to constraints of integrity
    defined on the underlying base tables, then you can apply constraints on views through constraints
    on the base tables.

    Thanks for your time.

    Follow-up February 5, 2002-11:00 Central time zone:

    They are used for rewriting complex query with other materialized views. It's more "metadata".
    -It gives additional information from the optimizer, allows a wider range of the rewrite of the query to
    place.
    "

  • Running script to create the target database user account: OIM 11 g

    Hello
    We have a database resource on which accounts are created by running a set of scripts. Creating a user on the database directly is not allowed. Is this a common use case? I am sure about how IOM knows that this account was created (how I would list the resources allocated to a user)? If I'm not listed as a resource for a user account, then how changes will be...

    Any suggestions or advice are appreciated.
    Thank you!

    Do the steps in the procurement process for example process shape, object resource, etc. from process.
    Call your script adapter java task map the response code returned by your script.

  • By specifying the Composite primary key (columns 4 and 5)

    Hi all

    I am new to Oracle Apex,

    I have a few paintings with a composite primary key (4 or 5 columns)... When I try to create a primary key constraint, it gives me only 3 columns!

    Any help please in how can I solve this problem?

    Thanks in advance

    You are probably using the workshop for this sql Object Explorer

    which seems to be limited to 4 columns on APEX 4.2.3

    best thing to do is to create manually using the sql commands in sql workshop, here's an example:

    {code}

    CREATE UNIQUE INDEX myui ON JC_ACCOUNT

    (TITLE_ID, FAMILY_NAME GIVEN_NAME, GENDER_ID, TELEPHONE_NUMBER)

    /

    {code}

    I hope this helps you

    KR

    Martin

  • reverse the primary key index

    Hello

    When we create a primary key, it automatically creates a unique index on it. He is sort can we give a clause to create a single inverted index on this subject?

    We can of course more late the state change an index to Conversely, but how to do it at creation time?

    Kind regards!
    create table test_123(c1 number primary key using index  reverse)
    
  • How to convert a single column in the primary key column

    Hi all

    I have a column that's unique cnstraint, this column contains the value as digital and also null.

    So how do you convert to primary key column

    Concerning
    Prashant

    Prashant wrote:
    Hi all

    I have a column that's unique cnstraint, this column contains the value as digital and also null.

    So how do you convert to primary key column

    Concerning
    Prashant

    Prashant,

    You must assign new values to null values. You can use a sequence to produce the figures in this column.

    Select max (your_unique_column) from your_table; -find the maximum value of this column, so you can start the sequence of this number.

    create sequence seq_for_your_table with XXXX - value max + 1 you have found

    Update your_table set your_unique_column = seq_for_your_table.nextval () where your_unique_column is null

    You can create a primary key on this column.

    Best regards

    Grosbois

    -------------------------------------------------------
    If you answer this question, please mark appropriate as correct/useful messages and the thread as closed. Thank you

  • Problem with the primary key

    Hi all
    I have a table with the same data repeat 2 times. I mean that the lines are depating twice. so now, I create a primary key for the table. He throws me an error saying voilation key primary. I'll give you the clear script.

    create table employee)
    ID VARCHAR2 (4 BYTE) NOT NULL,
    First name VARCHAR2 (10 BYTE),
    VARCHAR2 (10 BYTE) last_name,
    START_DATE DATE,
    End_date DATE,
    Number (8.2) of salary.
    City VARCHAR2 (10 BYTE),
    Description VARCHAR2 (15 BYTE)
    )


    insert into employee values ('01', 'Jason', 'Martin', to_date('19960725','YYYYMMDD'), to_date('20060725','YYYYMMDD'), 1234.56, 'Toronto', 'Program');
    insert into employee values ('02', "Alison", "Mathews', to_date('19760321','YYYYMMDD'), to_date('19860221','YYYYMMDD'), 6661.78, 'Vancouver', 'Tester');
    insert into employee values ('03', 'James', 'Smith', to_date('19781212','YYYYMMDD'), to_date('19900315','YYYYMMDD'), 6544.78, 'Vancouver', 'Tester');
    insert into employee values ('04', 'Celia', 'Rice', to_date('19821024','YYYYMMDD'), to_date('19990421','YYYYMMDD'), 2344.78, "Vancouver", "Manager");
    insert into employee values ('05', 'Robert', 'Black', to_date('19840115','YYYYMMDD'), to_date('19980808','YYYYMMDD'), 2334.78, 'Vancouver', 'Tester');
    insert into employee values ('07', 'David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78, 'New York', 'Manager');
    insert into employee values ('06', 'Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78, 'New York', 'Tester');
    insert into employee values ('08', 'James', 'Cat', to_date('19960917','YYYYMMDD'), to_date('20020415','YYYYMMDD'), 1232.78, 'Vancouver', 'Tester')
    insert into employee values ('07', 'David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78, 'New York', 'Manager');
    insert into employee values ('06', 'Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78, 'New York', 'Tester');


    The table is now with 10 columns

    ID FIRST_NAME LAST_NAME START_DAT END_DATE SALARY CITY DESCRIPTION
    ---- ---------- ---------- --------- --------- ---------- ---------- ---------------
    Jason Martin 25 July 96 01 25 July 06 1234.56 Toronto programmer
    02 Alison Mathews 21 March 76 February 21, 86 6661.78 Vancouver Tester
    03 James Smith December 12, 78 March 15, 90 6544.78 Vancouver Tester
    04 Celia rice 24 October 82 21 April 99 2344.78 Vancouver Manager
    Robert Black 05 January 15, 84 8 August 98 2334.78 Vancouver Tester
    Linda Green 06 July 30, 87 January 4, 96 4322.78 tester of New York
    Manager of New York 07 David Larry 31 December 90 February 12, 98 7897.78
    08 James Cat 17-AUG-96 April 15 02 1232.78 ester of Vancouver


    Create a primary key for the table

    "Employee to ALTER TABLE PRIMARY KEY (ID, First_Name, Last_Name, start_date, end_date,
    Salary, city, Description); »

    I get error voilation primary key

    IS IT POSSIBLE TO CREATE THE KEY PRIMARY ON THE TABLE WITH ON THE DELETION OF THE DATA?
    Is IT POSSIBLE CREATING PRIMARY KEY USING 'GROUP BY' FUNCTION or OTHER FUNCTIONS?

    Published by: user11872870 on September 23, 2010 17:41

    Primary key columns cannot contain NULL values. If you tried to create a primary key constraint, you will get an error like this:

    ERROR at line 1:
    ORA-01449: column contains NULL values: cannot alter to NOT NULL
    

    However, you can add a unique constraint by doing something like the following:

    ALTER TABLE test ADD CONSTRAINT test_unq UNIQUE (column1, column2);
    

    I still wonder why you take the approach you take. I have a vague feeling that're missing us the key pieces of information to recommend the correct solution.

  • View of Materlized primary key and primary key in the master tables

    We use the Oracle 11 g 2 and I created a view on several paintings of master materlized. The paintings of masters all have the primary key, but I understand not all primary key columns in the query definition.
    According to Oracle manual e10592
    Specify WITH PRIMARY KEY to create a primary key materialized view. This is the default ....
    The master table must contain an enabled primary key constraint, and the defining query of the materialized view 
    must specify all of the primary key columns directly.
    My MV created OK and works. My question is what can be the impact on my MV? Could he hit to performance. It takes 40 minutes to the MV should be created and 5 minutes to refresh the one line insert in each table of mater. I would like to see it refresh in a few seconds.

    Retrieve the lines of the mview is purely a function of the number of lines and indexing on the mview himself. Mview refreshing at the time of the wall depends on the quality of the query used to refresh the mview. If you include the PKs of the source table in the mview matter or not, here. What matters is the execution of the refresh request path. Is it okay to indexation on the underlying tables to support the joints. Did you use mlog$ _s to allow a quick refresh - mlog$ _s are still usable for your mview. There are a number of possible causes for your problem and we do not have enough information to make an estimate of the problem.

    BTW, if the mview could refresh in a few seconds without mlog$ _s, probably unnecessary a mview.

  • Cannot create the folder to, navigate to the point of the entity object

    Hello gurus,

    I'm new in the adf and the use of 11.1.2.3. I have two field in the entity. A filed value is max (last value + 1) and the other field has a default value of "A". In my layer model when I click on the button create is fills the field with the highest value of the column and the other field is filled with the default value. In the layer of model results are as not planned no question and I can hire the newly created folder. But in the view down when I click on create the record he fill the first field with the highest values and the second field with a value of default but does not save changes to database until I have change something in the field. It does happen that a record has been created. Please any suggestions...

    What is little whereas if you set only the default values when you create a line, the line status is set to Row.STATUS_INITIALIZED which updates the row in a State where he is not put in the list of objects that should be added to the db. Only when you change an attribute status is set to Row.STATUS_NEW that will send the line to the db. You can set this status after the creation of a line with all default values by calling setNewRowState (STATUS_NEW) on the new line.

    More information can be found at one size does not fit all: ADF BC: EO/VO State initial post create() explained and Creating ADF Databound Tables - 11 g Release 2 (11.1.2.3.0)

    One last thing: I hope that you do not use the max (last value + 1) to create a primary key. It will not work in a multi user environment where several users can record.

    Timo

  • create the table in SELECT (question)

    Hello

    In regards to create the table as subquery, I read that:

    The data type of column definitions and the NOT NULL constraint are passed to the new table. Note that only the explicit NOT NULL constraint is inherited. The PRIMARY KEY column will not function NOT NULL column null. Any other rule of constraint is not passed to the new table. However, you can add constraints in the column definition.

    Can someone explain to me how to do this? Or, how we need to specify the constraints (and also the default values for columns, because it is possible) for the columns in the column definition?

    In addition, I do not understand this: the PRIMARY KEY column will not function NOT NULL column zero.
    Can someone give me some small examples regarding these?
    For example, it generates an error:
    create table test1 (a, b, c default sysdate) 
    as 
    select 1, 'b' from dual
    Thank you!

    Edited by: Roger22 the 01.09.2011 11:37

    Hello

    When you set a primary key consists of a unique constraint and a constraint not null, but they are both implicit with the primary key. When you create the table because it will copy only the explicitly declared NOT NULL constraints so it isn't look upward than the implicit NOT NULL primary key.

    SQL> create table dt_pk
      2  (   id      number primary key,
      3      col1    number not null,
      4      col2    number
      5  )
      6  /
    
    Table created.
    
    SQL> desc dt_pk
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                        NOT NULL NUMBER
     COL1                                      NOT NULL NUMBER
     COL2                                               NUMBER
    
    SQL> create table dt_pk2 as select * from dt_pk;
    
    Table created.
    
    SQL> desc dt_pk2;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                                 NUMBER
     COL1                                      NOT NULL NUMBER
     COL2                                               NUMBER
    
    SQL> select constraint_name,constraint_type from user_constraints where table_name='DT_PK'
      2  /
    
    CONSTRAINT_NAME                C
    ------------------------------ -
    SYS_C006935772                 C
    SYS_C006935773                 P
    
    SQL> select constraint_name,constraint_type from user_constraints where table_name='DT_PK2'
      2  /
    
    CONSTRAINT_NAME                C
    ------------------------------ -
    SYS_C006935774                 C
    

    However, a primary key can reuse existing constraints and indexes instead of declaring new. For example, we can explicitly declare a constraint not null on the column id and then create a primary key. This means that we will now inherit the constraint not null in the ETG, as it has been explicitly declared and is a constraint separate in there own right that has been 'borrowed' by the pk constraint.

    SQL> create table dt_pk3 (id number not null, col1 number not null, col2 number);
    
    Table created.
    
    SQL> alter table dt_pk3 add constraint dt_pk3_pk primary key (id);
    
    Table altered.
    
    SQL> select constraint_name,constraint_type from user_constraints where table_name='DT_PK3'
      2  /
    
    CONSTRAINT_NAME                C
    ------------------------------ -
    SYS_C006935775                 C
    SYS_C006935776                 C
    DT_PK3_PK                      P
    
    SQL> create table dt_pk4 as select * from dt_pk3;
    
    Table created.
    
    SQL> desc dt_pk3;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                        NOT NULL NUMBER
     COL1                                      NOT NULL NUMBER
     COL2                                               NUMBER
    
    SQL> desc dt_pk4;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                        NOT NULL NUMBER
     COL1                                      NOT NULL NUMBER
     COL2                                               NUMBER 
    

    Regarding the definition of the default values, you must always specify the column in the select, but doing so means follow you the semantics of a default in a standard INSERT statement, i.e. you specified the column, you must provide a value, in which case even if the value is null, the default value will not be used. However, the new inserted rows where the column with the default value is not specified will revert to the default.

    SQL> create table test1 (a, b, c default sysdate)
      2  as
      3  select 1, 'b' from dual
      4  /
    create table test1 (a, b, c default sysdate)
                        *
    ERROR at line 1:
    ORA-01730: invalid number of column names specified
    
    SQL> create table test1 (a, b, c default sysdate)
      2  as
      3  select 1, 'b', null c from dual
      4  /
    select 1, 'b', null c from dual
                   *
    ERROR at line 3:
    ORA-01723: zero-length columns are not allowed
    
    SQL> create table test1 (a, b, c default sysdate)
      2  as
      3  select 1, 'b', cast(null as date) c from dual
      4  /
    
    Table created.
    
    SQL> select * from test1;
    
             A B C
    ---------- - ---------
             1 b
    
    SQL> insert into test1(a,b) values(2,'b');
    
    1 row created.
    
    SQL> select * from test1;
    
             A B C
    ---------- - ---------
             1 b
             2 b 01-SEP-11
    

    To create a constraint, you must list all columns without the data types and constraints list online.

    SQL> create table dt_cons (id number, col1 number, col2 number, constraint chk2 check(col2 IS NULL or col2>10))
      2  as select * from dt_pk3
      3  /
    create table dt_cons (id number, col1 number, col2 number, constraint chk2 check(col2 IS NULL or col2>10))
                          *
    ERROR at line 1:
    ORA-01773: may not specify column datatypes in this CREATE TABLE
    
    SQL> create table dt_cons (constraint chk2 check(col2 IS NULL or col2>10))
      2  as select * from dt_pk3
      3  /
    create table dt_cons (constraint chk2 check(col2 IS NULL or col2>10))
                         *
    ERROR at line 1:
    ORA-00904: : invalid identifier
    
    SQL> create table dt_cons (col2 constraint chk2 check(col2 IS NULL or col2>10))
      2  as select * from dt_pk3
      3  /
    create table dt_cons (col2 constraint chk2 check(col2 IS NULL or col2>10))
                          *
    ERROR at line 1:
    ORA-01730: invalid number of column names specified
    
    SQL> create table dt_cons (id,col1,col2 constraint chk2 check(col2 IS NULL or col2>10))
      2  as select * from dt_pk3
      3  /
    
    Table created.
    
    SQL> desc dt_cons
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                        NOT NULL NUMBER
     COL1                                      NOT NULL NUMBER
     COL2                                               NUMBER
    
    SQL> insert into dt_cons values(2,2,2);
    insert into dt_cons values(2,2,2)
    *
    ERROR at line 1:
    ORA-02290: check constraint (JJACOB_APP.CHK2) violated
    
    SQL> insert into dt_cons values(2,2,10);
    insert into dt_cons values(2,2,10)
    *
    ERROR at line 1:
    ORA-02290: check constraint (JJACOB_APP.CHK2) violated
    
    SQL> insert into dt_cons values(2,2,11);
    
    1 row created.
    
    SQL> insert into dt_cons values(2,2,null);
    
    1 row created.
    
    SQL>
    

    HTH

    David

  • primary key for a column made up of duplicates

    Hello
    -> I have created a table and
    -> I have a column consisting of 1,000 records (but where I have duplicates)

    and now, I want to create a primary key for the column
    How can I do it...

    Hello

    Run the utlexcpt.sql script located in the ORACLE_HOME/rdbms/admin directory level to create the exception table.

    Thank you

  • Primary key

    Hi all

    I created a test table which has 4 columns:
    SR_NO, FNAME, LNAME, and GRADES.

    The rank column has the same value repeat several times.

    Then I intend to create a primary key on 3 columns: FNAME, LNAME, and GRADES.
    alter table test_tab add the key primary constraint mv_testy_pk (FNAME, lname, rank);
    and oracle allows me but I need to know that columns of rank has already repeated values in it, so what happens to the PK here.

    BR
    Sphinx

    Read will have get the notion of primary key.

    When you create a primary key knowledge composite primary key is composed of multiple columns, then it will check whether or not the combination of the data in the three columns are unique. for example:

    lname: 1 Fname: abc grade: A
    lname: Fname 2: def grade: A

    Here, although repeats in the shade, but the combination of three columns are unique... isn't it?

    This is why oracle allows you to create the primary key.

Maybe you are looking for