Results 1 to 3 of 3

Thread: Comparisons

  1. #1
    Join Date
    Feb 2004
    Posts
    16

    Unhappy Unanswered: Comparisons

    i have the code :

    DECLARE
    PROCEDURE topResToSelTop (p_topic_result_id IN VARCHAR2,
    p_topic_result_counter IN NUMBER) IS
    BEGIN
    IF INSTR(p_topic_result_id, p_topic_result_counter) > 0 THEN -- ??Greater than all other Topic_Result_ID totals??
    INSERT INTO sel_top (Selected_Topic_ID)
    VALUES (p_topic_result_id);
    --THEN
    INSERT INTO Top_Key (Topic_Keyword_Counter)
    VALUES (Topic_Keyword_Counter + 1);
    END IF;
    END;
    BEGIN
    BEGIN
    << Top_Res_loop >>
    FOR cur_text IN (SELECT Topic_Result_ID FROM Top_Res) LOOP
    << Top_Res_loop2 >>
    FOR cur_tk IN (SELECT Topic_Result_ID from Top_Res) LOOP
    topResToSelTop(cur_text.Topic_Result_ID, cur_tk.Topic_Result_ID);
    END LOOP Top_Res_loop;
    end loop Top_Res_loop2;
    END;
    /

    I want the two loop two compare all the ID's in the Top_Res table against each other and the ID with the highest value at the end to be entered to the Sel_Top table with 1 being added to the Topic_Keyword_Counter in the Top_Key table, but i dont know how to tell it to enter the largest valued Topic_Result_ID after looking through the Top_Res table can someone help me out please

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Comparisons

    Something like:

    select max(Topic_result_id) from my_table;

    ?

  3. #3
    Join Date
    Jan 2004
    Location
    Singapore
    Posts
    89

    Re: Comparisons

    Try to use rank function available in 9. Just see if this is the thing you were looking for

    Praveen
    praveenpr@rediffmail.com

    Originally posted by andrewst
    Something like:

    select max(Topic_result_id) from my_table;

    ?

Posting Permissions

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