Error create lookup table
tebet11Apr 1 2004 — edited Apr 3 2004I tried to create a lookup table after finish creating my table. However, it keeps giving me error. I checked the sql syntax and found out that the wizard created a wrong sql statement in last line which is creating index on a column that is not in the table.
Is it bug in HTMLDB or I miss some steps? My HTMLDB version is 1.4.4.00.32
Below is the sql statement from the wizard:
------------------------------------------
create table "HARD_BRAND_LOOKUP"(id number not null primary key, "BRAND" varchar2(4000) not null)
create sequence "SEQ_HARD_BRAND_LOOKUP"
create or replace trigger "T_HARD_BRAND_LOOKUP" before insert or update on "HARD_BRAND_LOOKUP" for each row begin if inserting and :new.id is null then for c1 in (select "SEQ_HARD_BRAND_LOOKUP".nextval nv from dual) loop :new.id := c1.nv; end loop; end if; end;
insert into "HARD_BRAND_LOOKUP" ( "BRAND" ) select distinct "BRAND" from "GARYDB"."HARD" where "BRAND" is not null
alter table "HARD" add "BRAND2" number update "HARD" x set "BRAND2" = (select "ID" from "HARD_BRAND_LOOKUP" where "BRAND" = x."BRAND")
alter table "HARD" drop column "BRAND"
alter table "HARD" rename column "BRAND2" to "BRAND_ID"
alter table "HARD" add foreign key ("BRAND_ID") references "HARD_BRAND_LOOKUP"("ID")
create index "I_HARD_BRAND_BRAND" on "HARD_BRAND_LOOKUP" ("BRAND")