1

This is my SQL Server stored procedure which is below:

CREATE PROCEDURE flight_details
AS
BEGIN 
SELECT Airline.Airline_No, Airline_Name, Airplane.Airplane_No, Airplane_Name, Flight.Flight_No, Flight_Type, City_Departure, City_Transit, City_Arrival, Departure_Date_Time, Transit_Date_Time, Arrival_Date_Time, Flight_Duration_in_hours, Transit_Duration_in_hours, Flight_Status
FROM Airline,Airplane, Flight
WHERE Airline.Airline_No = Airplane.Airline_No AND Airline.Airline_No=Flight.Airline_No AND Airplane.Airplane_No=Flight.Airplane_No
END
EXECUTE flight_details

The above SQL Server stored procedure worked successfully.

Next, I tried to translate it into Oracle stored procedure code which is shown below:

CREATE OR REPLACE PROCEDURE flight_details
(p_flight_details OUT SYS_REFCURSOR) 
AS 
BEGIN 
OPEN p_flight_details FOR
SELECT Airline.Airline_No, Airline_Name, Airplane.Airplane_No, Airplane_Name, Flight.Flight_No, Flight_Type, City_Departure, City_Transit, City_Arrival, Departure_Date_Time, Transit_Date_Time, Arrival_Date_Time, Flight_Duration_in_hours, Transit_Duration_in_hours, Flight_Status
FROM Airline,Airplane, Flight
WHERE Airline.Airline_No = Airplane.Airline_No AND Airline.Airline_No=Flight.Airline_No AND Airplane.Airplane_No=Flight.Airplane_No
END flight_details;
SET SERVEROUTPUT ON;
EXECUTE flight_details;

I tried creating this procedure in Oracle SQL Developer but it was showing the following error:

Error(5,1): PL/SQL: SQL Statement ignored
Error(7,133): PL/SQL: ORA-00933: SQL command not properly ended
Error(8,19): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge json_exists json_value json_query json_object json_array 
asked Jul 30, 2017 at 20:33

2 Answers 2

2

FYI, you can access the following link and convert your block code from SQL to Oracle.

http://sqlines.com/online

answered Feb 22, 2019 at 3:34
1

You're missing a colon at the end of your cursor's select statement.

WHERE Airline.Airline_No = Airplane.Airline_No AND Airline.Airline_No=Flight.Airline_No AND Airplane.Airplane_No=Flight.Airplane_No;
answered Jul 30, 2017 at 22:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.