It is necessary to analyze the fluctuations in exchange rates, depending on the sign of the zodiac. I would like to insert foreign key (zodiak_id) in the follow table:
create table CURRENCY (
CUR_ID number NOT NULL,
CUR_DATE DATE not null,
CUR_NAME varchar2(3) not null,
VALUE NUMBER not null,
Zodiac_id number,
constraint PK_CUR primary key (CUR_ID),
CONSTRAINT FK_ZOD FOREIGN KEY (Zodiac_id) REFERENCES Zodiac(Zodiac_id)
);
of this table:
create table Zodiac (
Zodiac_id number not null,
Zodiac_name VARCHAR2(15) not null,
START_PERIOD date,
END_PERIOD date,
constraint PK_Zod primary key (Zodiac_id)
);
The sqls i wrote is below:
insert into CURRENCY cr(Zodiac_id)
select Zodiac_id from ZODIAC z
where cr.CUR_DATE >= z.START_PERIOD and cr.CUR_DATE <= z.END_PERIOD;
But get this error: SQL Error: ORA-00904: "CR"."CUR_DATE": invalid identifier
Thanks in advance for your help.