28 lines
682 B
MySQL
28 lines
682 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`orderCreate`(
|
||
|
vLanded DATE,
|
||
|
vAgencyMode INT,
|
||
|
vAddress INT,
|
||
|
vSourceApp VARCHAR(10),
|
||
|
OUT vOrderId INT)
|
||
|
BEGIN
|
||
|
|
||
|
DECLARE vDeliveryMethod INT;
|
||
|
DECLARE vClient INT;
|
||
|
|
||
|
SELECT deliveryMethodFk INTO vDeliveryMethod
|
||
|
FROM vn.agencyMode
|
||
|
WHERE id = vAgencyMode;
|
||
|
|
||
|
SELECT clientFk INTO vClient
|
||
|
FROM vn.address
|
||
|
WHERE id = vAddress;
|
||
|
|
||
|
INSERT INTO hedera.order(date_send,customer_id,delivery_method_id,agency_id,address_id,source_app)
|
||
|
VALUES( vLanded,vClient ,vDeliveryMethod,vAgencyMode ,vAddress ,vSourceApp);
|
||
|
|
||
|
SET vOrderId = LAST_INSERT_ID();
|
||
|
|
||
|
END$$
|
||
|
DELIMITER ;
|