Updating pk constraint name

Hi all
is thr any simple way to remane all primary key constraint names,
like if i have all pk constraints with name say in_abcd
and i want to update them all to pk_asdf,
how can we achieve this.
Thanks :)

[http://www.oracle-base.com/articles/9i/RenamingColumnsAndConstraints9i.php]
ALTER TABLE test RENAME CONSTRAINT test1_pk TO pk_test;

Similar Messages

  • How to restrict the generated constraint name with Model Driven Development

    Hello
    I have a database that has tables INSTRUMENT and EXCHANGE. There has to be a foreign key field called primaryExchange inside INSTRUMENT table that points to the ID of EXCHANGE table. In my fml file, my tables are called Instrument and Exchange. When I create this relation between the two tables in the model and deploy it to LCDS, it tries to create a FK constraint by the name of "FK_Instrument_primaryExchange_TO_Exchage" which fails with ORA-00972 -  Identifier is too long. Obviously the generated FK name is more than 30 chars and hence the oracle erorr. The only way to resolve this is to reduce the name of the table/field in the fml file while keeping the database table/field name intact. So the FK might be called FK_Instr_primExch_TO_Exch and which will work but the problem is that in the fml model file, I am loosing the meaningful names of the tables and thus the data services that are generated have truncated names. For this particular example, the truncated name might still be okay but in a large database, it is causing much grief. I would really prefer decent descriptive names for table like MarketOrder instead of MO. Pls advise how I can customize the generated constraint name while keeping the tables names still informative.
    Now I edit my DB tables to have a field called ID which is unique to that table but while deploying I get hibernate and fiber exceptions :-
    2011-03-10 16:30:44,042 INFO  [STDOUT] (http-0.0.0.0-8180-1) [UlltraWebServer]Exception trying to build hibernate's session factory: org.hibernate.MappingException: Repeated column in mapping for entity: UlltraWebServer.package4.Client column: ID (should be mapped with insert="false" update="false")
    2011-03-10 16:30:44,116 INFO  [STDOUT] (http-0.0.0.0-8180-1) [UlltraWebServer]Error instantiating application scoped instance of type 'fiber.data.assemblers.FiberAssembler' for destination 'UlltraWebServer.Holiday'.
    org.hibernate.MappingException: Repeated column in mapping for entity: UlltraWebServer.package4.Client column: ID (should be mapped with insert="false" update="false")
    2011-03-10 16:30:44,229 INFO  [STDOUT] (http-0.0.0.0-8180-1) [UlltraWebServer]Exception trying to build hibernate's session factory: org.hibernate.MappingException: Repeated column in mapping for entity: UlltraWebServer.package4.Client column: ID (should be mapped with insert="false" update="false")
    The above suggests that it does not like the same name for the fields in multiple tables, they all have to be unique like Holiday.holidayID, Client.clientID etc which causes the above constraint length violation issue..
    thanks

    You should be able to achieve what you want with an explicit criteria filter on your entity.
    In the Modeler Design view, select your entity and add a filter. You'll see that there is a an "Order By" field in the Properties view.
    Enter the value you want there and then save and redeploy your model. When you don't enter anything in the "Criteria" field, you create a getAll fill.
    Here's an example of an entity created with this type of filter; it is sorted by price in ascending order:
    <entity name="Product" persistent="true">
      <annotation name="ServerProperties" ServerType="LCDS"/>
      <annotation name="DMS" Table="PRODUCT"/>
      <annotation name="RDS" introspectedColumns="PRODUCTID,DESCRIPTION,PRICE,PRODUCTNAME"/>
      <annotation name="VisualModeler" width="115" height="110" x="364" y="203"/>
      <id name="productid" type="integer">
      <annotation name="DMS" ColumnName="PRODUCTID"/>
      </id>
      <property name="description" type="string" length="255">
      <annotation name="DMS" ColumnName="DESCRIPTION"/>
      </property>
      <property name="price" type="float">
      <annotation name="DMS" ColumnName="PRICE"/>
      </property>
      <property name="productname" type="string" length="255">
      <annotation name="DMS" ColumnName="PRODUCTNAME"/>
      </property>
      <filter name="MyFill" order="price ASC"/>
      </entity>

  • How to modify a column name & How to modify a constraint name

    How to modify a column name?
    How to modify a primary key constraint name if the pk has been referenced by another foreign key?
    Thanks.

    Hi,
    What version of oracle are you using? If it is 9i,
    then you can the command
    alter table <table_name> rename column <column_name> to <new_column>;
    if it is 8i or earlier, you can create a view with the required names.
    hth
    Always post the oracle version and the platform you are using to get better response.

  • Update step limit name at run-time

    I need to run through some test steps in a TestStand sequence multiple times.  This wouldn't be a loop on a single step or group of steps but probably a goto a label "for" loop in TestStand.  BTW, TestStand 2.0.1 calling code from a LabWindows/CVI DLL via the standard prototype adapter.  Each iteration I need to have the test step limit names be updated with a different suffix.  So step1 might have results0 and results1 and on the 2nd run results0 would be renamed to results0b.  How do I update the limit names, at run-time, from a LabWindows/CVI function?  I.e. the first test in the sequence's Main would update the steps below it to update the suffix.  I started down the path of using TS_SeqContextGetProperty to get the sequence handle
    TS_SeqContextGetProperty( testData->seqContextCVI, &errorInfo, TS_SeqContextSequence, CAVT_OBJHANDLE, &seq_hndl );
    then using TS_SequenceGetNumSteps( seq_hndl, &errorInfo, TS_StepGroup_Main, &num_steps ) to determine the number of steps in the Main tab.  
    Enter a for loop:
    TS_PropertyGetValString( testData->seqContextCVI, &errorInfo, buf, TS_PropOption_NoOptions, ( char ** )&rslt_name ) with buf as "Sequence.Main[0].Result.Measurement[0]" errors out with an invalid name message.  The idea is to get this value, update it based on the iteration in TestStand ( this is already acquired and working ), and then set the value back.  Then, move on to the next step and so forth.
    Any suggestions?
    Thanks.
    -G-
    Solved!
    Go to Solution.

    So, I tried the example and it works but only for a single step.  I've tried two options:  1. having a single step that programmatically changes all the result names in all the other steps in the sequence. 2. having each step update the result names itself.  For thought 1 the loop would run and the changes would occur but when the function was exited I'd get an exception from TestStand.  No real information in the details as it looked like a memory corruption error.  I then examined the details of what occurred and tried more experiments.  If I had the loop have more than 1 iteration this behavior occurred.  If I comment out the set function it still occurs.  Then, for thought 2, it works like a champ on all the steps until I loop back to the top of the sequence.  Then, on the first step ( 2nd time through ) it bombs out.
    Attached is the code for the 2nd possible solution.
    Does anyone know what the problem is or if there's a way to do this?
    -G-
    Attachments:
    Change Step Name.txt ‏7 KB

  • Find column name from constraint name

    How to fetch the column name from a constraint name to which the constraint is applied?.
    I only know the name of the constraint and can get the table name from "dba_constraints". How can I know to which column in the table this constraint is applied.
    Thanks

    What about this?
    satyaki>
    satyaki>
    satyaki>desc user_cons_columns;
    Name                                      Null?    Type
    OWNER                                     NOT NULL VARCHAR2(30)
    CONSTRAINT_NAME                           NOT NULL VARCHAR2(30)
    TABLE_NAME                                NOT NULL VARCHAR2(30)
    COLUMN_NAME                                        VARCHAR2(4000)
    POSITION                                           NUMBER
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Check Constraint names aren't synced when engineering to logical

    Just learned about this tool at OOW and ran into an issue involving check constraint names being compared but not synced when engineering from the relational model to the logical model. When I set the constraint names in the logical model (and perform one last "Engineer to Logical Model") after that the compare dialog shows the table and entities match. Is this a bug?
    Steps to reproduce:
    1. importing a relational data model from data dictionary which contains a table with a column level check constraint
    2. perform "Engineer to Logical model" to produce the logical model
    Issue:
    Perform another "Engineer to Logical model" which will show the table with the column level check constraint as being out of sync with the logical model's equivalent entity, when you drill down into the diff in the compare dialog box you see the check constraint name has a value in the relational model and the name is null in the logical model
    Verify:
    Looking in logical model at the constraint (<Entity>/Attributes/Attribute Properties/Default and Constraint/Constraint Name) the value is empty
    Work Around:
    Set the constraint name in the spot from verify above and perform "Engineer to Logical model" twice. The first time it will show the same issue, the second time it will show the table and entity match

    Hi Bo,
    thanks for feedback. It's fixed now and you'll get the fix in version 3.0.
    Another( probably better workaround) - in engineering dialog - "Compare/Copy options" tab - uncheck "Don't use for new objects" option.
    Philip

  • Getting the constraint name with sql%bulk_exceptions

    Hello folks,
    Is there any way to get the constraint name that was violated using sql%bulk_exceptions.
    I've a parent table and it's two children tables. When I try to delete from parent using forall, save exceptions, I want to know what constraint violated at what iteration of a bulk operation.
    I've following script.
    set serveroutput on
    drop table chld;
    drop table chld2;
    drop table prnt;
    create table prnt(n number primary key);
    insert into prnt select level from dual connect by level<11;
    create table chld(cn number references prnt(n));
    insert into chld select level from dual connect by level<3;
    create table chld2(cn number references prnt(n));
    insert into chld2 select level*3 from dual connect by level<3;
    select * from prnt;
    select * from chld;
    select * from chld2;
    commit;
    declare
      type t_prnt_obj is table of prnt.n%type index by pls_integer;
      t_prnt_tab t_prnt_obj;
      l_exp_cnt integer;
    begin
      select n bulk collect into t_prnt_tab from prnt order by n;
      dbms_output.put_line('t_prnt_tab.count -- '||t_prnt_tab.count);
      forall i in t_prnt_tab.first .. t_prnt_tab.last save exceptions
        delete prnt where n = t_prnt_tab(i);
    exception
      when others
      then
        l_exp_cnt := sql%bulk_exceptions.count;
        dbms_output.put_line('Total exceptions:'|| l_exp_cnt);
        for k in 1 .. l_exp_cnt
        loop
          dbms_output.put_line('Error '||k|| ' - Collection Index: '||sql%bulk_exceptions(k).error_index||' - Error Code: '|| sql%bulk_exceptions(k).error_code||' - Message: '||SQLERRM(- sql%bulk_exceptions(k).error_code) );
        end loop;
    end;I get the output as below:
    t_prnt_tab.count -- 10
    Total exceptions:4
    Error 1 - Collection Index: 1 - Error Code: 2292 - Message: ORA-02292: integrity constraint (.) violated - child record found
    Error 2 - Collection Index: 2 - Error Code: 2292 - Message: ORA-02292: integrity constraint (.) violated - child record found
    Error 3 - Collection Index: 3 - Error Code: 2292 - Message: ORA-02292: integrity constraint (.) violated - child record found
    Error 4 - Collection Index: 6 - Error Code: 2292 - Message: ORA-02292: integrity constraint (.) violated - child record foundInstead, I want to get in output with the constraint_name added. Like below:
    t_prnt_tab.count -- 10
    Total exceptions:4
    Error 1 - Collection Index: 1 - Error Code: 2292 - Message: ORA-02292: integrity constraint (GK.CP_FK) violated - child record found
    Error 1 - Collection Index: 1 - Error Code: 2292 - Message: ORA-02292: integrity constraint (GK.CP_FK) violated - child record found
    Error 1 - Collection Index: 1 - Error Code: 2292 - Message: ORA-02292: integrity constraint (GK.C2P_FK) violated - child record found
    Error 1 - Collection Index: 1 - Error Code: 2292 - Message: ORA-02292: integrity constraint (GK.C2P_FK) violated - child record foundIs it possible, if so how do I get it?
    Thanks in advance for you help.
    Girish

    This is phenomenal, Manik. It surely eased the work am doing at the moment.
    Thanks to you and many more to, Tom!
    Cheers!
    Girish

  • Updating properties by name

    I have a need to update the property of a class given its
    name.
    I have found that if I used the notation :
    obj["name"] = "hello world!"
    that this does not update the property 'name' of sealed class
    instance 'obj'.
    To be more explicit, suppose I have the following class
    definition:
    public class Foo
    private var _name : String = "";
    public function get name() : String
    return _name;
    public function set name(name : String) : void
    if (name == null) // protect from setting it as null, for
    some reason...
    name = "";
    _name = name;
    and then I have some code that knows that an object it has a
    reference to has a property called 'name', but that this is generic
    code and the object reference it has is not explicit. So, I was
    hoping to be able to do this:
    public function setProperty(instance : Object, propertyName :
    String, propertyValue : Object) : void
    instance[propertyName] = propertyValue;
    However, this doesn't work, as it tries to create a new
    dynamic property and can't.
    Is there another way to set the property value, similar to
    the way you can set a property on a JavaBean?
    Thanks!
    Rhys
    PS Apologies for the code not being formatted properly. I
    can't find the 'attach code' feature that I keep reading
    about.

    This was idiocy on my part.
    The example does work!

  • Run time update on Button name and Action of Button

    I want to change the button name and button path in the GUI directly. So user can update GUI as per their requirement.
    Now I have built a GUI with multiple buttons. Whenever the button clicked corresponding webpage will be opened. This Button name and webpage link can not be changed as per current GUI design.
    But I want to allow anybody to update the Button name and webpage link as per their need.
    Please suggest , how can I achieve it? Please share if you have some code snippet.

    Changing the text on a Swing JButton is pretty simple. That isn't an appropriate question for this forum, however. This forum is for questions concerning using or extending WindowBuilder. General Swing questions should be posted to a general Swing/Java forum.

  • Constraint names hardcoded !!!

    we generated entity and view objects based on a table and tested the application module which was working fine. now we have created a new user by firing the scripts again. as a result, validations on the entity object (eg. not null etc) have started failing. on examining, we found that the system generated constraint names like SYSC000101 for not null columns, have been hardcoded in the XML file and these differ now in the newly generated scheme. what is the solution to this.
    what will happen when we go to the client site and fire our scripts there??? will all my entity objects stop working???

    I have a master and a child table that are linked by a foreign key (name is CITY_STATE_FK). this was working fine in the original schema. but in the new schema, when i try to insert a new city(child), it gives the error "failed to find or invalidate owning entity". In the default association that jdeveloper has made, if i uncheck the Composition check box in the properties of the association, insert is allowed. But why is it forcing me to remove Composition. In this case i have my user defined FK name that is same in the 2 schemas.

  • Problem with constraint names

    Hi to all, I have a problem with the constraint names. I need to delete the table name that is used like prefix in the constraint name.
    Example:
    - Actual : DBO_MYDATABASE_FK_Ho_Ka
    - Desired : FK_Ho_Ka
    The constraint names are FK_Ho_Ka in the creation database script, but if I import the database schema, I have DBO_MYDATABASE_FK_Ho_Ka, but I only need the constraint name.
    Thanks so much :)

    Thanks for your time :)
    I did a migration from Microsoft SQL Server 2005 to Oracle 11g database. Then, I need to use the same Entity Framework model to use with Sql Server and Oracle. Then, I need that the constraint names must be the same in the two databases.
    I did the migration with Oracle Sql Developer and all works fine. The resulted migration script has the constraint name like FK_UJ_UK (that it's OK) but when I import the database schema or do the Entity Framework model, I have this constraint name DBO_MYDATABASE_FK_UJ_UK.
    Edited by: Bluegene on Dec 11, 2008 9:35 AM

  • VAT GL or withhold tax GL text (SGTXT) will be update by Vendor name automatically during posting data

    Hi,
    When i will execute T.code FB60 for vendor AP generate purpose then VAT GL or Withhold tax GL text (SGTXT) will be update by Vendor name automatically. Anybody there , who can help me? 
    Best Regards,
    Tariq Russel.

    Hi Tariq
    We had the same requirement and we achieved through Substitution at Complete Doc level using User Exit
    You can also achieve through BTE 1120
    Br. Ajay M

  • Constraint names - Modeling Naming Options

    Can anyone advise me which group(under Model Options -> Naming Conventions) controls the max code length for the below in a physical data model.
    FK Constraints
    PK Constraints
    UK Constraints
    The context sensitive help from this window does not describe what physical objects some of these impact. For instance, I thought Reference would control FK Constraints, but it is not. I have FK Constraints being generated longer than 30 characters, which is the max that Oracle allows. Other objects is a catch all that I did not restrict to 30 as that then shortens lot of other things that I don't even know and might want to.
    I tried looking in the PD Meta model help under "Libraries -> PdPDM -> Model Options", but I don't understand much of what is described there.
    I have following in the Oracle 11g DBMS Resource file under the branch "ORA11GR1::Script\Objects\Reference\ConstName".
    I need this so that I have FK constraints generated with a sequence number suffix. Maybe the Model naming options don't apply when this is used and I need to figure out the syntax to chop the table name so that to 24 as FK_ and _1 will use up 6 characters in the constraint name.
    FK_%TABLE%_%REFRNO%

    Hi Stefan,
    It is still ending up generating Unique key constraint names longer than 30 characters.
    I do have a rule for constraint name creation as well.
    So right now in my Oracle 11 Resource file, I have this.
    ORA11GR1::Script\Objects\Key\ConstName    is set to UK_%TABLE%_%.U-18.1:AKEY%
    I am wondering if I should change it to UK_%U.25:TABLE%_%.U-18.1:AKEY%   so that it takes only 25 characters from table name and that is restricted to 30 characters max.
    I also have MaxConstLen at two levels and both are set to 30
    ORA11GR1::Script\Objects
    ORA11GR1::Script\Objects\Key
    It is getting really frustrating that I cannot get same results as I did with Erwin DDL generation. I wish SAP made it easy and had a setting for Constraint names in Model Naming options.

  • UPDATE STANDBY SITE NAME with DATAGUARD BROKE "DGMGRL"

    I've a llitlle PB with my Dataguard
    After shutdown both sites to increase SGA size in Primary site and update in secondary site too
    I start the Primary site without Pb.
    But the Secondary site don't want to start.
    When I do a startup it fails.i check in Dataguard and i found
    The Pb is the secondary site name is not ('DMWEBDG_srvsdmwebp02')
    bu only "DMWEBDG"
    And I can't find any way to update the site name in Dataguarg.
    the Alter command doesn't explain very well.
    Soes anyone knows how to do it?
    Thxs
    DGMGRL> show site verbose 'DMWEBDG_srvsdmwebp02'
    Site
    Name: 'DMWEBDG_srvsdmwebp02'
    Hostname: 'srvsdmwebp02'
    Instance name: 'DMWEBDG'
    Service Name: '(DESCRIPTION=(ADDRESS_LIST = (ADDRESS=(PROTOCOL=tcp)(HOST=srvsdmwebp02.int.imd.ch)(PORT=1525)))(CONNECT_DATA=(SID=DMWEBDG)(SERVER=DEDICATED)))'
    Standby Type: 'physical'
    Number Built-in Processes: '2'
    Number Generic Processes: '0'
    Enabled: 'yes'
    Required: 'yes'
    Default state: 'STANDBY'
    Intended state: 'STANDBY'
    PFILE: ''
    Number of resources: 1
    Resources:
    Name: DMWEBDG_srvsdmwebp02 (default) (verbose name='DMWEBDG_srvsdmwebp02')
    Current status for "DMWEBDG_srvsdmwebp02":
    Warning: ORA-01034: ORACLE not available

    Thxs
    The PB was Solved.

  • SQL*Modeler forgets check constraint names

    SQL*Modeler Version 2.0.0. Build 584
    If I create named check constraints under the Relational Model/Tables/Table level Constraints then generate the model I have the constraints correctly named. Exit the model and reload, the constraints appear to be correct but when I look at the physical model under tables/table check constraints I see generated names such as TCC4, TCC5 etc.
    At this point I can change the name but this is not stored it is just thown away.
    If I go back to Relational Model/Tables/Table level Constraints and simply Apply no changes then the constraint names appear correctly in the generated model. However, I have many tables and this is not a practial solution each time I generate the model.

    Hi Ian,
    thanks for feedback. Fix will be available in next release.
    Philip

Maybe you are looking for

  • Problem with pages name in dashboard  Oracle BIEE 11g

    Hello. I use Oracle BIEE 11.1.1.3.0 I have dashboard 'CBR_CTLOG'. Dashboard has two pages 'Протокол контроля' and 'Протокол контроля детализированный'. Both pages have dashboards prompt with active "Apply to all prompt pages" When I go from 'Протокол

  • Mac Mini rez is messed up after update....

    I have last gen C2D Mac Mini hooked to my 37" 720 LG TV through the DVI > HDMI. I only use the Mini for music and movies though NetFlix etc. Last night I did updates to OSX etc and after reboot my rez is all messed up. Apple toolbar just slightly off

  • FW CS4 and Kuler keyboard bug

    OK, so I really hope that this is just my machine acting up, but I have been able to reproduce this bug, and I just want someone else to confirm it for me. I have a 16 page FW CS4 PNG, each page has a single bitmap on it, and when I open the Kuler pa

  • Read Type-pools into internal table

    Hi all, I want the type-pools content to be put into the internal table and find the Lines of Code in it. Can anybody suggest how it is possible? Regards, K.Tharani.

  • PO Auto creation through Requisition Workflow

    Hi, I am creating a Non-Catalog Request type of requistion in iProcurement. When I submit the requisition for approval and if the requisition is approved the PO is not getting created. Some of the metalink notes said a Contract PO needs to be created