This discussion is archived
12 Replies Latest reply: Dec 12, 2012 12:40 PM by Justin Cave RSS

How can I write numbers

979103 Newbie
Currently Being Moderated
Hi, I've got question

How can I write numbers form 4 to 9 by loop, while and for?

Cheers
  • 1. Re: How can I write numbers
    Justin Cave Oracle ACE
    Currently Being Moderated
    Hi and welcome to the forum.

    This looks like a homework assignment (or at least that you're working on one of the first exercises in a book on PL/SQL). We're happy to help but you're not going to learn anything if we do your homework for you. Can you show us what you've tried? What error(s) did you get? What behavior(s) did you get that you didn't expect? What behavior(s) did you not get that you did expect? We're happy to provide pointers but we need you to show us where you're having problems.

    Are you familiar with loops in the context of any programming language?

    Justin
  • 2. Re: How can I write numbers
    sb92075 Guru
    Currently Being Moderated
    976100 wrote:
    Hi, I've got question

    How can I write numbers form 4 to 9 by loop, while and for?

    Cheers
    no LOOP or WHILE is needed
      1  select level+3 from dual
      2* connect by level < 7
    SQL> /
    
       LEVEL+3
    ----------
             4
             5
             6
             7
             8
             9
    
    6 rows selected.
  • 3. Re: How can I write numbers
    Frank Kulash Guru
    Currently Being Moderated
    Hi,

    Welcome to the forum!

    Any introductory PL/SQL source will have examples that you can copy and modify. The PL/SQL manual also has examples.

    As Justin said, post your best attempt and a specific question here if you get stuck.
  • 4. Re: How can I write numbers
    onedbguru Pro
    Currently Being Moderated
    sb92075: Don't be so eager to solve a students problem just because you can. They will never learn if you just give them the answer. Answering a post where there is no evidence that the poster has put any effort into trying to solve the problem helps no one - especially the poster.
  • 5. Re: How can I write numbers
    Most Wanted!!!! Journeyer
    Currently Being Moderated
    sb92075

    i really appriciate your answer i never ever thought of using level for loop ,thats an good information for me u have provided

    thanks guru ,



    regards ,
    friend

    Edited by: most wanted!!!! on Dec 10, 2012 10:48 PM
  • 6. Re: How can I write numbers
    jeneesh Guru
    Currently Being Moderated
    most wanted!!!! wrote:
    sb92075

    i really appriciate your answer i never ever thought of using level for loop ,thats an good information for me u have provided

    thanks guru ,



    regards ,
    friend

    Edited by: most wanted!!!! on Dec 10, 2012 10:48 PM
    You will be interested in All These then.
  • 7. Re: How can I write numbers
    jeneesh Guru
    Currently Being Moderated
    onedbguru wrote:
    sb92075: Don't be so eager to solve a students problem just because you can. They will never learn if you just give them the answer.
    If the "Student" is not interested to learn and they are posting directly in the Forum - whose mistake?
    Answering a post where there is no evidence that the poster has put any effort into trying to solve the problem helps no one - especially the poster.
    Who is the looser?

    I personally find the forum as a place to learn new things and also to refresh my knowledge, as I didnot do much coding in my projects now - ofcourse because my role is changed....

    Giving so called, spoon feed solution is one of the way for refreshing myself..
  • 8. Re: How can I write numbers
    Gurjeet Newbie
    Currently Being Moderated
    set serveroutput on;

    begin
    for i in 4..9 loop
    dbms_output.put_line(i);
    end loop;
    end;
    /





    or



    select level+3 from dual connect by level <7;
  • 9. Re: How can I write numbers
    EdStevens Guru
    Currently Being Moderated
    jeneesh wrote:
    onedbguru wrote:
    sb92075: Don't be so eager to solve a students problem just because you can. They will never learn if you just give them the answer.
    If the "Student" is not interested to learn and they are posting directly in the Forum - whose mistake?
    Answering a post where there is no evidence that the poster has put any effort into trying to solve the problem helps no one - especially the poster.
    Who is the looser?

    I personally find the forum as a place to learn new things and also to refresh my knowledge, as I didnot do much coding in my projects now - ofcourse because my role is changed....

    Giving so called, spoon feed solution is one of the way for refreshing myself..
    Unfortunately, history has shown that a significant segment of the population will become addicted to being spoon fed and will continually seek to get others to do their work for them. We see it here all the time. The same people coming back again and again and again with very basic questions, never showing any sign of actually learning anything.

    The same principal works in society in general, not just on technical forums.
  • 10. Re: How can I write numbers
    BluShadow Guru Moderator
    Currently Being Moderated
    EdStevens wrote:
    jeneesh wrote:
    onedbguru wrote:
    sb92075: Don't be so eager to solve a students problem just because you can. They will never learn if you just give them the answer.
    If the "Student" is not interested to learn and they are posting directly in the Forum - whose mistake?
    Answering a post where there is no evidence that the poster has put any effort into trying to solve the problem helps no one - especially the poster.
    Who is the looser?

    I personally find the forum as a place to learn new things and also to refresh my knowledge, as I didnot do much coding in my projects now - ofcourse because my role is changed....

    Giving so called, spoon feed solution is one of the way for refreshing myself..
    Unfortunately, history has shown that a significant segment of the population will become addicted to being spoon fed and will continually seek to get others to do their work for them. We see it here all the time. The same people coming back again and again and again with very basic questions, never showing any sign of actually learning anything.
    That's great though. It means that they aren't learning anything, so the market isn't flooded with people with good skills. More jobs for the rest of us who don't need spoon feeding.

    :)
  • 11. Re: How can I write numbers
    979103 Newbie
    Currently Being Moderated
    Hi,

    I'm working on one of the first exercises in a book and need some support. It is very hard to understand SQL language and PL/SQL.
  • 12. Re: How can I write numbers
    Justin Cave Oracle ACE
    Currently Being Moderated
    OK. Like we said, we're happy to help by providing pointers rather than finished code.

    What have you tried so far? What was wrong with that attempt? Did you get an error? Did it not print the values you expected? Something else? If you post your best attempt and show us what the problem was, that makes it possible for us to understand where you are likely having a problem.

    Are you familiar with loops in any other programming language? Or is this your first introduction to programming?

    Justin

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points