ksg
ksg

Reputation: 4067

Error in select query in Oracle

I've used a select statement in stored procedure in oracle 11g xe.But an error is showing as

pls-00428-an INTO clause is expected with select statement

I just cannot understand the error.When i searched i found out that in pl/sql an into clause is needed.I'm using toad.But when i used sql editor same error is showing.

Here's my procedure

CREATE OR REPLACE PROCEDURE ACTSINFO.sp_Get_WorkDetails
IS
BEGIN
 select * from workdetails;
END sp_Get_WorkDetails;

Upvotes: 0

Views: 1094

Answers (2)

user330315
user330315

Reputation:

Oracle is different from Microsoft SQL Server and therefor returning a result set from a procedure (or function) is different as well.

What you are looking for is a "pipelined table function".

Please refer to the manual for a description and an example:

http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/tuning.htm#i53109

Here are some more examples from other sites:

http://www.oracle-developer.net/display.php?id=207
http://www.oracle-base.com/articles/misc/PipelinedTableFunctions.php
http://psoug.org/reference/pipelined.html

Upvotes: 3

KV Prajapati
KV Prajapati

Reputation: 94645

You are trying to write wrong syntax or improper use of SELECT statement. You have to either create a cursor or use SELECT .. INTO syntax to set scalar value to the local variables.

Upvotes: 2

Related Questions