Hi everyone,
Can we call for loop in bteq in unix.
Example:
bteq<<EOF
for i in (select eid from emp)
sel * from dept where eid =i;
EOF
Can you please help me if we can use loops in bteq in unix.
No BtEQ doesn't support loops and only supports forward GOTOs. It is a very simple scripting tool.
However that being said how representative is your example?
This is cursor-processing which is very ineffective and set-processing is preferred.
The example could be updated as follows and avoid the use of looping:
bteq<<EOF
sel * from dept where eid in (select eid from emp);
EOF
So this is a precept that should be used wherever possible and in many cases cursor-processing, especially for large volumes is not necessary.