8 Replies Latest reply: Jun 26, 2013 9:28 AM by BluShadow RSS

    Error while alter the table

    1011786

      Hi

       

      Please let me know reasons for this below error

       

      Error starting at line 32 in command:

      ALTER

      TABLE DEVELOPMENT.BRANDING_STRINGS

      ADD

      CONSTRAINT frk_strings_brandingsdetails

      FOREIGN KEY (CUSTOMIZATION_ID)

      REFERENCES BRANDING_DETAILS (CUSTOMIZATION_ID)

      Error report:

      SQL Error: ORA-02270: no matching unique or primary key for this column-list

      02270. 00000 -  "no matching unique or primary key for this column-list"

      *Cause:    A REFERENCES clause in a CREATE/ALTER TABLE statement

                 gives a column-list for which there is no matching unique or primary

                 key constraint in the referenced table.

      *Action:   Find the correct column names using the ALL_CONS_COLUMNS

                 catalog view

        • 1. Re: Error while alter the table
          Raunaq

          According to the above error ,

           

          It seems the column CUSTOMIZATION_ID does not exist in table BRANDING_DETAILS.


           

          Message was edited by: BluShadow Begging for points removed by moderator.

          • 2. Re: Error while alter the table
            S10390

            The column CUSTOMIZATION_ID  in the table BRANDING_DETAILS may not the be Primary Key. Check if this is the primary key or not.

            • 3. Re: Error while alter the table
              1011786


              Hi  S10390,

               

              Yes its a composite primary key

              • 4. Re: Error while alter the table
                Purvesh K

                Raunaq wrote:

                 

                Please mark the answer helpful/correct if it helps you

                Please consider reading the Forum FAQ. Posting the extract of it for your benefit.

                "

                7) Begging for points

                Posting an answer and finishing the post by saying something like "If my answer useful, mark it as correct or helpful" is not acceptable.  This is considered begging for points and the site admin have indicated that this is not acceptable.  The points system on the forums, as agreed by most of the regulars on here, is not an ideal system.  The last thing it needs is people begging to gain points for themselves so that they can boost their ego by trying to reach "Guru" status to impress their friends.  The purpose of these professional forums is to help others, have our own questions answered and to learn new things for ourselves.  Most of the experts and gurus on these forums have gained points and their status through simply answering questions well without asking for them.  Sometimes points are awarded, sometimes not, and that is up to the original poster as to whether they follow the forum etiquette.  Anyone spotted asking for points in any form is liable to have such comments edited out of their post or the post deleted (if deletion isn't removing an actual answer).  *You have been warned!*

                "

                • 5. Re: Error while alter the table
                  S10390

                  In that case, you can not alter it.

                   

                  Check this similar post Foreign key referencing only part of composite primary key

                  • 6. Re: Error while alter the table
                    Purvesh K

                    So, you need to have a Composite foreign Key then.

                     

                    See below:

                     

                    create table test_table(
                      col1 number,
                      col2 number,
                      col3 varchar2(10),
                      constraint pk_test_table primary key (col1, col2)
                    );
                    create table test_table_2(
                    pk_col number primary key,
                    fk_col1 number not null,
                    fk_col2 number not null,
                    constraint fk_test_table_2 foreign key (fk_col1, fk_col2) references test_table(col1, col2)
                    );
                    
                    • 7. Re: Error while alter the table
                      Raunaq

                      The last thing it needs is people begging to gain points for themselves so that they can boost their ego by trying to reach "Guru" status to impress their friends



                      What are you ?

                      How can you make out that i am doing this to impress my friends?


                      What you could have simply done is that you should have told me that don't ask for point ? You can use better and decent english.


                      And how can you image anybody is interested in your long lectures ?? Still


                      • 8. Re: Error while alter the table
                        BluShadow

                        Raunaq wrote:

                         

                        The last thing it needs is people begging to gain points for themselves so that they can boost their ego by trying to reach "Guru" status to impress their friends



                        What are you ?

                        How can you make out that i am doing this to impress my friends?


                        What you could have simply done is that you should have told me that don't ask for point ? You can use better and decent english.


                        And how can you image anybody is interested in your long lectures ?? Still


                         

                        Purvesh was quoting from the forum FAQ: Re: 13. How do I answer a question on the forums?

                         

                        It is not acceptable to ask for points for your answers.  The site admiinistrators have expressed that this is not acceptable behaviour.  Such posts can be deleted or edited and continued breach of this could result in termination of your account.

                         

                        As such, your post is now going to be edited to remove your begging for points.