missing right parenthesis

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sincerogue
    New Member
    • Aug 2007
    • 5

    missing right parenthesis

    hi all, im new to oracle and ive created some tables but one of them come out an error at line 8

    CREATE TABLE LOAN(
    ISBN VARCHAR2(20) NOT NULL,
    BranchID NUMBER(2) NOT NULL,
    CardNo NUMBER(3) NOT NULL,
    DateOut DATE,
    DateIn DATE,
    PRIMARY KEY (ISBN, BranchID, CardNo, DateOut),
    FOREING KEY (ISBN) REFERENCES BOOK (ISBN),
    FOREING KEY (CardNo) REFERENCES BORROWER (CardNo),
    FOREIGN KEY (BranchID) REFERENCES BRANCH (BranchID);

    please help cheers
  • gintsp
    New Member
    • Aug 2007
    • 36

    #2
    Originally posted by sincerogue
    hi all, im new to oracle and ive created some tables but one of them come out an error at line 8

    CREATE TABLE LOAN(
    ISBN VARCHAR2(20) NOT NULL,
    BranchID NUMBER(2) NOT NULL,
    CardNo NUMBER(3) NOT NULL,
    DateOut DATE,
    DateIn DATE,
    PRIMARY KEY (ISBN, BranchID, CardNo, DateOut),
    FOREING KEY (ISBN) REFERENCES BOOK (ISBN),
    FOREING KEY (CardNo) REFERENCES BORROWER (CardNo),
    FOREIGN KEY (BranchID) REFERENCES BRANCH (BranchID);

    please help cheers
    Count open "(" and closing ")" parenthesis and you'll find that the count is not equal.
    You miss final clsing ")"

    Gints Plivna

    Comment

    • sincerogue
      New Member
      • Aug 2007
      • 5

      #3
      Originally posted by gintsp
      Count open "(" and closing ")" parenthesis and you'll find that the count is not equal.
      You miss final clsing ")"

      Gints Plivna

      Hi, Gints,

      sorry but i dun still get what u mean by the count is not equal sorry for my ignorance.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        You need to add the closing right parenthesis

        try the following code

        [CODE=oracle]CREATE TABLE LOAN(
        ISBN VARCHAR2(20) NOT NULL,
        BranchID NUMBER(2) NOT NULL,
        CardNo NUMBER(3) NOT NULL,
        DateOut DATE,
        DateIn DATE,
        PRIMARY KEY (ISBN, BranchID, CardNo, DateOut),
        FOREING KEY (ISBN) REFERENCES BOOK (ISBN),
        FOREING KEY (CardNo) REFERENCES BORROWER (CardNo),
        FOREIGN KEY (BranchID) REFERENCES BRANCH (BranchID)
        );[/CODE]

        Comment

        • sincerogue
          New Member
          • Aug 2007
          • 5

          #5
          now it says the view does not exist

          thanks

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            does the other three tables referenced in your code (BOOK,BORROWER, BRANCH) exists in your schema. ???

            Comment

            • sincerogue
              New Member
              • Aug 2007
              • 5

              #7
              hi,

              CREATE TABLE BORROWER(
              CardNo VARCHAR2(3) NOT NULL,
              LName VARCHAR2(35) NOT NULL,
              Fname VARCHAR2(30) NOT NULL,
              Suburb VARCHAR2(20) NOT NULL,
              Postcode VARCHAR2(4) NOT NULL,
              PRIMARY KEY (CardNo));


              CREATE TABLE BRANCH(
              BranchID VARCHAR2(2) NOT NULL,
              BranchName VARCHAR2(15) NOT NULL,
              PRIMARY KEY (BranchID));


              CREATE TABLE BOOK(
              ISBN VARCHAR2(25) NOT NULL,
              Title VARCHAR2(100) NOT NULL,
              YearPublished VARCHAR2(15) NOT NULL,
              PublisherName VARCHAR2(35) NOT NULL,
              PRIMARY KEY (ISBN));

              CREATE TABLE LOAN(
              ISBN VARCHAR2(25) NOT NULL,
              BranchID VARCHAR2(2) NOT NULL,
              CardNo VARCHAR2(3) NOT NULL,
              DateOut DATE,
              DateIn DATE,
              PRIMARY KEY (ISBN, BranchID, CardNo, DateOut),
              FOREIGN KEY (ISBN) REFERENCES BOOK (ISBN),
              FOREIGN KEY(CardNo) REFERENCES BORROWER(CardNo ),
              FOREIGN KEY (BranchID) REFERENCES BRANCH (BranchID)
              );

              this is the whole schema others i got no problem with but just line 8 in Table LOAN

              cheers

              Comment

              • kannan1983
                New Member
                • Aug 2007
                • 10

                #8
                Originally posted by sincerogue
                hi,

                CREATE TABLE BORROWER(
                CardNo VARCHAR2(3) NOT NULL,
                LName VARCHAR2(35) NOT NULL,
                Fname VARCHAR2(30) NOT NULL,
                Suburb VARCHAR2(20) NOT NULL,
                Postcode VARCHAR2(4) NOT NULL,
                PRIMARY KEY (CardNo));


                CREATE TABLE BRANCH(
                BranchID VARCHAR2(2) NOT NULL,
                BranchName VARCHAR2(15) NOT NULL,
                PRIMARY KEY (BranchID));


                CREATE TABLE BOOK(
                ISBN VARCHAR2(25) NOT NULL,
                Title VARCHAR2(100) NOT NULL,
                YearPublished VARCHAR2(15) NOT NULL,
                PublisherName VARCHAR2(35) NOT NULL,
                PRIMARY KEY (ISBN));

                CREATE TABLE LOAN(
                ISBN VARCHAR2(25) NOT NULL,
                BranchID VARCHAR2(2) NOT NULL,
                CardNo VARCHAR2(3) NOT NULL,
                DateOut DATE,
                DateIn DATE,
                PRIMARY KEY (ISBN, BranchID, CardNo, DateOut),
                FOREIGN KEY (ISBN) REFERENCES BOOK (ISBN),
                FOREIGN KEY(CardNo) REFERENCES BORROWER(CardNo ),
                FOREIGN KEY (BranchID) REFERENCES BRANCH (BranchID)
                );

                this is the whole schema others i got no problem with but just line 8 in Table LOAN

                cheers
                when i executed the above DDL All the tables are created successfully , i think the code is fine

                Comment

                • sincerogue
                  New Member
                  • Aug 2007
                  • 5

                  #9
                  thanks for all ur all ur helps really apreciates it.... cheers

                  Comment

                  Working...