Home » SQL & PL/SQL » SQL & PL/SQL » how to print our name 5 times rowwise using dual table
how to print our name 5 times rowwise using dual table [message #185470] Tue, 01 August 2006 22:42 Go to next message
jilhewar_santosh
Messages: 13
Registered: July 2006
Location: mumbai
Junior Member
hi to all
i want display my name from dual table 5 times
i want output from dual like
sam
sam
sam
sam
sam
how i do this
Re: how to print our name 5 times rowwise using dual table [message #185472 is a reply to message #185470] Tue, 01 August 2006 23:03 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
This looks like a homework assignment, so we will not provide you with an answer unless you show us you tried it.
So:
think of a way this could be done
try it
if you get stuck, show us what you did and we will help you out.
Re: how to print our name 5 times rowwise using dual table [message #185525 is a reply to message #185470] Wed, 02 August 2006 02:57 Go to previous messageGo to next message
orafaqer
Messages: 48
Registered: July 2006
Member
select 'Sam' name from dual
connect by level<=5;

or
select 'Sam' name from all_tables where rownum<=5;

or
select 'Sam' name from table(get_n_string(5));
get_n_string(p_n number) pipelined
for i in 1..n loop
   pipe row (...);
end loop;


Re: how to print our name 5 times rowwise using dual table [message #185575 is a reply to message #185525] Wed, 02 August 2006 06:57 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
@orafaqer:
Did you actually read my post and the original question?
Then why did you
- not let the OP show what he did
- provide two solutions that don't use dual (as requested)
Re: how to print our name 5 times rowwise using dual table [message #185631 is a reply to message #185575] Wed, 02 August 2006 15:03 Go to previous messageGo to next message
orafaqer
Messages: 48
Registered: July 2006
Member
2 Frank:
Surely, I've read your post. Generally I'm on your side, i.e. "anyone should try to do something before asking". But this situation IMHO is a kind of a FAQ ("How to generate exactly N rows"). I didn't find required topic in FAQ, so I decided to post a reply quickly. I've provided several approaches because dual is not a panacea Smile Besides, it can contains more than 1 row (of course this sitation is abnormal)
Sorry for offtopic.
Re: how to print our name 5 times rowwise using dual table [message #185807 is a reply to message #185631] Thu, 03 August 2006 12:58 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
There is an article on Oracle row generator techniques in the wiki:

http://www.orafaq.com/wiki/Oracle_Row_Generator_Techniques
Re: how to print our name 5 times rowwise using dual table [message #185819 is a reply to message #185807] Thu, 03 August 2006 14:42 Go to previous message
jrich
Messages: 35
Registered: February 2006
Member
This post needs to be moved to the Challenging HomEwork AssignmenTs forum, also known by the acronym C.H.E.A.T.

JR
Previous Topic: USING DBMS_PROFILER
Next Topic: how to add hours to date
Goto Forum:
  


Current Time: Fri Dec 09 19:25:51 CST 2016

Total time taken to generate the page: 0.13686 seconds