Creating Primary key Index as Local Partitioned Index.

CREATE TABLE T1(
x NUMBER,
y NUMBER
)PARTITION BY LIST(x)
PARTITION P1 VALUES (1),
PARTITION P2 VALUES (2),
PARTITION Pmax VALUES (default)
ALTER TABLE T1 ADD CONSTRAINT T1_PK PRIMARY KEY(Y) LOCAL;
Error starting at line 1 in command:
ALTER TABLE T1 ADD CONSTRAINT T1_PK PRIMARY KEY(Y) LOCAL
Error report:
SQL Error: ORA-01735: invalid ALTER TABLE option
01735. 00000 - "invalid ALTER TABLE option"
*Cause:   
*Action:
Can you please help me how to achieve this in Oracle 10g R2?

LOCAL keyword is invalid with ALTER TABLEDepends:
SQL>  create table t1 (x number, y number)
partition by list (x)
   (partition p1
       values (1),
    partition p2
       values (2),
    partition pmax
       values (default))
Table created.
SQL>  alter table t1 add constraint t1_pk primary key(x, y) using index local
Table altered.

Similar Messages

  • Creating Local partitioned index on Range-Partitioned table.

    Hi All,
    Database Version: Oracle 8i
    OS Platform: Solaris
    I need to create Local-Partitioned index on a column in Range-Partitioned table having 8 million records, is there any way to perform it in fastest way.
    I think we can use Nologging, Parallel, Unrecoverable options.
    But while considering Undo and Redo also mainly time required to perform this activity....Which is the best method ?
    Please guide me to perform it in fastest way and also online !!!
    -Yasser

    YasserRACDBA wrote:
    3. CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) LOCAL
    NOLOGGING PARALLEL (DEGREE 14) online;
    4. Analyze the table with cascade option.
    Do you think this is the only method to perform operation in fastest way? As table contain 8 million records and its production database.Yasser,
    if all partitions should go to the same tablespace then you don't need to specify it for each partition.
    In addition you could use the "COMPUTE STATISTICS" clause then you don't need to analyze, if you want to do it only because of the added index.
    If you want to do it separately, then analyze only the index. Of course, if you want to analyze the table, too, your approach is fine.
    So this is how the statement could look like:
    CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) TABLESPACE CS_BILLING LOCAL NOLOGGING PARALLEL (DEGREE 14) ONLINE COMPUTE STATISTICS;
    If this operation exceeds particular time window....can i kill the process?...What worst will happen if i kill this process?Killing an ONLINE operation is a bit of a mess... You're already quite on the edge (parallel, online, possibly compute statistics) with this statement. The ONLINE operation creates an IOT table to record the changes to the underlying table during the build operation. All these things need to be cleaned up if the operation fails or the process dies/gets killed. This cleanup is supposed to be performed by the SMON process if I remember correctly. I remember that I once ran into trouble in 8i after such an operation failed, may be I got even an ORA-00600 when I tried to access the table afterwards.
    It's not unlikely that your 8.1.7.2 makes your worries with this kind of statement, so be prepared.
    How much time it may take? (Just to be on safer side)The time it takes to scan the whole table (if the information can't read from another index), the sorting operation, plus writing the segment, plus any wait time due to concurrent DML / locks, plus the time to process the table that holds the changes that were done to the table while building the index.
    You can try to run an EXPLAIN PLAN on your create index statement which will give you a cost indication if you're using the cost based optimizer.
    Please suggest me if any other way exists to perform in fastest way.Since you will need to sort 8 million rows, if you have sufficient memory you could bump up the SORT_AREA_SIZE for your session temporarily to sort as much as possible in RAM.
    -- Use e.g. 100000000 to allow a 100M SORT_AREA_SIZE
    ALTER SESSION SET SORT_AREA_SIZE = <something_large>;
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • How to simply create a locally partitioned index with a dedicated tablespac

    Dears,
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64biSuppose you have a range partitioned table t on date d with n partitions p1, p2,....pn
    If you create a locally partitioned index using the following script
    create index ind_loc on t(d) local;all the partitioned indexes will be created on the same default tablespace.
    Is there a simple creation script (not that where we have to add each partition and each tablespace) to use in order to associate each partitioned index to a given tablespace?
    Best Regards
    Mohamed Houri

    Suppose you have a range partitioned table t on date d with n partitions p1, p2,....pn
    If you create a locally partitioned index using the following script
    create index ind_loc on t(d) local;all the partitioned indexes will be created on the same default tablespace.
    Is there a simple creation script (not that where we have to add each partition and each tablespace) to use in order to associate each partitioned index to a given tablespace?
    Hi Mohamed ,
    AFAIK , there is no such script . If you want partition to be stored in different tablespaces, then you will have to specify partition name along with tablespace name in create index command.
    Regards
    Rajesh

  • 10g:  How to determine Local Partition Index Space UTILIZATION

    I'm trying to determine how much space is actually utilized by different local partition indexes. Some are b-tree and some are bitmap. So far when I query dba_segments and dba_part_indexes I just see space available, not the space utilized.
    Does anybody know a way to know the actual space utilized by a local partition index?

    Does anybody know a way to know the actual space utilized by a local partition index?SUM(BYTES) from dba_extents
    SQL> desc dba_extents
    Name                            Null?    Type
    OWNER                                  VARCHAR2(30)
    SEGMENT_NAME                             VARCHAR2(81)
    PARTITION_NAME                         VARCHAR2(30)
    SEGMENT_TYPE                             VARCHAR2(18)
    TABLESPACE_NAME                        VARCHAR2(30)
    EXTENT_ID                             NUMBER
    FILE_ID                             NUMBER
    BLOCK_ID                             NUMBER
    BYTES                                  NUMBER
    BLOCKS                              NUMBER
    RELATIVE_FNO                             NUMBER

  • Do I need to Create Primary Key Class for Entity beans with Local interface

    Do I need to Create Primary Key Class for Entity beans with Local interface?
    I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
    I thought that the primary key class was required. My key is made up of only one field.
    Anyone know the answer.
    Jim

    u dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
    hope this helps :-)

  • What is the best practice for creating primary key on fact table?

    what is the best practice for primary key on fact table?
    1. Using composite key
    2. Create a surrogate key
    3. No primary key
    In document, i can only find "From a modeling standpoint, the primary key of the fact table is usually a composite key that is made up of all of its foreign keys."
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/logical.htm#i1006423
    I also found a relevant thread states that primary key on fact table is necessary.
    Primary Key on Fact Table.
    But, if no business requires the uniqueness of the records and there is no materilized view, do we still need primary key? is there any other bad affect if there is no primary key on fact table? and any benifits from not creating primary key?

    Well, natural combination of dimensions connected to the fact would be a natural primary key and it would be composite.
    Having an artificial PK might simplify things a bit.
    Having no PK leads to a major mess. Fact should represent a business transaction, or some general event. If you're loading data you want to be able to identify the records that are processed. Also without PK if you forget to make an unique key the access to this fact table will be slow. Plus, having no PK will mean that if you want to used different tools, like Data Modeller in Jbuilder or OWB insert / update functionality it won't function, since there's no PK. Defining a PK for every table is a good practice. Not defining PK is asking for a load of problems, from performance to functionality and data quality.
    Edited by: Cortanamo on 16.12.2010 07:12

  • How to Create primary key index with duplicate rows.

    Hi All,
    While rebuilding an index on a table , I am getting error that there are duplicate rows in a table.
    Searching out the reason led me to an interesting observation.
    Please follow.
    SELECT * FROM user_ind_columns WHERE table_name='SERVICE_STATUS';
    INDEX_NAME     TABLE_NAME     COLUMN_NAME     COLUMN_POSITION     COLUMN_LENGTH     CHAR_LENGTH     DESCEND
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO_RESETS     2     22     0      ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     STATUS_TYPE_ID     3     22     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     ACTIVE_DT     4     7     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO     1     22     0     ASC
    SELECT index_name,index_type,table_name,table_type,uniqueness, status,partitioned FROM user_indexes WHERE index_name='SERVICE_STATUS_PK';
    INDEX_NAME     INDEX_TYPE      TABLE_NAME     TABLE_TYPE     UNIQUENESS     STATUS     PARTITIONED
    SERVICE_STATUS_PK     NORMAL     SERVICE_STATUS     TABLE     UNIQUE     VALID     NO
    SELECT constraint_name ,constraint_type,table_name,status,DEFERRABLE,DEFERRED,validated,index_name
    FROM user_constraints WHERE constraint_name='SERVICE_STATUS_PK';
    CONSTRAINT_NAME     CONSTRAINT_TYPE     TABLE_NAME      STATUS     DEFERRABLE     DEFERRED     VALIDATED     INDEX_NAME
    SERVICE_STATUS_PK     P     SERVICE_STATUS     ENABLED     NOT DEFERRABLE     IMMEDIATE VALIDATED     SERVICE_STATUS_PK
    1. Using index scan:
    SELECT COUNT (*)
    FROM (SELECT subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    no rows returned
    Explain plan:
    Operation     OBJECT Name     ROWS     Bytes     Cost     OBJECT Node     IN/OUT     PStart     PStop
    SELECT STATEMENT Optimizer MODE=CHOOSE          519 K          14756                     
    FILTER                                        
    SORT GROUP BY NOSORT          519 K     7 M     14756                     
    INDEX FULL SCAN     ARBOR.SERVICE_STATUS_PK     10 M     158 M     49184                     
    2. Using Full scan:
    SELECT COUNT (*)
    FROM (SELECT /*+ full(s) */ subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status s
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    71054 rows returned.
    Explain Plan:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1           24123                     
    SORT AGGREGATE          1                               
    VIEW          519 K          24123                     
    FILTER                                        
    SORT GROUP BY          519 K     7 M     24123                     
    TABLE ACCESS FULL     ARBOR.SERVICE_STATUS     10 M     158 M     4234                     
    Index SERVICE_STATUS_PK is a unique and composite primary key VALID index. And the constraint is ENABLED and VALIDATED still having duplicate rows in table.
    How it is possible?
    Is it an Oracle soft Bug??
    Regards,
    Saket Bansal

    saket bansal wrote:
    Values are inserted as single rows inserts through an GUI interface.And you still claim to have over 71K duplicate records, without the GUI getting any kind of errors?
    That does not add up and can only be explained by a "bug".
    I tried inserting a duplicate record but failed.
    SQL> insert into service_status (select * from service_status where rownum <2);
    insert into service_status (select * from service_status where rownum <2)
    ERROR at line 1:
    ORA-00001: unique constraint (ARBOR.SERVICE_STATUS_PK) violatedAre you really sure there is no other way data in this table is populated/manipulated in bulk?

  • How to create a local partition index asign its storage tablespace

    hi
    i see the syntax about create local context index
    quote:
    Syntax for CONTEXT Indextype
    Use this indextype to create an index on a text column. You query this index with the CONTAINS operator in the WHERE clause of a SELECT statement. This index requires manual synchronization after DML.
    CREATE INDEX [schema.]index on [schema.]table(column) INDEXTYPE IS ctxsys.context [ONLINE]
    LOCAL [(PARTITION [partition] [PARAMETERS('paramstring')]
    [, PARTITION [partition] [PARAMETERS('paramstring')]])]
    [PARAMETERS(paramstring)] [PARALLEL n] [UNUSABLE];
    and i try the under code ,all failed.
    SQL&gt; create index html2_idx on HTML2(newsdescription) indextype is ctxsys.contex
    t local (partition indx parameters('lexer my_lexer'),partition indx01 tablespace
    users01 parameters('lexer my_lexer'),partition indx02 tablespace users02 param
    eters('lexer my_lexer'),partition indx03 tablespace users03 parameters('lexer m
    y_lexer') );
    ERROR:ORA-29850
    could anybody show some demo sql code creating partition context index asign its storage tablespace
    thanks

    try:
    create index html2_idx on HTML2(newsdescription) indextype is ctxsys.contex
    t local (
    partition indx parameters('lexer my_lexer'),
    partition indx01 parameters('storage users01_stg lexer my_lexer'),
    partition indx02 parameters('storage users02_stg lexer my_lexer'),
    Create storage preferences users01, users02, .. with I, K, ... attributes for tablespace users01, users02, ...
    Btw, ¿does anyone know whats the upper limit of partitions for a domain index? I've read in OTN they were 9999 but it crashes me (oracle 9.2.0.1) when I have 255... ¿has anyone tried this?

  • Creating Primary Key Index

    Hi,
    Iam trying to create a Primary Index on Large table and Iam using the Parallelism to make it fast. I have used the following script to create a Primary key Index.
    CREATE UNIQUE INDEX FLX_ARCH.FUND_SEC_RESULT_STAT_ARCH_PK
    ON FLX_ARCH.FUND_SEC_RESULT_STAT_ARCH
    (FUND_SEC_RESULT_MAP_INST,RATES_RULE_ID,BASE_LOCAL_FLAG,EFFECTIVE_DATE)
    TABLESPACE FLX_PERF_I
    parallel;
    Index created.
    Elapsed: 01:43:37.37
    Index got created in 1 hour 43 minutes. But when Iam adding constarint to those columns, it is taking almost 12hours with or without parallelism.
    ALTER TABLE FLX_ARCH.FUND_SEC_RESULT_STAT_ARCH
    ADD CONSTRAINT FUND_SEC_RESULT_STAT_ARCH_PK
    PRIMARY KEY
    (FUND_SEC_RESULT_MAP_INST,RATES_RULE_ID,BASE_LOCAL_FLAG,EFFECTIVE_DATE)
    parallel
    Would you please let me know what could be the problem and how can we add the Primary constraint fast.
    Your early response is much appreciated.
    Thanks and Regards
    Suresh. D

    Would you please let me know what could be the problem and You have presented no details that indicate any problem exists.
    how can we add the Primary constraint fast. Fast is relative.
    If I asked you to make my snail fast, could you do so?
    ALTER SESSION SET SQL_TRACE=TRUE;
    ALTER TABLE FLX_ARCH.FUND_SEC_RESULT_STAT_ARCH
    ADD CONSTRAINT FUND_SEC_RESULT_STAT_ARCH_PK
    PRIMARY KEY
    (FUND_SEC_RESULT_MAP_INST,RATES_RULE_ID,BASE_LOCAL_FLAG,EFFECTIVE_DATE)
    parallel
    ALTER SESSION SET SQL_TRACE=FALSE;
    now find the trace file within ./udump folder
    tkprof <trace_file.trc> trace_results.txt explain=<username>/<password>
    By inspecting the trace file you will be able to see where time is being spent.
    With this knowledge, you may or may not be able to determine the bottleneck & therefore improve it

  • Function based local partitioned Index

    Hi,
    Is function based index possible on partitioned column?
    E.g:
    CREATE TABLE MYTABLE
        MY_ID               NUMBER(10)   NOT NULL,
        MY_DATETIME         DATE         NOT NULL,
        MY_ACTIVITY_TYPE    VARCHAR2(1)  NOT NULL,
        MY_CREATE_DATETIME  DATE         NOT NULL,
        MY_BUSINESS_DATE    DATE         NOT NULL,
        MY_EXP_PROCESS_DATE DATE             NULL
    TABLESPACE TABLESPACE_D
    NOLOGGING
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE(INITIAL 128K
            NEXT 4M
            MINEXTENTS 1
            MAXEXTENTS UNLIMITED
            PCTINCREASE 0
            BUFFER_POOL DEFAULT)
    NOPARALLEL
    NOCACHE
    PARTITION BY RANGE(MY_DATETIME)
    (PARTITION MYTABLE_2006_JAN VALUES LESS THAN (TO_DATE('02-FEB-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_FEB VALUES LESS THAN (TO_DATE('02-MAR-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_MAR VALUES LESS THAN (TO_DATE('04-APR-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_APR VALUES LESS THAN (TO_DATE('02-MAY-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_MAY VALUES LESS THAN (TO_DATE('02-JUN-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_JUN VALUES LESS THAN (TO_DATE('04-JUL-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_JUL VALUES LESS THAN (TO_DATE('02-AUG-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_AUG VALUES LESS THAN (TO_DATE('04-SEP-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_SEP VALUES LESS THAN (TO_DATE('03-OCT-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_OCT VALUES LESS THAN (TO_DATE('02-NOV-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_NOV VALUES LESS THAN (TO_DATE('04-DEC-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_DEC VALUES LESS THAN (TO_DATE('02-JAN-2007','DD-MON-YYYY'))
    NOLOGGING
    CREATE INDEX IDX_MY_TABLLE_DATETIME
        ON MYTABLE(MY_DATETIME,TO_NUMBER(TO_CHAR(MY_DATETIME,'YYYYMM')))
    LOCAL
    PARTITION MYTABLE_2006_JAN,
    PARTITION MYTABLE_2006_FEB,
    PARTITION MYTABLE_2006_MAR,
    PARTITION MYTABLE_2006_APR,
    PARTITION MYTABLE_2006_MAY,
    PARTITION MYTABLE_2006_JUN,
    PARTITION MYTABLE_2006_JUL,
    PARTITION MYTABLE_2006_AUG,
    PARTITION MYTABLE_2006_SEP,
    PARTITION MYTABLE_2006_OCT,
    PARTITION MYTABLE_2006_NOV,
    PARTITION MYTABLE_2006_DEC
    ) PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    TABLESPACE TABLESPACE_I
    STORAGE(INITIAL 128K
            NEXT 4M
            MINEXTENTS 1
            MAXEXTENTS UNLIMITED
            PCTINCREASE 0
            BUFFER_POOL DEFAULT)
    NOLOGGING
    NOPARALLEL
    NOCOMPRESS
    /Oracle allows me to create the above index(I am using 10g) but in the USER_INDEXES data dictionary, for the above index the STATUS value is N/A. I could able to query also and the explain plan shows this index but my concern is will there be any other performance problem with this type of index?
    Regards,
    Mohana

    Hi,
    Is function based index possible on partitioned column?
    E.g:
    CREATE TABLE MYTABLE
        MY_ID               NUMBER(10)   NOT NULL,
        MY_DATETIME         DATE         NOT NULL,
        MY_ACTIVITY_TYPE    VARCHAR2(1)  NOT NULL,
        MY_CREATE_DATETIME  DATE         NOT NULL,
        MY_BUSINESS_DATE    DATE         NOT NULL,
        MY_EXP_PROCESS_DATE DATE             NULL
    TABLESPACE TABLESPACE_D
    NOLOGGING
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE(INITIAL 128K
            NEXT 4M
            MINEXTENTS 1
            MAXEXTENTS UNLIMITED
            PCTINCREASE 0
            BUFFER_POOL DEFAULT)
    NOPARALLEL
    NOCACHE
    PARTITION BY RANGE(MY_DATETIME)
    (PARTITION MYTABLE_2006_JAN VALUES LESS THAN (TO_DATE('02-FEB-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_FEB VALUES LESS THAN (TO_DATE('02-MAR-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_MAR VALUES LESS THAN (TO_DATE('04-APR-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_APR VALUES LESS THAN (TO_DATE('02-MAY-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_MAY VALUES LESS THAN (TO_DATE('02-JUN-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_JUN VALUES LESS THAN (TO_DATE('04-JUL-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_JUL VALUES LESS THAN (TO_DATE('02-AUG-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_AUG VALUES LESS THAN (TO_DATE('04-SEP-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_SEP VALUES LESS THAN (TO_DATE('03-OCT-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_OCT VALUES LESS THAN (TO_DATE('02-NOV-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_NOV VALUES LESS THAN (TO_DATE('04-DEC-2006','DD-MON-YYYY')),
    PARTITION MYTABLE_2006_DEC VALUES LESS THAN (TO_DATE('02-JAN-2007','DD-MON-YYYY'))
    NOLOGGING
    CREATE INDEX IDX_MY_TABLLE_DATETIME
        ON MYTABLE(MY_DATETIME,TO_NUMBER(TO_CHAR(MY_DATETIME,'YYYYMM')))
    LOCAL
    PARTITION MYTABLE_2006_JAN,
    PARTITION MYTABLE_2006_FEB,
    PARTITION MYTABLE_2006_MAR,
    PARTITION MYTABLE_2006_APR,
    PARTITION MYTABLE_2006_MAY,
    PARTITION MYTABLE_2006_JUN,
    PARTITION MYTABLE_2006_JUL,
    PARTITION MYTABLE_2006_AUG,
    PARTITION MYTABLE_2006_SEP,
    PARTITION MYTABLE_2006_OCT,
    PARTITION MYTABLE_2006_NOV,
    PARTITION MYTABLE_2006_DEC
    ) PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    TABLESPACE TABLESPACE_I
    STORAGE(INITIAL 128K
            NEXT 4M
            MINEXTENTS 1
            MAXEXTENTS UNLIMITED
            PCTINCREASE 0
            BUFFER_POOL DEFAULT)
    NOLOGGING
    NOPARALLEL
    NOCOMPRESS
    /Oracle allows me to create the above index(I am using 10g) but in the USER_INDEXES data dictionary, for the above index the STATUS value is N/A. I could able to query also and the explain plan shows this index but my concern is will there be any other performance problem with this type of index?
    Regards,
    Mohana

  • SQL Data Modeler 3.0 EA1 trying to create primary key on OT

    Hi,
    I'm trying to modify a primary key of an object table that was reversed (imported) from an Oracle 11.2.x RDBMS and am getting the error message "Incomplete Index definition". It is showing in the window "Index Columns Assignment". I get to the 'Primary Key Properties' window by pressing the 'Properties' button on the 'Table Properties' -> 'Primary Key'. If I try to edit the expression and then press the Ok or Apply buttons I get the error. With this be fixed in the production version? Will we be able to create a model in SQL Developer Data Modeler that generates a SQL statement similar to the following:
    ALTER TABLE x_flags
    ADD (CONSTRAINT x_flags_pk PRIMARY KEY (flags.id))
    Thanks,
    Scott K

    Hi Scott,
    I'm trying to modify a primary key of an object table that was reversed (imported) from an Oracle 11.2.x RDBMS and am getting the error message "Incomplete Index definition"... With this be fixed in the production version?yes
    Will we be able to create a model in SQL Developer Data Modeler that generates a SQL statement similar to the following:
    ALTER TABLE x_flags
    ADD (CONSTRAINT x_flags_pk PRIMARY KEY (flags.id))I assume "flags" is column of object type and "id" is attribute of that type. I logged bug for that, so there will be support however not for 3.0.
    Philip

  • How to create Primary key

    I want to insert HOSTID that has unique values in a new application in a primary key column in database.
    I am starting with h000000001
    and I want to go from that to h000000002
    and .... h0000000010 , 11, 12 etc etc.
    How do I do this?
    I did this:
    rs = stmt.executeQuery("select wlbmach_host_id from wlbmach order by wlbmach_host_id desc");
    // I am getting the greatest value eg: h000999999
    if (rs.next())
    getHostID = (String)rs.getString("wlbmach_host_id");
    //Get the h0009999999
    getStringNumber = getHostID.substring(1,10);
    //This gives me 9999999
    try
    {getNum = Integer.parseInt(getStringNumber);
    //change number to integer so I can add 1 to it
    getNum=getNum+1;
    getStringNumber=Integer.toString(getNum);//make that a string
    getHostID="h"+getNum;//add h to it
    }//try
    catch(Exception e)
    {System.out.println("NumberFormatException might have occured");%>
    else
         System.out.println("Assigning first HostID");
         getHostID = "h00000001";
    System.out.println("HostID is "+getHostID);
    But gives Exception:String index out of range: 10.. My column can take 10 varchar ??
    Can someone help .. Is this the right way to do it ?
    Is there a better way to generate primay keys?

    Why are you making life difficult??? Why not use the SEQUENCE object (if you are using Oracle)? You can retrieve next value by "Select sequencename.nextval from dual" as the query...you will get your number. Also, when two requests are made at the same time, Oracle takes care of this problem for you...you do not need to synchronize the method in JAVA. Do some research in this...I think you will like it.

  • Unable to create primary key

    Hi all.
    This one I can't handle. Do you guys know where I can find this constraint?
    SQL> desc marcos
    Name                                      Null?    Type
    COD                                                VARCHAR2(40)
    DSC                                                VARCHAR2(30)
    SQL> select * from marcos;
    COD                                      DSC
    1                                        adfasdfas
    2                                        asdfasfdas
    3                                        asfasklfjd
    1                                        safasjfasdf
    SQL> alter table marcos
      2  add (constraint pk_marcos primary key(cod))
      3  /
    alter table marcos
    ERROR at line 1:
    ORA-01408: such column list already indexed
    SQL> select * from user_cons_columns
      2  where upper(table_name) like '%MARCOS%'
      3  /
    no rows selectedTIA
    Marcos

    Even you don't have bitmap index on it the query will still fail, you had duplicate record in this column :)
    COD DSC
    1 adfasdfas
    2 asdfasfdas
    3 asfasklfjd
    1 << safasjfasdf

  • Create Primary key on View?

    Hi
    Can we create a Primary or Unique key on a simple view? while actual table doesn't have any primary or unique key
    Regards,
    Nasir.

    But what about this Example.
    CREATE VIEW emp_sal (emp_id, last_name,
    email UNIQUE RELY DISABLE NOVALIDATE,
    STRAINT id_pk PRIMARY KEY (emp_id) RELY DISABLE
    NOVALIDATE)
    AS SELECT employee_id, last_name, email FROM
    employees;This creates a view and tells Oracle that the optimizer is free to rely on email and emp_id being unique but that your code will enforce both constraints. Since you know that your data violates these constraints, that basically means that you're lying to the optimizer and allowing it to make incorrect assumptions about the data. That, in turn, permits the optimizer to either generate incorrect query plans or deliver you incorrect data should it happen to rely incorrectly on one of these constraints. Realistically, this sort of view would take an existing data quality issue and layer on a bunch of optimizer issues rather than addressing the root cause and fixing the data.
    Justin

  • Creating primary key dynamically ?

    hi
    I have say table t1 which has pk constraint say pk1 using say 4 columns c1,c2,c3,c4 in database1.
    I need to create same pk constraint with same parameters and name on same table t1 which is into another database.
    I need a generic function / proc to do this as the tables can change and so as number of columns used in the primary key constraint .
    How do I go about this ?

    I need a generic function / proc If I may say so, this is completely the wrong way to manage change in the database. What you really need is a configuration management procedure that checks change scripts into a source control repository and makes sure they get run against all the affected databases.
    Cheers, APC

Maybe you are looking for

  • Low resolution warning with 8Mpixel image?

    I've finished a new large size hardcover book, and some of the full page size (landscape) images with have 8 megapixel raw files as sources have low resolution warnings - some, but not all of them. Some of the photos have been edited in photoshop, an

  • Date range

    Hi, How do I group by to have a date range count and it will sum up the letter1 that is obtained from that one month.Currently i knwo how to run it daily but summarizing by one month of teh postcodes, i am not too sure. This is table counters. Date P

  • Permission denied in sap router

    Hello everybody, I have installed the SAPROUTER. when our remote user login by SAPSTRING 114.240.174.28 then user can login without any problem but when the user used the  /H/114.240.174.28/H/192.168.0.170/S/3299/H/ then they can not able to login, g

  • Identify Fields in Table

    Hi All,    i am trying to create new report, the specs have all    the fields, not actual fields but descriptions of the    fields.    how to identify the corresponding fields in the    table for the descriptions. the field descriptions on    the spe

  • Upload doesn't Work

    i´m Building an online Folio. Everythings just worked fine - But suddenly the Upload doesn´t work anymore - as adding an article - the builder doesn´t upload the files anymore :-(