sql - Foreign Key creation in Oracle -


This question is already an answer here

  • 1 answer

    Tried to create and primary key

    My code is correct Table1

      Create table (P_Id not the original primary key, LastName varchar ( 255) No NULL, FirstName Varkar (255), Address Worker (255), City Worker (255));   

    Table 2 :

      create table order (O_Id integer no NULL primary key, OrderNo integer (10), integer foreign P_Id principal reference person (P_ID));   

    Error: -ORA-00907: missing right bracket

    Do not know what the error is.

    foreign key keyword:
      table Create an order (O_Id not the original primary key, not the order int (10), P_Id int reference persons (P_Id));   

    Btw: When you also use an inline definition, the column name list is not needed P_Id integer reference people will suffice .

    This will hamper the name of a system (such as SYS_C0066866 ), then it is generally better to use a format where you can specify the name of the obstacle:

    prefixing the order of the order (O_Id integer no NULL primary key, OrderNo integer (10), P_Id integer, foreign key (p_id fk_orders_person constraint) persons (P_Id) reference;

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -