In my oracle stored procedure,I need to create temporary table. I want to insert rows in temporary table based on some logic and return this rows from stored procedure.
My database is in oracle 11G. I am using oracle sql developer for creating stored procedure.
Getting below error while trying to fetch multiple rows.
Error(6,4): PLS-00428: an INTO clause is expected in this SELECT statement
CREATE OR REPLACE PROCEDURE TestStoredP AS
stmt varchar2(1000);
BEGIN
select emp_id,empname INTO AAA,BBB from EMPLOYEE;
stmt := 'create global temporary table temp(id number(10))';
EXECUTE IMMEDIATE stmt;
stmt := 'insert into temp values(1)';
EXECUTE IMMEDIATE stmt;
stmt := 'select * from temp';
EXECUTE IMMEDIATE stmt;
execute immediate ' drop table temp';
END TOPS;
Please suggest how to implement this.