I am facing an issue when I try to run my procudere. I have a table where I have all values stored in text format and try to convert to int or timestamp
CREATE OR REPLACE PROCEDURE public.textnummerictest(
)
LANGUAGE 'sql'
AS $BODY$
create or replace procedure textnummerictest()
language plpgsql
as $$
begin
insert into sensorhistory_test(
datetime,
sensorid )
select from sensorhistory_temp (
cast(sensorid as integer),
datetime::timestamp )
end; $$
$BODY$;
ALTER PROCEDURE public.textnummerictest()
OWNER TO postgres;
Always getting the error Syntaxerror near end.
Any help really appreciated
create or replaceinside anothercreate or replace$BODY$and then remove the final$BODY$as well.;at the end of the INSERT. And your procedure doesn't have a variable or parameter namedsensoridordatetime. Andselect from ..should beselect * from ...as well.