SQL composite keys....can anyone help

Jon Boy

New Member
At the moment I am using oracle to develop a database.

Ok I have a new problem now, my database requires a composite key. This composite Key is made from a foreign key and an autonumber 0-99 that loops round.

I tried to create a table that does this by.

CREATE table "LOT" (
"AUCTION_ID" NUMBER NOT NULL,
"LOT_ID" NUMBER NOT NULL,
"WITHDRAWN" VARCHAR2(5),
"HIGHEST_BID" NUMBER(6,2),
"SOLD" VARCHAR2(5),
"BUYER_ID" NUMBER,
"SELLER_ID" NUMBER,
FOREIGN KEY ("AUCTION_ID") REFERENCES "AUCTION" ("AUCTION_ID"));
/

CREATE trigger "BI_LOT"
before insert on "LOT"
for each row
begin
select "LOT".nextval into :NEW.LOT_ID from dual;
end;
/

alter table "LOT" add constraint "LOT_PK" primary key ("AUCTION_ID","LOT_ID")
/
But this returns

ORA-00911: invalid character

I would really really appreciate a fast response as my dead line is fast approaching and I have still not created the tables.

Thanks
Jon
 
Back
Top