| Author |
Oracle Procedure through Java
|
Vrushali Gore
Ranch Hand
Joined: Oct 17, 2005
Posts: 40
|
|
Can I return a number of rows from oracle procedure. SQL> CREATE OR REPLACE PROCEDURE selectEmp 2 AS 3 c number; 4 BEGIN 5 select code from vrushaliemp; 6 END; 7 8 / Warning: Procedure created with compilation errors. SQL> show errors; Errors for PROCEDURE SELECTEMP: LINE/COL ERROR -------- ----------------------------------------------------------------- 5/3 PLS-00428: an INTO clause is expected in this SELECT statement Here I am writing a procedure to return all the employees from a procedure but here getting in a above error. Can anyone please help me out in achieving this?
|
 |
Sathya Prabhu
Greenhorn
Joined: Mar 10, 2006
Posts: 12
|
|
Dear Vrushali , SELECT statement retrieves the single-row value and store into a variable using INTO clause.So u should use an INTO clause in your statement...Try this piece : SQL> CREATE OR REPLACE PROCEDURE selectEmp 2 AS 3 c number; 4 BEGIN 5 select count(code) into c from vrushaliemp; 6 END; 7 8 /
|
Sathya
|
 |
Vrushali Gore
Ranch Hand
Joined: Oct 17, 2005
Posts: 40
|
|
|
Thanks for your justification
|
 |
 |
|
|
subject: Oracle Procedure through Java
|
|
|