Book a Demo

Author Topic: Data Modeling - Oracle 10 g  (Read 2302 times)

jagr

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Data Modeling - Oracle 10 g
« on: December 18, 2007, 08:30:34 am »
Using 7.0.817 Build 817

Hi:

I have a data modeling diagram, with tables for database oracle.

I'm design a table called SC_Tipo_Contrato, this table contains a field called ID_Contrato, this field is the primary key, is autonumber, with start value at 1 and Increment Values at 1 too.

Then, I generate DDL for this table, and EA, create the following sentences in the file:

....
CREATE TABLE SC_Tipo_Contrato
(

ID_Contrato      NUMBER NOT NULL,    -- Este campo es la llave principal de la entida tipos de contrato, es un consecutivo autoincremental

Nombre_Contrato  VARCHAR2(50)    -- Este campo tiene el nombre del tipo de contrato asociado
)
;
...
ALTER TABLE SC_Tipo_Contrato

ADD CONSTRAINT UQ_Tipo_Contrato_Nombre_Contr UNIQUE (Nombre_Contrato)
;

ALTER TABLE SC_Tipo_Contrato ADD CONSTRAINT PK_Tipo_Contrato

PRIMARY KEY (ID_Contrato)
;

CREATE SEQUENCE SC_Tipo_Contra_ID_Contrato_SEQ
INCREMENT BY 1
START WITH 1
NOMAXVALUE
MINVALUE 1
NOCYCLE
NOCACHE
NOORDER;

CREATE OR REPLACE TRIGGER SET_SC_Tipo_Contra_ID_Contrato
BEFORE INSERT
ON SC_Tipo_ContraFOR EACH ROW
BEGIN
 SELECT SC_Tipo_Contra_ID_Contrato_SEQ.NEXTVAL
 INTO :NEW.ID_Contrato
 FROM DUAL;
END;

Look at the sentence in the red color, you can see the error, the table name is truncate.

I don't know if exist another solution different to change the table name and cut this name.

I have another question ¿how can i do to define the tablespaces in oracle for the primary key's index?
Thanks for your help





:'( :'( :'( :'( :'(