Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temp Table populated with records only ONCE

Status
Not open for further replies.

tekpr00

IS-IT--Management
Jan 22, 2008
186
CA
Hello,

I have a table EMP described as such

EMP_NAME
-------
James
John
Peter
Luke
Patrick
Gorge

I will like to fetch emp_name to EMP_TEMP so that each time I select the EMP_NAME I can only select new record(s) not duplicate of what was previously selected.

For example, if my first satement is:
insert into emp_temp
select emp_name from emp where rownum < 3;

select * from emp_temp
emp_name
--------
James
Peter

I will like to know how to run the statement again so that my next statement will be like the following:
select * from emp_temp
emp_name
--------
Luke
Patrick

Thanks for your response
 
Tekpr00,

Your output data do not make sense when compared to your source data. There is more going on in your sample data than your specifications disclose. Please re-visit your data and explain how the source data transforms to the result sets.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
I have solved my problem.

I have added a autonumber colunm into my emp_temp. The autonumber is populated by sequence. The autonumber column allows me to restrict my output.

Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top