title: Creating a stored procedure for the select statement in oracle
body: <p>I have created procedure like below ,but i'm getting an error has :</p>
  <p><strong>/1       PLS-00428: an INTO clause is expected in this SELECT statement
  Errors: check compiler log</strong></p>
  <pre><code>Create or replace procedure Sanction_test
  as 
  begin
  select 
  ROWNUM, 
  cadid, CADRE,PAYSCALE, POST, PostId, deptid, Dept,grp,gazetted, Per_Normal_Cur, Per_Encd_Cur, Temp_Normal_Cur, Temp_Encd_Cur,Sup_Cur,(Per_Normal_Cur + Per_Encd_Cur + Temp_Normal_Cur + Temp_Encd_Cur + Sup_Cur)as TOTAL_CUR, Per_Normal_Up,Per_Encd_Up,Temp_Normal_Up,Temp_Encd_Up ,Sup_Up,(Per_Normal_Up + Per_Encd_Up + Temp_Normal_Up + Temp_Encd_Up + Sup_Up) as TOTAL_UPCOM, Per_Normal_Delta,Per_Encd_Delta,Temp_Normal_Delta,Temp_Encd_Delta,Sup_Delta ,(Per_Normal_Delta + Per_Encd_Delta + Temp_Normal_Delta + Temp_Encd_Delta + Sup_Delta) TOTAL_DELTA from(SELECT rownum , (SELECT CADRE_NAME FROM REF_CADRE c WHERE C.CADRE_ID = P.CADRE_ID) CADRE ,FD_PS_STR PAYSCALE  ,(SELECT POST_NAME FROM REF_POST WHERE POST_ID = P.POST_ID) POST,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE    department_id = '116' and permanant_flag = 'Y' and witheffectivedate &lt; '01-04-22' and POST_ID = P.POST_ID  ) as Per_Normal_Cur  , 
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE  department_id = 116  and Encadre_from_flag = 'Y' and witheffectivedate &lt; '01-04-22' and POST_ID = P.POST_ID  ) as Per_Encd_Cur,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id =116 and temporary_flag = 'Y'  and witheffectivedate &lt; '01-04-22' and POST_ID = P.POST_ID  ) as Temp_Normal_Cur, 
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE   department_id = 116 and temporary_enc_flag = 'Y' and witheffectivedate &lt; '01-04-22' and POST_ID = P.POST_ID  ) as Temp_Encd_Cur,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116 and supernumerary_flag = 'Y'and witheffectivedate &lt; '01-04-22' and POST_ID = P.POST_ID  ) as Sup_Cur,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116  and permanant_flag = 'Y' and POST_ID = P.POST_ID  ) as Per_Normal_Up,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116  and Encadre_from_flag = 'Y' and POST_ID = P.POST_ID  ) as Per_Encd_Up,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116  and temporary_flag = 'Y' and POST_ID = P.POST_ID  ) as Temp_Normal_Up,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116 and temporary_enc_flag = 'Y' and POST_ID = P.POST_ID  ) as Temp_Encd_Up,
  (SELECT COUNT(1) FROM ref_post_code_details  WHERE department_id = 116  and supernumerary_flag = 'Y' and POST_ID = P.POST_ID  ) as Sup_Up,  
  (SELECT NVL(sum(per_normal), 0)  nrml FROM test_delta1 WHERE  dept_code =116  and POST_ID = P.POST_ID  ) as Per_Normal_Delta, 
  (SELECT NVL(sum(per_ENCADRED), 0)  nrml FROM test_delta1 WHERE  dept_code = 116 and POST_ID = P.POST_ID  ) as Per_Encd_Delta, 
  (SELECT NVL(sum(TEMP_NORMAL), 0)  nrml FROM test_delta1 WHERE  dept_code = 116  and POST_ID = P.POST_ID  ) as Temp_Normal_Delta, 
  (SELECT NVL(sum(TEMP_ENCADRED), 0)  nrml FROM test_delta1 WHERE  dept_code = 116  and POST_ID = P.POST_ID  ) as Temp_Encd_Delta, 
  (SELECT NVL(sum(SUPERNUMERARY), 0)  nrml FROM test_delta1 WHERE  dept_code = 116  and POST_ID = P.POST_ID  ) as Sup_Delta,  p.cadre_id cadid, P.Post_id as PostId, p.groups grp ,
  DECODE(P.GROUPS,'A','Yes','B','Yes','No') gazetted,  P.DEPARTMENT_ID deptid, D.department_name dept, P.old_dept_cd FROM REF_POST P, REF_DEPARTMENT D  
  WHERE P.DEPARTMENT_ID = D.DEPARTMENT_ID    and P.DEPARTMENT_ID = 116  GROUP BY p.cadre_id,P.POST_ID,p.old_dept_cd,P.DEPARTMENT_ID,d.department_name,p.groups,FD_PS_STR,rownum ORDER BY ROWNUM)
  a order by rownum;
  end;
  </code></pre>