sql


2008-12-08 Digg! icurtain Delcious icurtain Technorati icurtain


  1. sql 
  2.  
  3. SERVEROUTPUT ON 
  4.  
  5. declare 
  6.    result_limit number := 10; 
  7.    current_query_no number := 1; 
  8.    --table_n varchar2(30) := 'brian.cran1400_der_results'; 
  9.    --cursor all_results is select * from brian.cran1400_der_results; 
  10.    cursor result_list(counter number) is select * from brian.cran1400_der_results where queryno = counter order by score DESC, docno ASC; 
  11.    --cursor sub_list is select * from brian.cran1400_der_results where  
  12.    --select all results from table where query number is less than 10 
  13.    inner_min number := 1; 
  14.    inner_max number := 10; 
  15.    total_precision number := 0; 
  16.  
  17.  
  18. begin 
  19.  
  20. for result_record IN result_list(current_query_no) loop 
  21. --loops through the result list in the cursor (all records 1 - 10) 
  22.  
  23.    for counter_one in inner_min..inner_max loop 
  24.          -- do stuff here 
  25.          current_query_no := counter_one; 
  26.           
  27.          if result_record.rn = 'R' then total_precision := total_precision + 1; 
  28.          dbms_output.put_line (total_precision); 
  29.          end if; 
  30.  
  31.  
  32.  
  33.    end loop; 
  34. end loop; 
  35. end; 
  36.  
  37.  
  38.