Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Return multiple...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 9 Topic 6766 of 7279
Post > Topic >>

Return multiple copies of same row in table with sequence number

by egnew@[EMAIL PROTECTED] Mar 7, 2008 at 05:20 PM

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.
 




 9 Posts in Topic:
Return multiple copies of same row in table with sequence number
egnew@[EMAIL PROTECTED]   2008-03-07 17:20:20 
Re: Return multiple copies of same row in table with sequence nu
Charles Hooper <hooper  2008-03-07 19:00:32 
Re: Return multiple copies of same row in table with sequence nu
Urs Metzger <urs@[EMAI  2008-03-08 14:38:29 
Re: Return multiple copies of same row in table with sequence nu
egnew@[EMAIL PROTECTED]   2008-03-08 06:26:39 
Re: Return multiple copies of same row in table with sequence nu
egnew@[EMAIL PROTECTED]   2008-03-08 07:09:39 
Re: Return multiple copies of same row in table with sequence nu
Urs Metzger <urs@[EMAI  2008-03-08 16:38:01 
Re: Return multiple copies of same row in table with sequence nu
Maxim Demenko <mdemenk  2008-03-08 17:12:29 
Re: Return multiple copies of same row in table with sequence nu
egnew@[EMAIL PROTECTED]   2008-03-08 08:29:21 
Re: Return multiple copies of same row in table with sequence nu
Maxim Demenko <mdemenk  2008-03-08 17:45:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 20:16:54 CST 2008.