×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Declare C1 cursor for
Select G.GrandFatherKey, G.FatherKey, F.ChildKey , C.ChildData
From GrandPa G left outer join Father F
on G.FatherKey = F.FatherKey
left outer join Child C
on F.ChildKey = C.ChildKey;
Open C1;
Fetch C1 into :GrandFatherKey, :FatherKey,
:ChildKey :ChildKeyNullInd,
:ChildData :ChildDataNullInd;
... repeat fetch ...
Close C1;
There's a lot more to this to understand, like:
- Testing sql status and sql code for success on the open.
- Testing same for "end of file" on your fetch loop
- How to set up null indicators, which will tell you that there was either
no father row for that grandfather row, and/or no child row for that
father row.
You might want to get a book on this.
For an example on some of this check out
http://code.midrange.com/488d49885a.html
Using this example from BPCS in STRSQL
select g.lord, g.lline, g.lprod,
f.iprod, f.iclas,
c.iclas, c.icdes
from ecl g left outer join iim f
on g.lprod = f.iprod
left outer join iic c
on f.iclas = c.iclas
where g.lprod<>' '
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.