Forums Register Login

Oracle Procedure through Java

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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 /
+Pie Number of slices to send: Send
Thanks for your justification
Arthur, where are your pants? Check under this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1055 times.
Similar Threads
error in Oracle function
Hibernate; error executing stored procedure
Urgent need help with PL/SQL function
problem with my procedure
Getting result set using callablestatement??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:22:35.