I am newbie to PostgreSQL and getting below error while updating table in PostgreSQL.
ERROR: invalid input syntax for type integer: "@vendortypeid"
LINE 2: set vendortypeid = '@vendortypeid',
^
QUERY: update public.vendormaster vm
set vendortypeid = '@vendortypeid',
email = '@email', misbapsid = '@misbapsid', businessname = '@businessname', taxid = '@taxid',
primarycontactname = '@primarycontactname', primarycontactemail = '@primarycontactemail', additionalname = '@additionalname',
primaryaddress1 = '@primaryaddress1', primaryaddress2 = '@primaryaddress2', primarycountryid = '@primarycountryid',
primarystateid = '@primarystateid', primaryzipcode = '@primaryzipcode', ischild = '@ischild', parentid = '@parentid',
isactive = '@isactive', mobileno = '@mobileno',
createdby='@createdby',createdon='@createdon', isdeleted='@isdeleted', deletedby='@deletedby', deletedon='@deletedon',
updatedby='@updatedby',updatedon='@updatedon', primarycityid = '@primarycityid', status = '@status'
where vm.vendorid = vendorids
CONTEXT: PL/pgSQL function insertorupdatevendormaster(bigint,integer,character,bigint,character,integer,character,character,character,character,character,integer,integer,integer,boolean,bigint,boolean,character,integer,date,boolean,integer,date,integer,date,integer,character) line 15 at SQL statement
SQL state: 22P02```
Thanks
CodePudding user response:
Single quotes denote string literals. If you're referring to arguments passed to the function, you should not surround them with quotes:
UPDATE PUBLIC.vendormaster vm
SET vendortypeid = @vendortypeid,
email = @email,
misbapsid = @misbapsid,
businessname = @businessname,
taxid = @taxid,
primarycontactname = @primarycontactname,
primarycontactemail = @primarycontactemail,
additionalname = @additionalname,
primaryaddress1 = @primaryaddress1,
primaryaddress2 = @primaryaddress2,
primarycountryid = @primarycountryid,
primarystateid = @primarystateid,
primaryzipcode = @primaryzipcode,
ischild = @ischild,
parentid = @parentid,
isactive = @isactive,
mobileno = @mobileno,
createdby = @createdby,
createdon = @createdon,
isdeleted = @isdeleted,
deletedby = @deletedby,
deletedon = @deletedon,
updatedby = @updatedby,
updatedon = @updatedon,
primarycityid = @primarycityid,
status = @status
WHERE vm.vendorid = vendorids