problem using dclgen

IBM's flagship relational database management system

problem using dclgen

Postby swapna namburu » Wed Sep 08, 2010 2:44 pm

I have 2 tables
dept having deptno, dname in this deptno primary key
emp having eno,ename ,esal,deptno in this eno is primary key and deptno is foreign key references dept(deptno)

using cursor, i want to retrieving all emp columns and dname only.
in cursor
declare c1 cursor
select eno,ename,esal,e.deptno , dname from emp e, dept d where e.deptno=d.deptno
but in this case , when we creae dclgen for dept and emp
It creates hv-deptno same name as host variable name for both tables(emp,dept) of deptno
how we represent when we use
fetch c1
[color=#000040]:hv-deptno, /* how to mention here this is from emp table*/

swapna namburu
Posts: 6
Joined: Wed Sep 08, 2010 2:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: problem using dclgen


Re: problem using dclgen

Postby dick scherrer » Thu Sep 09, 2010 2:41 am

Hello and welcome to the forum,

Change the fetch to :dcltablename.hv-deptno to qualify which of the host variables is to be used.

Look at the dclgen to know the actual qualifier for your code.
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

Return to DB2


  • Related topics
    Last post