471,873 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

postgress [42883]: ERROR

i tried create storeprocedure in postgress 13, when i set up with parameter and call. there is some error 42883

CREATE OR REPLACE PROCEDURE public.logavlunit(pavl_unit_id character varying, pvehicle_id integer, pvehicle_number character varying, pregistration_number character varying, pdevice_type smallint, pserver_port integer, pserver_address character varying DEFAULT NULL::character varying(50))
LANGUAGE plpgsql
AS $procedure$

v_LogId int;
v_RegistrationNumber varchar(50);
v_VehicleId int;
v_VehicleNumber varchar(50);
v_DeviceType smallint;
v_DateTime timestamp(3);

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=pavl_unit_id AND existing=1;

IF v_VehicleId = pvehicle_id AND v_VehicleNumber = pvehicle_number AND v_RegistrationNumber = pregistration_number AND v_DeviceType = pdevice_type
UPDATE avl_unit_log
SET last_report_time=v_DateTime, server_port=pserver_port, server_address=pserver_address
WHERE id=v_LogId;
UPDATE avl_unit_log SET existing=0
WHERE avl_unit_id=pavl_unit_id AND existing=1;
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 (pavl_unit_id, pvehicle_id, pvehicle_number, pregistration_number,
pdevice_type, v_DateTime, v_DateTime, pserver_port, pserver_address, 1);

CALL public.logavlunit('354018111122143',34637914,'TM10 ','19.232529.7',5000,60109,null)
Jul 26 '21 #1
0 3140

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Greg Lindstrom | last post: by
1 post views Thread by Liza | last post: by
5 posts views Thread by Enos Meroka | last post: by
2 posts views Thread by Gregory | last post: by
7 posts views Thread by p | last post: by
67 posts views Thread by Bob Powell | last post: by
1 post views Thread by Praveen | last post: by
3 posts views Thread by Manuel | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.