SQL - Missing right parenthesis

前端 未结 4 625
耶瑟儿~
耶瑟儿~ 2021-01-06 00:39

I am trying to execute this script in Oracle 11g and getting the following error, I dont know where I am missing the paranthesis or what is the mistake kindly help me figure

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-06 01:34

    I think you need to define the columns first and then add the FOREIGN KEY constraint in the very same manner as you are adding PRIMARY KEY constraint as below:

        CREATE TABLE User_Role ( 
           user_role_id INT  NOT NULL  , 
           Users_user_id INT, 
           User_Types_user_type VARCHAR(20),
           FOREIGN KEY (Users_user_id) REFERENCES Users(user_id),
           FOREIGN KEY (User_Types_user_type) REFERENCES User_Types(user_type), 
           PRIMARY KEY(user_role_id) 
         )
    

提交回复
热议问题