wood burning stoves 2.0*
The moose likes JDBC and the fly likes Oracle Procedure through Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle Procedure through Java" Watch "Oracle Procedure through Java" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle Procedure through Java