Geeks Talk

Prepare for your Next Interview




Select row by repeating

This is a discussion on Select row by repeating within the SQL forums, part of the Databases category; id no 101 2 102 3 103 1 i need a which is given below. i want to know the comment to know how i wil get this result 101 ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-29-2007
Contributing Member
 
Join Date: Jul 2007
Posts: 43
Thanks: 1
Thanked 1 Time in 1 Post
priyasp_msit is on a distinguished road
Select row by repeating

id no

101 2
102 3
103 1

i need a which is given below. i want to know the comment to know how i wil get this result

101
101
102
102
102
103
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-29-2007
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 462
Thanks: 23
Thanked 57 Times in 56 Posts
susarlasireesha is on a distinguished road
Re: Select row by repeating

set serveroutput on

declare
id1 varchar2(25);
j number:=0;
begin
for i in (select no from temp)
loop
while j loop
select id into id1 from temp where no=i.no;
dbms_output.put_line(id1);
j:=nvl(j,0)+1;
end loop;
j:=0;
end loop;
end;
Reply With Quote
  #3 (permalink)  
Old 12-08-2007
Contributing Member
 
Join Date: Jul 2007
Posts: 43
Thanks: 1
Thanked 1 Time in 1 Post
priyasp_msit is on a distinguished road
Re: Select row by repeating

declare
id1 varchar2(25);
j number:=1;
begin
for i in (select no from temp)
loop
while j <=i.no loop
select id into id1 from temp where no=i.no;
dbms_output.put_line(id1);
j:=j+1;
end loop;
j:=1;
end loop;
end;

thanks for ur query but some error have came i changed little answer i got .
Reply With Quote
  #4 (permalink)  
Old 06-27-2008
Banned
 
Join Date: Jun 2008
Location: indiachennai
Posts: 6
Thanks: 1
Thanked 1 Time in 1 Post
ramyaselvi16 is on a distinguished road
Re: Select row by repeating

Hi frnd,
Sorry i could not understand which table both of u used to get this result.
pls explain detail y.

Rgds

Ramya
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Select within select neeraj_sigh SQL 7 12-09-2007 04:59 AM
repeating the records in the output table ... rathin007 Data Warehousing 2 10-26-2007 07:01 AM
Singleton select sdresh MainFrame 2 09-11-2007 03:20 AM
I am not able to select the pop-up window Geek_Guest QTP 0 07-12-2007 06:20 AM
Select a different value from the combo box JobHelper WinRunner 1 12-26-2006 11:17 AM


All times are GMT -4. The time now is 02:19 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved