-1

我在 mysql 中创建函数,这是我的函数

如果存在则删除函数 cta_db_raillink_02.sf_booking; 创建函数 cta_db_raillink_02。sf_booking( p_org varchar(5), p_des varchar(5), p_depart date, p_train_no varchar(15), --trip no p_num_pax_adult int, p_num_pax_child int, p_subkelas varchar(1), p_caller varchar(30), p_adult_nm varchar(100), p_adult_birtdate varchar(100)、p_adult_mobile varchar(30)、p_adult_id_no varchar(20)、p_child_nm varchar(100)、p_child_birth varchar(100)、p_rqid varchar(50)) 返回 bigint(20) BEGIN

  --  transaction variable
  DECLARE l_org                  varchar(5);
  DECLARE l_des                  varchar(5);
  DECLARE l_depart_date          date;
  DECLARE l_train_no             varchar(20);
  DECLARE l_pax_num              bigint(20);
  DECLARE l_booking_no           varchar(6);
  DECLARE l_kelas_id             int(11);
  DECLARE l_subkelas_id          int(11);
  DECLARE l_channel_id           int(11);
  DECLARE l_count_pax            int(11);
  DECLARE l_trip_no              varchar(6);
  DECLARE l_vehicle_id           bigint(20);
  DECLARE l_vehicle_no           varchar(15);
  DECLARE l_vehicle_nm           varchar(50);
  DECLARE l_operations_day       bigint(11);
  DECLARE l_effective_from       date;
  DECLARE l_effective_to         date;
  DECLARE l_pub_sch_id           bigint(11);
  DECLARE l_pub_sch_dtl_id       bigint(11);
  DECLARE l_arrival_date         date;
  DECLARE l_etd                  time;
  DECLARE l_eta                  time;
  DECLARE l_stations_id_ori      bigint(20);
  DECLARE l_stations_id_dest     bigint(20);
  DECLARE l_originations_label   varchar(5);
  DECLARE l_originations_nm      varchar(50);
  DECLARE l_destinations_label   varchar(5);
  DECLARE l_destinations_nm      varchar(50);
  DECLARE l_jarak_tempuh         int(11);
  DECLARE l_waktu_tempuh         int(11);
  DECLARE l_schedule_desc        text;
  DECLARE l_kelas_code           varchar(2);
  DECLARE l_subkelas_code        varchar(2);
  DECLARE l_trans_hold_id        bigint(20);
  DECLARE l_last_row_fetched     int;
  DECLARE l_trans_date           date;
  DECLARE l_pax_adult_nm         varchar(100);
  DECLARE l_adult_birthdate      varchar(100);
  DECLARE l_adult_mobile         varchar(100);
  DECLARE l_adult_id_no          varchar(100);
  DECLARE l_child_nm             varchar(100);
  DECLARE l_child_birth          varchar(100);
  DECLARE l_auto_seat_id         bigint(20);
  DECLARE l_coach_id             bigint(20);
  DECLARE l_coach_code           varchar(10);
  DECLARE l_coach_nm             varchar(50);
  DECLARE l_coach_seq            int(11);
  DECLARE l_seat_str_row         int(11);
  DECLARE l_seat_str_col         int(11);
  DECLARE l_seat_str_label       int(11);

  DECLARE l_trans_id             bigint(20);

  --  Passenger variable
  DECLARE l_pax_id               int(11);
  DECLARE l_pax_type_id          bigint(20);
  DECLARE l_pax_no_id                     varchar(20);
  DECLARE l_pax_title                     varchar(10);
  DECLARE l_pax_first_name                varchar(50);
  DECLARE l_pax_last_name                 varchar(50);
  DECLARE l_pax_birthday                  date;
  DECLARE l_pax_address_1                 varchar(255);
  DECLARE l_pax_address_2                 varchar(255);
  DECLARE l_pax_phone_home                varchar(20);
  DECLARE l_pax_phone_mobile              varchar(20);
  DECLARE l_pax_email                     varchar(60);
  DECLARE l_pax_codezip                   varchar(10);
  DECLARE l_pax_desc                      text;


  DECLARE i int;
  DECLARE j int;
  DECLARE
     trip_choice_cur CURSOR FOR
     SELECT    a.trip_no,
               b.vehicle_id,
               b.vehicle_no,
               b.vehicle_nm,
               b.operations_day,
               b.effective_from,
               b.effective_to,
               b.pub_sch_id,
               a.pub_sch_dtl_id,
               a.depart_date,
               a.arrival_date,
               a.etd,
               a.eta,
               a.stations_id_ori   ,
               a.stations_id_dest  ,
               a.originations_label,
               a.originations_nm   ,
               a.destinations_label,
               a.destinations_nm   ,
               a.jarak_tempuh      ,
               a.waktu_tempuh      ,
               a.schedule_desc
      FROM     pub_sch_detail a, pub_sch b
      WHERE
               a.pub_sch_id=b.pub_sch_id
      AND      a.depart_date BETWEEN b.effective_from AND b.effective_to
      AND      a.originations_label = p_org
      AND      a.destinations_label = p_des
      AND      a.trip_no = p_train_no
      AND      depart_date = p_depart
      ORDER BY a.etd;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET l_last_row_fetched=1;

  SET l_last_row_fetched = 0;

  OPEN trip_choice_cur;

 trip_choice_loop:
  LOOP
     FETCH trip_choice_cur
        INTO   l_trip_no,
               l_vehicle_id,
               l_vehicle_no,
               l_vehicle_nm,
               l_operations_day,
               l_effective_from,
               l_effective_to,
               l_pub_sch_id,
               l_pub_sch_dtl_id,
               l_depart_date,
               l_arrival_date,
               l_etd,
               l_eta,
               l_stations_id_ori,
               l_stations_id_dest,
               l_originations_label,
               l_originations_nm,
               l_destinations_label,
               l_destinations_nm,
               l_jarak_tempuh,
               l_waktu_tempuh,
               l_schedule_desc;

     IF l_last_row_fetched = 1
     THEN
        LEAVE trip_choice_loop;
     END IF;
  END LOOP;

  CLOSE trip_choice_cur;

  SET l_last_row_fetched = 0;

  SET l_booking_no = sf_get_booking_no(6);
  SET l_kelas_id   = sf_get_kelas_id(p_subkelas);
  SET l_kelas_code = sf_get_kelas_code(p_subkelas);
  SET l_subkelas_id = sf_get_subkelas_id(p_subkelas);
  SET l_subkelas_code = sf_get_subkelas_code(p_subkelas);
  SET l_channel_id = sf_get_channel_id(p_rqid);
  SET l_count_pax  = p_num_pax_adult + p_num_pax_child;
  SET l_trans_date = sysdate();

  CALL transactions_hold_add(NULL, -- in p_COACH_ID bigint(20),
                             l_trans_date, -- in p_TRANS_HOLD_DATE datetime,
                             l_booking_no, -- in p_BOOKING_NO varchar(20),
                             p_train_no, -- in p_TRIP_NO varchar(6),
                             l_pub_sch_id, -- in p_PUB_SCH_ID bigint(20),
                             l_channel_id, -- in p_CHANNEL_ID int(11),
                             l_vehicle_id, -- in p_VEHICLE_ID bigint(20),
                             l_vehicle_no, -- in p_VEHICLE_NO varchar(15),
                             l_vehicle_nm, -- in p_VEHICLE_NM varchar(50),
                             NULL, -- in p_COACH_CODE varchar(10),
                             NULL, -- in p_COACH_NM varchar(50),
                             l_stations_id_ori, -- in p_STATIONS_ID_ORI bigint(20),
                             l_stations_id_dest, -- in p_STATIONS_ID_DEST bigint(20),
                             l_originations_label, -- in p_ORIGINATIONS_LABEL varchar(5),
                             l_originations_nm, -- in p_ORIGINATIONS_NM varchar(50),
                             l_destinations_label, -- in p_DESTINATIONS_LABEL varchar(5),
                             l_destinations_nm, -- in p_DESTINATIONS_NM varchar(50),
                             p_depart, -- in p_DEPART_DATE datetime,
                             l_arrival_date, -- in p_ARRIVED_DATE datetime,
                             l_etd, -- in p_ETD time,
                             l_eta, -- in p_ETA time,
                             l_kelas_id, -- in p_KELAS_ID int(11),
                             l_kelas_code, -- in p_KELAS_CODE varchar(2),
                             l_subkelas_id, -- in p_SUBKELAS_ID int(11),
                             l_subkelas_code, -- in p_SUBKELAS_CODE varchar(2),
                             'Mr/Mrs', -- in p_CONTACT_TITLE varchar(10),
                             p_caller, -- in p_CONTACT_FIRST_NAME varchar(50),
                             NULL, -- in p_CONTACT_LAST_NAME varchar(50),
                             NULL, -- in p_CONTACT_ADDRESS_1 varchar(255),
                             NULL, -- in p_CONTACT_ADDRESS_2 varchar(255),
                             NULL, -- in p_CONTACT_PHONE_HOME varchar(20),
                             NULL, -- in p_CONTACT_PHONE_MOBILE varchar(20),
                             NULL, -- in p_CONTACT_EMAIL varchar(60),
                             p_num_pax_adult, -- in p_JUMLAH_DEWASA int(11),
                             p_num_pax_child, -- in p_JUMLAH_ANAK int(11),
                             0, -- in p_JUMLAH_INFANT int(11),
                             (p_num_pax_adult + p_num_pax_child) * 80000, -- in p_BALANCE decimal(12,2),
                             'N', -- in p_IS_CANCEL char(1),
                             NULL, -- in p_CANCEL_REASON text,
                             'R' -- in p_IS_STATUS char(1)
                                );

  SELECT trans_hold_id
  INTO   l_trans_hold_id
  FROM   transactions_hold
  WHERE  booking_no = l_booking_no;

  IF l_count_pax >= 1
  THEN
     IF p_num_pax_adult >= 1 -- [for adult passenger]
     THEN
        SET i            = 1;

       loop1:
        WHILE i <= p_num_pax_adult
        DO
           SET l_pax_adult_nm = sf_split_string(p_adult_nm, ',', i);
           SET l_adult_birthdate =
                  sf_split_string(p_adult_birtdate, ',', i);
           SET l_adult_mobile = sf_split_string(p_adult_mobile, ',', i);
           SET l_adult_id_no = sf_split_string(p_adult_id_no, ',', i);
           SET l_auto_seat_id =
                  sf_auto_seat_id(p_org,
                                  p_des,
                                  p_train_no,
                                  p_depart,
                                  p_num_pax_adult,
                                  p_num_pax_child,
                                  p_subkelas);

           IF l_auto_seat_id IS NOT NULL
           THEN
              SELECT coach_id,
                     coach_code,
                     coach_nm,
                     coach_seq,
                     seat_str_row,
                     seat_str_col,
                     seat_str_label
              INTO   l_coach_id,
                     l_coach_code,
                     l_coach_nm,
                     l_coach_seq,
                     l_seat_str_row,
                     l_seat_str_col,
                     l_seat_str_label
              FROM   seat_avail
              WHERE  seat_avail_id = l_auto_seat_id;
           END IF;


           -- pax data insert (adult passenger)
           CALL pax_add(1, -- in p_PAX_TYPE_ID int(11), 1=adult,2=child,3=infant
                        l_adult_id_no, -- in p_PAX_NO_ID varchar(20),
                        'Mr/Mrs', -- in p_PAX_TITLE varchar(10),
                        l_pax_adult_nm, -- in p_PAX_FIRST_NAME varchar(50),
                        NULL, -- in p_PAX_LAST_NAME varchar(50),
                        l_adult_birthdate, -- in p_PAX_BIRTHDAY date,
                        NULL, -- in p_PAX_ADDRESS_1 varchar(255),
                        NULL, -- in p_PAX_ADDRESS_2 varchar(255),
                        NULL, -- in p_PAX_PHONE_HOME varchar(20),
                        NULL, -- in p_PAX_PHONE_MOBILE varchar(20),
                        NULL, -- in p_PAX_EMAIL varchar(60),
                        NULL, -- in p_PAX_CODEZIP varchar(10),
                        NULL, -- in p_PAX_DESC text,
                        l_trans_date, -- in p_INSERT_DATE datetime,
                        NULL, -- in p_INSERT_USER_ID int(11),
                        l_trans_date, -- in p_UPDATE_DATE datetime,
                        NULL, -- in p_UPDATE_USER_ID int(11)
                        @last_id);

           SET l_pax_id     = @last_id;

           SELECT pax_no_id,
                  pax_title,
                  pax_first_name,
                  pax_last_name,
                  pax_birthday,
                  pax_address_1,
                  pax_address_2,
                  pax_phone_home,
                  pax_phone_mobile,
                  pax_email,
                  pax_codezip,
                  pax_desc
           INTO   l_pax_no_id,
                  l_pax_title,
                  l_pax_first_name,
                  l_pax_last_name,
                  l_pax_birthday,
                  l_pax_address_1,
                  l_pax_address_2,
                  l_pax_phone_home,
                  l_pax_phone_mobile,
                  l_pax_email,
                  l_pax_codezip,
                  l_pax_desc
           FROM   pax
           WHERE  pax_id = l_pax_id;

           -- transactions add

           CALL transactions_add(
                                 l_booking_no, -- in p_BOOKING_NO varchar(20),
                                 p_train_no, -- in p_TRIP_NO varchar(6)
                                 l_auto_seat_id, -- in p_SEAT_AVAIL_ID bigint(20),
                                 l_pax_id, -- in p_PAX_ID bigint(20),
                                 l_trans_hold_id, -- in p_TRANS_HOLD_ID bigint(20),
                                 NULL, -- in p_BANK_ID int(11),
                                 NULL, -- in p_PAY_TYPE_ID int(11),
                                 NULL, -- in p_FARES_ID bigint(20),
                                 NULL, -- in p_PAX_TYPE_ID int(11),
                                 l_trans_date, -- in p_TRANS_DATE datetime,
                                 l_pub_sch_id, --         p_PUB_SCH_ID,
                                 l_pub_sch_dtl_id, --         p_PUB_SCH_DTL_ID,
                                 NULL, --         p_PUB_SCH_STANFORM_ID,
                                 NULL, -- in p_PAYMENT_NO varchar(20),
                                 NULL, -- in p_PAYMENT_TYPE_CODE varchar(10),
                                 l_vehicle_id, -- in p_VEHICLE_ID bigint(20),
                                 l_vehicle_no, -- in p_VEHICLE_NO varchar(15),
                                 l_vehicle_nm, -- in p_VEHICLE_NM varchar(50),
                                 l_coach_id, --         p_COACH_ID,
                                 l_coach_code, --         p_COACH_CODE,
                                 l_coach_nm, --         p_COACH_NM,
                                 l_coach_seq, -- in p_COACH_SEQ int(11),
                                 l_seat_str_row, -- in p_SEAT_STR_ROW int(11),
                                 l_seat_str_col, -- in p_SEAT_STR_COL int(11),
                                 l_seat_str_label, -- in p_SEAT_STR_LABEL int(11),
                                 l_eta, -- in p_ETA time,
                                 l_etd, -- in p_ETD time,
                                 l_kelas_id, -- in p_KELAS_ID int(11),
                                 l_subkelas_id, -- in p_SUBKELAS_ID int(11),
                                 p_depart, -- in p_DEPART_DATE datetime,
                                 l_arrival_date, -- in p_ARRIVAL_DATE datetime,
                                 l_stations_id_ori, -- in p_STATIONS_ID_ORI bigint(20),
                                 l_stations_id_dest, -- in p_STATIONS_ID_DEST bigint(20),
                                 l_originations_label, --  in p_ORIGINATIONS_LABEL varchar(5),
                                 l_originations_nm, -- in p_ORIGINATIONS_NM varchar(50),
                                 l_destinations_label, -- in p_DESTINATIONS_LABEL varchar(5),
                                 l_destinations_nm, -- in p_DESTINATIONS_NM varchar(50),
                                 l_pax_title, -- in p_PAX_TITLE varchar(10),
                                 l_pax_first_name, -- in p_PAX_FIRST_NAME varchar(50),
                                 l_pax_last_name, -- in p_PAX_LAST_NAME varchar(50),
                                 l_pax_phone_home, -- in p_PHONE_HOME varchar(20),
                                 l_pax_phone_mobile, -- in p_PHONE_MOBILE varchar(20),
                                 NULL, -- in p_DESC_TRANS text,
                                 NULL, -- in p_IS_CANCEL char(1),
                                 NULL, -- in p_CANCEL_REASON text,
                                 'R', -- in p_BOOK_STATUS char(1),
                                 'N', -- in p_IS_PRINTING char(1),
                                 NULL, -- in p_PRINT_COUNT int(11),
                                 @last_trans_id);
           SET i            = i + 1;
           SET l_trans_id   = @last_trans_id;
           CALL transactions_activity_add(l_trans_id, -- in p_TRANS_ID bigint(20),
                                          sysdate(), -- in p_TRANS_DTL_DATE datetime,
                                          'RESERVE BOOKING', -- in p_TRANS_DTL_DESC text,
                                          'R', -- in p_IS_STATUS char(1),
                                          NULL, -- in p_CANCEL_REASON text,
                                          sysdate(), -- in p_INSERT_DATE datetime,
                                          l_channel_id, -- in p_INSERT_USER_ID int(11),
                                          NULL, -- in p_UPDATE_DATE datetime,
                                          NULL -- in p_UPDATE_USER_ID int(11)
                                              );
        END WHILE loop1;
     END IF;

     IF p_num_pax_child >= 1 --  for child passenger
     THEN
        SET j            = 1;

       loop2:
        WHILE j <= p_num_pax_child
        DO
           SET l_child_nm   = sf_split_string(p_child_nm, ',', j);
           SET l_child_birth = sf_split_string(p_child_birth, ',', j);

           SET l_auto_seat_id =
                  sf_auto_seat_id(p_org,
                                  p_des,
                                  p_train_no,
                                  p_depart,
                                  p_num_pax_adult,
                                  p_num_pax_child,
                                  p_subkelas);

           IF l_auto_seat_id IS NOT NULL
           THEN
              SELECT coach_id,
                     coach_code,
                     coach_nm,
                     coach_seq,
                     seat_str_row,
                     seat_str_col,
                     seat_str_label
              INTO   l_coach_id,
                     l_coach_code,
                     l_coach_nm,
                     l_coach_seq,
                     l_seat_str_row,
                     l_seat_str_col,
                     l_seat_str_label
              FROM   seat_avail
              WHERE  seat_avail_id = l_auto_seat_id;
           END IF;

           -- pax data insert (child passenger)
           CALL pax_add(2, -- in p_PAX_TYPE_ID int(11), 1=adult,2=child,3=infant
                        NULL, -- in p_PAX_NO_ID varchar(20),
                        NULL, -- in p_PAX_TITLE varchar(10),
                        l_child_nm, -- in p_PAX_FIRST_NAME varchar(50),
                        NULL, -- in p_PAX_LAST_NAME varchar(50),
                        l_child_birth, -- in p_PAX_BIRTHDAY date,
                        NULL, -- in p_PAX_ADDRESS_1 varchar(255),
                        NULL, -- in p_PAX_ADDRESS_2 varchar(255),
                        NULL, -- in p_PAX_PHONE_HOME varchar(20),
                        NULL, -- in p_PAX_PHONE_MOBILE varchar(20),
                        NULL, -- in p_PAX_EMAIL varchar(60),
                        NULL, -- in p_PAX_CODEZIP varchar(10),
                        NULL, -- in p_PAX_DESC text,
                        l_trans_date, -- in p_INSERT_DATE datetime,
                        NULL, -- in p_INSERT_USER_ID int(11),
                        l_trans_date, -- in p_UPDATE_DATE datetime,
                        NULL, -- in p_UPDATE_USER_ID int(11)
                        @last_id);

           SET l_pax_id     = @last_id;

           SELECT pax_no_id,
                  pax_title,
                  pax_first_name,
                  pax_last_name,
                  pax_birthday,
                  pax_address_1,
                  pax_address_2,
                  pax_phone_home,
                  pax_phone_mobile,
                  pax_email,
                  pax_codezip,
                  pax_desc
           INTO   l_pax_no_id,
                  l_pax_title,
                  l_pax_first_name,
                  l_pax_last_name,
                  l_pax_birthday,
                  l_pax_address_1,
                  l_pax_address_2,
                  l_pax_phone_home,
                  l_pax_phone_mobile,
                  l_pax_email,
                  l_pax_codezip,
                  l_pax_desc
           FROM   pax
           WHERE  pax_id = l_pax_id;

           CALL transactions_add(l_booking_no, -- in p_BOOKING_NO varchar(20),
                                 p_train_no, -- in p_TRIP_NO varchar(6)
                                 l_auto_seat_id, -- in p_SEAT_AVAIL_ID bigint(20),
                                 l_pax_id, -- in p_PAX_ID bigint(20),
                                 l_trans_hold_id, -- in p_TRANS_HOLD_ID bigint(20),
                                 NULL, -- in p_BANK_ID int(11),
                                 NULL, -- in p_PAY_TYPE_ID int(11),
                                 NULL, -- in p_FARES_ID bigint(20),
                                 NULL, -- in p_PAX_TYPE_ID int(11),
                                 l_trans_date, -- in p_TRANS_DATE datetime,
                                 l_pub_sch_id, --         p_PUB_SCH_ID,
                                 l_pub_sch_dtl_id, --         p_PUB_SCH_DTL_ID,
                                 NULL, --  in p_PUB_SCH_STANFORM_ID,
                                 NULL, -- in p_PAYMENT_NO varchar(20),
                                 NULL, -- in p_PAYMENT_TYPE_CODE varchar(10),
                                 l_vehicle_id, -- in p_VEHICLE_ID bigint(20),
                                 l_vehicle_no, -- in p_VEHICLE_NO varchar(15),
                                 l_vehicle_nm, -- in p_VEHICLE_NM varchar(50),
                                 l_coach_id, --         p_COACH_ID,
                                 l_coach_code, --         p_COACH_CODE,
                                 l_coach_nm, --         p_COACH_NM,
                                 l_coach_seq, -- in p_COACH_SEQ int(11),
                                 l_seat_str_row, -- in p_SEAT_STR_ROW int(11),
                                 l_seat_str_col, -- in p_SEAT_STR_COL int(11),
                                 l_seat_str_label, -- in p_SEAT_STR_LABEL int(11),
                                 l_eta, -- in p_ETA time,
                                 l_etd, -- in p_ETD time,
                                 l_kelas_id, -- in p_KELAS_ID int(11),
                                 l_subkelas_id, -- in p_SUBKELAS_ID int(11),
                                 p_depart, -- in p_DEPART_DATE datetime,
                                 l_arrival_date, -- in p_ARRIVAL_DATE datetime,
                                 l_stations_id_ori, -- in p_STATIONS_ID_ORI bigint(20),
                                 l_stations_id_dest, -- in p_STATIONS_ID_DEST bigint(20),
                                 l_originations_label, --  in p_ORIGINATIONS_LABEL varchar(5),
                                 l_originations_nm, -- in p_ORIGINATIONS_NM varchar(50),
                                 l_destinations_label, -- in p_DESTINATIONS_LABEL varchar(5),
                                 l_destinations_nm, -- in p_DESTINATIONS_NM varchar(50),
                                 l_pax_title, -- in p_PAX_TITLE varchar(10),
                                 l_pax_first_name, -- in p_PAX_FIRST_NAME varchar(50),
                                 l_pax_last_name, -- in p_PAX_LAST_NAME varchar(50),
                                 l_pax_phone_home, -- in p_PHONE_HOME varchar(20),
                                 l_pax_phone_mobile, -- in p_PHONE_MOBILE varchar(20),
                                 NULL, -- in p_DESC_TRANS text,
                                 NULL, -- in p_IS_CANCEL char(1),
                                 NULL, -- in p_CANCEL_REASON text,
                                 'R', -- in p_BOOK_STATUS char(1),
                                 'N', -- in p_IS_PRINTING char(1),
                                 NULL, -- in p_PRINT_COUNT int(11),
                                 @last_trans_id);
           SET j            = j + 1;
           SET l_trans_id   = @last_trans_id;
           CALL transactions_activity_add(l_trans_id, -- in p_TRANS_ID bigint(20),
                                          sysdate(), -- in p_TRANS_DTL_DATE datetime,
                                          'RESERVE BOOKING', -- in p_TRANS_DTL_DESC text,
                                          'R', -- in p_IS_STATUS char(1),
                                          NULL, -- in p_CANCEL_REASON text,
                                          sysdate(), -- in p_INSERT_DATE datetime,
                                          l_channel_id, -- in p_INSERT_USER_ID int(11),
                                          NULL, -- in p_UPDATE_DATE datetime,
                                          NULL -- in p_UPDATE_USER_ID int(11)
                                              );
        END WHILE loop2;
     END IF;
  END IF;

  RETURN l_trans_hold_id; END;

但是当我运行这个函数时 - >select sf_booking('KLN','MDN','20131012','U15a',2,1,'A','jonie','ivhas,gavas','19900302,19901002','0815123456,08349857345','U77783,K77234','ronas','20100606','5EB9FE68-8915-11E0-BEA0-C9892766ECF2')它返回错误:

过程执行失败 1415 - 不允许从函数返回结果集

有什么建议吗?之前谢谢...

4

1 回答 1

0

您不能从 MySQL 中的存储函数返回结果集,我在这里看不到发生这种情况...但是您正在尝试CALL从该函数内部执行多个存储过程...这意味着这些过程以及它们调用的任何过程, 也不允许返回结果集,因为这最终会导致此函数返回结果集......这是你做不到的。

根据这段代码的复杂性和它的表现,这可能应该被写成一个存储过程本身,这样可以避免整个问题。

于 2013-09-21T22:01:04.187 回答