Create Store Procedure and call , but return error
CREATE OR REPLACE PROCEDURE logavlunit(
p_avl_unit_id varchar(20),
p_vehicle_id int4,
p_vehicle_number varchar(10),
p_registration_number varchar(16),
p_device_type int2,
p_server_port int4,
p_server_address character varying DEFAULT NULL::varchar(50))
LANGUAGE plpgsql AS
$$
DECLARE
v_LogId int;
v_RegistrationNumber varchar(50);
v_VehicleId int;
v_VehicleNumber varchar(50);
v_DeviceType smallint;
v_DateTime timestamp(3);
BEGIN
v_DateTime := NOW();
SELECT id, registration_number, vehicle_id, vehicle_number, device_type INTO v_LogId, v_RegistrationNumber, v_VehicleId, v_VehicleNumber, v_DeviceType
FROM avl_unit_log
WHERE avl_unit_id=p_avl_unit_id AND existing=1;
IF v_VehicleId = p_vehicle_id AND v_VehicleNumber = p_vehicle_number AND v_RegistrationNumber = p_registration_number AND v_DeviceType = p_device_type
THEN
UPDATE avl_unit_log
SET last_report_time=v_DateTime, server_port=p_server_port, server_address=p_server_address
WHERE id=v_LogId;
ELSE
IF v_LogId IS NOT NULL
THEN
UPDATE avl_unit_log SET existing=0
WHERE avl_unit_id=p_avl_unit_id AND existing=1;
END IF;
INSERT INTO avl_unit_log (avl_unit_id, vehicle_id, vehicle_number, registration_number,
device_type, first_report_time, last_report_time, server_port, server_address, existing)
VALUES (p_avl_unit_id, p_vehicle_id, p_vehicle_number, p_registration_number,
p_device_type, v_DateTime, v_DateTime, p_server_port, p_server_address, 1);
END IF;
END
$$;
CALL public.logavlunit('354018111122143',34637914,'TM10','19.232529.7',5000,60109,'localhost')
but received error when call the store procedure
SQL Error [42883]: ERROR: procedure public.logavlunit(unknown, integer, unknown, unknown, integer, integer, unknown) does not exist
Hint: No procedure matches the given name and argument types. You might need to add explicit type casts.