Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7729631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:00:54+00:00 2026-06-01T06:00:54+00:00

I want to create this table in Oracle. This is only the table SQL

  • 0

I want to create this table in Oracle. This is only the table SQL script.

     -- CREATE TABLES SECTION -------------------------------------------------

-- TABLE DATACENTER

CREATE TABLE DATACENTER(
  DATACENTERID INTEGER NOT NULL,
  NAME VARCHAR2(80 ) NOT NULL,
  LOCATION VARCHAR2(200 ),
  DCALLOWEDWEIGHTKG NUMBER(9,0),
  DCMAXIMUMWEIGHTKG NUMBER(9,0),
  DCALLOWEDPOWERWATT NUMBER(9,0),
  DCMAXPOWERWATT NUMBER(9,0),
  DCALLOWCOOLINGPOWERBTU NUMBER(9,0),
  DCMAXCOOLINGPOWERBTU NUMBER(9,0),
  DESCRIPTION CLOB
)
/
-- ADD KEYS FOR TABLE DATACENTER

ALTER TABLE DATACENTER ADD CONSTRAINT DATACENTERID PRIMARY KEY (DATACENTERID)
/

-- TABLE COMPONENT

CREATE TABLE COMPONENT(
  COMPONENTID INTEGER NOT NULL,
  DATACENTERID INTEGER,
  FKCOMPONENTID INTEGER,
  COMPONENTSTATSID INTEGER NOT NULL
)
/

-- ADD KEYS FOR TABLE COMPONENT

ALTER TABLE COMPONENT ADD CONSTRAINT COMPONENTID PRIMARY KEY (COMPONENTID)
/
-- CREATE RELATIONSHIPS SECTION ------------------------------------------------- 

ALTER TABLE COMPONENT ADD CONSTRAINT IS PART OF A FOREIGN KEY (DATACENTERID) REFERENCES DATACENTER (DATACENTERID)
/

ALTER TABLE COMPONENT ADD CONSTRAINT IS A SUBPART OF FOREIGN KEY (FKCOMPONENTID) REFERENCES COMPONENT (COMPONENTID)
/

The error stack:

table DATACENTER created.
table DATACENTER altered.
table COMPONENT created.
table COMPONENT altered.

Error starting at line 39 in command:
ALTER TABLE COMPONENT ADD CONSTRAINT IS PART OF A FOREIGN KEY (DATACENTERID) REFERENCES DATACENTER (DATACENTERID)
Error report:
SQL Error: ORA-00902: invalid datatype
00902. 00000 -  "invalid datatype"
*Cause:    
*Action:

Error starting at line 42 in command:
ALTER TABLE COMPONENT ADD CONSTRAINT IS A SUBPART OF FOREIGN KEY (FKCOMPONENTID) REFERENCES COMPONENT (COMPONENTID)
Error report:
SQL Error: ORA-00902: invalid datatype
00902. 00000 -  "invalid datatype"
*Cause:    
*Action:

EDIT I edited the code because I saw that some SQL statements are missing.
I can provide the schema if you want?

Best wishes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:00:55+00:00Added an answer on June 1, 2026 at 6:00 am

    Your constraint name IS PART OF A is an illegal identifier (because of the spaces).

    You need to remove the spaces, e.g. IS_PART_OF_A:

    ALTER TABLE COMPONENT 
       ADD CONSTRAINT IS_PART_OF_A 
       FOREIGN KEY (DATACENTERID) 
       REFERENCES DATACENTER (DATACENTERID)
    

    Edit
    I also realized that your script is not correctly terminating the individual statements. There is a ; (or /) missing after the first CREATE TABLE. And the first ALTER TABLE is not properly terminated as well. I don’t know if that is a copy & paste error though.

    Edit2:

    Here is the complete script with correct names, statement termination and in the correct order:

    CREATE TABLE COMPONENT(
        COMPONENTID INTEGER NOT NULL,
        DATACENTERID INTEGER,
        FKCOMPONENTID INTEGER,
        COMPONENTSTATSID INTEGER NOT NULL
    )
    /
    
    CREATE TABLE DATACENTER(
      DATACENTERID INTEGER NOT NULL,
      NAME VARCHAR2(80 ) NOT NULL,
      LOCATION VARCHAR2(200 ),
      DCALLOWEDWEIGHTKG NUMBER(9,0),
      DCMAXIMUMWEIGHTKG NUMBER(9,0),
      DCALLOWEDPOWERWATT NUMBER(9,0),
      DCMAXPOWERWATT NUMBER(9,0),
      DCALLOWCOOLINGPOWERBTU NUMBER(9,0),
      DCMAXCOOLINGPOWERBTU NUMBER(9,0),
      DESCRIPTION CLOB
    )
    /
    
    ALTER TABLE DATACENTER ADD CONSTRAINT DATACENTERID PRIMARY KEY (DATACENTERID)
    /
    
    ALTER TABLE COMPONENT ADD CONSTRAINT COMPONENTID PRIMARY KEY (COMPONENTID)
    /
    
    ALTER TABLE COMPONENT ADD CONSTRAINT IS_PART_OF_A FOREIGN KEY (DATACENTERID) REFERENCES DATACENTER (DATACENTERID)
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create this JSF table with paging and sorting. This is JSF
this table i want to create job_id dynamic Jobs Title text Job Description text
I want to create a JSF table like this . But instead delete button
(Using Oracle) I have a table with key/value pairs like this: create table MESSAGE_INDEX
Given a table: CREATE TABLE [GENERIC_TABLE] ( [RECORD_ID] [int] IDENTITY(1,1) NOT NULL, [SHORT_DESC] [varchar]
I want to create this parameter file so that I can send it to
I have a JasperReport and I want to create for this report a cover
I want to do something like this create type Item as object ( id
I want to create a link like this: <a href=http://example.com>text</a> and replace the behavior
I want to create an application like this: http://collabedit.com/ What is the most efficient

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.