4

This question might seem to be a possible duplicate of How to print values in the loop. Even though the particular link contains a good solution it, doesn't seems to work for me. This is the core part of the stored procedure that I've written.

BEGIN 
FOR i IN 1..10 LOOP
    RAISE NOTICE 'i is %',i;
END LOOP;
RETURN; 
END; 

While executing the procedure I'm always getting the result as

No rows found.

Total runtime: 1.787 ms

SQL executed.

Can someone tell me how to print the value of i? The postgresql version that I'm using is 8.4. Any help is greatly appreciated.

2
  • Please show us the real code, not something else. Using DO, this example works perfectly (version9.4) Commented Jun 23, 2015 at 10:06
  • 1
    This is the code. What else do you need? Please clarify. I've very well explained in my question that I'm using postgresql version 8.4. So a working code in the upgraded version doesn't seems to be helpful to me. Commented Jun 23, 2015 at 12:00

1 Answer 1

4

The code looks well. There are few possibilities:

  • your client doesn't show asynchronous messages correctly
  • you have higher client_min_messages than notice- can be changed by command:

    SET client_min_messages TO notice;
    

  • you are looking to wrong window - Server messages are shown in other window than result usually. In pgAdmin, you have to choose a tab Messages

Sign up to request clarification or add additional context in comments.

1 Comment

Pavel, Thank you so much. It is showing up in the messages tab in the pgAdmin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy 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.