Hello,
I am extremely puzzled. I am using SQLDeveloper and trying to create a stored procedure on oracle database. I have a sql server backround but not much in oracle. I've been told that it is relatively the same but I am not finding that. I will be connecting the stored procedure(oracle 9i) to crystal reports ver 9 and wanted to see if a simple procedure will work in crystal but I cannot create a simple procedure. I have created the following stored procedure;
CREATE OR REPLACE PROCEDURE test
AS
BEGIN
select first_name from shr_people;
END;
I have compiled it an run the script and it fails. Why does it fail?
So then I researched this and found that I needed to add an INTO(still have no idea why) and modified my code to read;
CREATE OR REPLACE PROCEDURE test(
fname IN OUT varchar
)
AS
BEGIN
select first_name into fname
from shr_people;
END;
Ran script and it created the procedure successfully.
Now my questions.....1) why the use of the into? 2) how do I run the procedure once completed? 3)Does oracle not return recordsets like sql server. Thanks everyone and sorry for the basic questions.
I am extremely puzzled. I am using SQLDeveloper and trying to create a stored procedure on oracle database. I have a sql server backround but not much in oracle. I've been told that it is relatively the same but I am not finding that. I will be connecting the stored procedure(oracle 9i) to crystal reports ver 9 and wanted to see if a simple procedure will work in crystal but I cannot create a simple procedure. I have created the following stored procedure;
CREATE OR REPLACE PROCEDURE test
AS
BEGIN
select first_name from shr_people;
END;
I have compiled it an run the script and it fails. Why does it fail?
So then I researched this and found that I needed to add an INTO(still have no idea why) and modified my code to read;
CREATE OR REPLACE PROCEDURE test(
fname IN OUT varchar
)
AS
BEGIN
select first_name into fname
from shr_people;
END;
Ran script and it created the procedure successfully.
Now my questions.....1) why the use of the into? 2) how do I run the procedure once completed? 3)Does oracle not return recordsets like sql server. Thanks everyone and sorry for the basic questions.