简体   繁体   中英

how can i remove this ..plz tell me because i tried everyting .is there any probelm in this code

this is the code I currently have

create or replace procedure airline(flight_no      in airline_details.flight_no%type,
                                    airline        in airline_details.airline%type,
                                    source         in airline_details.source%type,
                                    destination    in airline_details.destination%type,
                                    departure_time in airline_details.depart_time%type,
                                    arrival_time   in airline_details.arrive_time%type,
                                    ticket_class   in airline_details.ticket_class%type,
                                    ticket_fare    in airline_details.ticket_fare%type) 
                                   is
begin
    insert into airline_details
    values
      (flight_no,
       airline,
       source,
       destination,
       depart_time,
       arrive_time,
       ticket_class,
       ticket_fare);
end;
/

and calling as

begin
  airline('PK-710', 'PIA', 'ISB', 'KHI', '10:00 AM', '12:00 AM', 'Economy', 85000);
end;
/
 ERROR at line 2: ORA-06550: line 2, column 1: PLS-00905: object SCOTT.AIRLINE is invalid ORA-06550: line 2, column 1: PL/SQL: Statement ignored

As Barbaros Özhan mentioned in your comment, there are mismatches in your formal argument names and the arguments you are passing in the Insert statement. departure_time arrival_time

Here is the corrected code

CREATE OR REPLACE PROCEDURE airline(
    flight_no        IN   airline_details.flight_no%TYPE,
    airline          IN   airline_details.airline%TYPE,
    source           IN   airline_details.source%TYPE,
    destination      IN   airline_details.destination%TYPE,
    departure_time   IN   airline_details.depart_time%TYPE,
    arrival_time     IN   airline_details.arrive_time%TYPE,
    ticket_class     IN   airline_details.ticket_class%TYPE,
    ticket_fare      IN   airline_details.ticket_fare%TYPE
)IS
BEGIN
    INSERT INTO airline_details VALUES(
        flight_no,
        airline,
        source,
        destination,
        departure_time,
        arrival_time,
        ticket_class,
        ticket_fare
    );

END;
/

Make sure the table airline_details is present is the current schema or you are using the schema name before the table name, for example, schema_in_which_table_is_present.tablename .

And for this error

begin
  airline('PK-710', 'PIA', 'ISB', 'KHI', '10:00 AM', '12:00 AM', 'Economy', 85000);
end;
/

Try recompiling procedure with corrections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM