How to create projections by joining two flex tables

Moderator: NorbertKrupa

Post Reply
son2
Newbie
Newbie
Posts: 3
Joined: Fri Feb 19, 2016 1:46 pm

How to create projections by joining two flex tables

Post by son2 » Fri Feb 19, 2016 1:54 pm

I want to create projection by joining two flex tables, while creating projection it is giving the error as PK=FK relationships should be defined on the joining fields. I am able to create PK on the master table; but while creating foreign key on child table; its giving error as incompatible datatype on the primary key and foreign key fields.
I have made the joining fields as real columns in flex table. The data type of joining fields are varchar(40)

Below is the code :
CREATE projection flex_projection_emp_dep (emp_dept,dept_name,dept_code)
AS select e.dept,d.dept,d.dept_code from flex_emp e INNER join
flex_dep d
on e.dept=d.dept

below code worked fine while creating primary key:
alter table flex_emp add primary key(dept)

Below code didn't worked while creating foreign key:
alter table flex_dep add foreign key(dept) references flex_emp(dept)

It is giving error: incompatible data type between primary key and foreign key columns. Although datatype of joining fields are same i.e varchar(40).

How to create foreign key on flex table?

sasikari
Newbie
Newbie
Posts: 4
Joined: Tue Oct 23, 2012 10:28 am

Re: How to create projections by joining two flex tables

Post by sasikari » Tue Mar 08, 2016 11:38 am

Hi,

As per the question from your subject, we can't create Pre Join projection on flex tables , instead you can create View by joining two flex tables.
Or
You can create projections on individual flex table and create a View by joining two Projections.

-Sasi

Post Reply

Return to “General”