I'm getting a SQL error when trying to declare a variable in Postgresql. Check out my code below:
declare number int8;
begin
select ID into number from public.People p where p."Name" = 'Jeff';
if found then
insert into public.Friends ("PeopleID", "Name", "PhoneNumber")
values (number, 'Jeff', '205-123-4567')
end if;
end;
When I try and run this, it returns this exception:
SQL Error [42601]: ERROR: syntax error at or near "int8"
I'm expecting there to be only one entry with the name "Jeff", so I won't have to worry about having more than one possible value for "number".