I am trying to usefor loop within thestored procedure to retrieve the employee id and process further but getting an error:
Error:SQL Error: Internal jdbc driver error
Procedure:
create or replace procedure public.for_loop_test()language plpgsqlas $$declare i record;begin for i in select id from public.employee loop raise info 'Values-%',i.id; end loop;end;$$;Procedure call:
call public.for_loop_test();Note: Using DBeaver tool for the development.
Tried using parentheses but no luck.
- Do basic select queries work? Are you calling this code from Java?Tim Biegeleisen– Tim Biegeleisen2025-10-16 05:17:14 +00:00CommentedOct 16 at 5:17
- @TimBiegeleisen, Yes basic select queries works fine and I'm not calling this code out of dbeaver yet.MAK– MAK2025-10-16 05:19:34 +00:00CommentedOct 16 at 5:19
- Try using:
for i in (select id from public.employee)... that is, wrap the select in parentheses.Tim Biegeleisen– Tim Biegeleisen2025-10-16 05:26:57 +00:00CommentedOct 16 at 5:26 - @TimBiegeleisen, Yes I did tried but no luck. Updated question with this approach too with screenshot.MAK– MAK2025-10-16 05:31:43 +00:00CommentedOct 16 at 5:31
- 1Take a look here:hevodata.com/learn/redshift-sql-clientsTim Biegeleisen– Tim Biegeleisen2025-10-16 13:58:04 +00:00CommentedOct 16 at 13:58
Related questions
Related questions

