Results 1 to 11 of 11

Thread: Query Problem

  1. #1
    Join Date
    Apr 2004
    Posts
    38

    Unanswered: Query Problem

    I KNEW THE PROBLEM IS ON SUM(SALE.AMOUNT), EVEN I TRY SUM(SALE.AMOUNT) AS TOTAL
    WHAT'S THE PROBLEM WITH THIS QUERY?

    THANKS,
    FRENK
    Last edited by fj8283888; 05-18-04 at 06:15.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you are missing this --

    ... GROUP BY SALE.SA_ID, SALE.P_ID
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2004
    Posts
    38

    Transaction

    *
    ERROR at line 1:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at line 5
    [/CODE]


    SORRY GUYS, IT'S ME AGAIN, I REALLY KNOW WHY IT IS WRONG, WHEN I USE < INSTEAD OF=. IS IT POSSIBLE THAT I COULD DISPLAY MORE THAN ONE VALUE IN A TRANSACTION?

    THANKS.
    FRENK
    Last edited by fj8283888; 05-18-04 at 06:15.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    BID and BADD are variables declared in your PL/SQL block. They can contain only one value at the moment.

    Your SELECT statement obviously fetches 2 or more records that satisfied WHERE condition and, therefore, such an exception has been raised.

    Depending on what you want to do, rewrite the code. For example, you could use a cursor loop that will fetch one row at a time and, in such a way, permit you to populate those variables.

  5. #5
    Join Date
    Apr 2004
    Posts
    38

    Group

    [/CODE]
    I THINK I MISUNDERSTAND THE GROUP FUNCTION, WHAT'S THE PROBLEM IN THIS CODE?
    THANKS,
    FRENK
    Last edited by fj8283888; 05-18-04 at 06:15.

  6. #6
    Join Date
    May 2004
    Posts
    17
    you should include PRODUCT.P_ID,PRODUCT.P_NAME in the group by clause.

  7. #7
    Join Date
    Apr 2004
    Posts
    38

    Transaction

    Could I Add Select Query In The Transaction Code?


    Example

    Begin Animalsearch
    Select * From Fish;
    Union
    Select * From Cat;
    End;

  8. #8
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Frenk,

    no hard feelings, but it seems to me that you should take "Introduction to Oracle RDBMS Part 1" into your hands and start reading from the very first page. Connect to scott/tiger and try all the examples you find in it.

    Why? Because such an approach (the one you have) causes too much pain to you (and me too).

    Sorry, but I lost the point ... what did you mean to say with your last post? Begin Animalsearch? You're talking about Oracle SQL? Select query in the transaction code? Hm?

  9. #9
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by seham
    you should include PRODUCT.P_ID,PRODUCT.P_NAME in the group by clause.
    that's funny, those columns weren't in the query i was replying to

    in fact, the query i was replying to seems to have disappeared

    fj8283888, if you go back and edit a post query after someone has tried to help you, you aren't going to be getting any help from that person...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  10. #10
    Join Date
    Apr 2004
    Posts
    38

    Sorry, it's a mistake r937

    Dear r937,
    I pressed the ctrl^x instread of ctrl^c when I copied the code. Please don't think I deleted the code delibratly,


    sorry guys
    Frenk

  11. #11
    Join Date
    Apr 2004
    Posts
    38

    Transaction

    Could I put begin and end for the following command?

    select * from fish;
    insert into fish values(.......)


    thanks,
    frenk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •