0

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.

enter image description here

askedOct 16 at 5:02
MAK's user avatar
7
  • Do basic select queries work? Are you calling this code from Java?CommentedOct 16 at 5:17
  • @TimBiegeleisen, Yes basic select queries works fine and I'm not calling this code out of dbeaver yet.CommentedOct 16 at 5:19
  • Try using:for i in (select id from public.employee) ... that is, wrap the select in parentheses.CommentedOct 16 at 5:26
  • @TimBiegeleisen, Yes I did tried but no luck. Updated question with this approach too with screenshot.CommentedOct 16 at 5:31
  • 1
    Take a look here:hevodata.com/learn/redshift-sql-clientsCommentedOct 16 at 13:58

0

Know someone who can answer? Share a link to thisquestion viaemail,Twitter, orFacebook.

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.