maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_rw_movdevacc(character varying, character varying, integer)
Parameters
Name
Type
Mode
in_serialnumber
character varying
IN
in_erpid
character varying
IN
in_idproduct
integer
IN
Definition
/* To move one device from one account to another*/ DECLARE _idtechnicalaccount int; BEGIN /* Find the technicalaccount appropriate for the given product*/ SELECT t.idtechnicalaccount INTO _idtechnicalaccount FROM technicalaccount t JOIN client c ON c.idclient = t.idclient WHERE t.idproduct = in_idproduct AND c.erpid = in_erpid AND t.enabled = true; IF FOUND THEN UPDATE device SET idtechnicalaccount = _idtechnicalaccount, status = 1, enabled = true WHERE serialnumber = in_serialnumber; RETURN true; ELSE RAISE WARNING 'No appropriate technicalaccount found'; END IF; RETURN false; END;