I want to return multiple copies of data from a table but do not
understand how to accomplish this. The following code works to return
a fixed number of copies but I cannot determine how to replace the
constant with a variable. How do I do this and is there an easier
way?
I need to print numbered certificates for an employee. I can use the
following sql to generate a fixed number of certificates but the
number I need is in a field on the record.
select x.SeqNo,e.EmployeeNo,e.EmployeeName
from Employees e,
(select rownum SeqNo from dual connect by level <= 3) x
where e.EmployeeNo = 78
order by SeqNo
This returns:
1 78 Joe
2 78 Joe
3 78 Joe
What I need is:
select x.SeqNo,e.EmployeeNo,e.EmployeeName
from Employees e,
(select rownum SeqNo from dual connect by level <=
e.CertificateCount) x
where e.EmployeeNo = 78
order by SeqNo
However the above SQL returns ORA-00904: "H"."LICENSECOUNT": invalid
identifier.
I have tried a number of other approaches but none have worked.
Thanks.