Reputation: 1
UPDATED
I've written the following function and it is created successfully. But when I go to call it, an error pops up. I'm just learning how to use functions in Postgres, and I am confused here.
create function change_data_type()
returns void
language plpgsql
as
$$
declare
begin
alter table summary_table
alter column average_cost set data type decimal (3,2),
alter column average_total set data type decimal(6,2);
return;
end;
$$;
The error message is as follows;
ERROR: column "decimal" does not exist LINE 1: decimal ^ QUERY: decimal CONTEXT: PL/pgSQL function change_data_type() line 10 at RETURN SQL state: 42703
I've tried changing the return value to the specific column names, but it also returns an error. What am I missing here?
Upvotes: 0
Views: 151