Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Procedure through Java

 
Vrushali Gore
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 /
 
Vrushali Gore
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your justification
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic