Subject | varchar foreign keys |
---|---|
Author | Marcelo Miorelli |
Post date | 2001-01-15T12:28:10Z |
Untitled-1Hello all, I dont know why I cannot make a foreign key work
between two varchar fields even if it is a primary key.
Could someone help, please?
I have this case for instance:
CREATE TABLE "FAMILY"
(
"COD_FAMILY" FLOAT NOT NULL,
"INDEX_PROFIT" DOUBLE PRECISION,
"DES_FAMILY" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
CONSTRAINT "PKFAMILIA_DO_PRODUTO" PRIMARY KEY ("COD_FAMILY")
);
CREATE TABLE "PRODUCT"
(
"COD_PRODUCT" FLOAT NOT NULL,
"DES_PRODUCT" VARCHAR(40) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"COD_FAMILY" FLOAT NOT NULL,
"DES_FAMILY" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"COD_MARK" FLOAT NOT NULL,
"DES_MARK" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"TYPE_PRODUCT" VARCHAR(1) CHARACTER SET ISO8859_1 default '0' NOT NULL
COLLATE PT_PT,
"COD_CTAX" FLOAT NOT NULL);
Why I cannot set a foreign key fkPRODUCT_FAMILY on product des_family and
family des_family?
between two varchar fields even if it is a primary key.
Could someone help, please?
I have this case for instance:
CREATE TABLE "FAMILY"
(
"COD_FAMILY" FLOAT NOT NULL,
"INDEX_PROFIT" DOUBLE PRECISION,
"DES_FAMILY" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
CONSTRAINT "PKFAMILIA_DO_PRODUTO" PRIMARY KEY ("COD_FAMILY")
);
CREATE TABLE "PRODUCT"
(
"COD_PRODUCT" FLOAT NOT NULL,
"DES_PRODUCT" VARCHAR(40) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"COD_FAMILY" FLOAT NOT NULL,
"DES_FAMILY" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"COD_MARK" FLOAT NOT NULL,
"DES_MARK" VARCHAR(25) CHARACTER SET ISO8859_1 NOT NULL COLLATE PT_PT,
"TYPE_PRODUCT" VARCHAR(1) CHARACTER SET ISO8859_1 default '0' NOT NULL
COLLATE PT_PT,
"COD_CTAX" FLOAT NOT NULL);
Why I cannot set a foreign key fkPRODUCT_FAMILY on product des_family and
family des_family?