Passing output to the buffer and suspending execution while waiting for caller to fetch it

    Available in

    PSQL

    The SUSPEND statement is used in a selectable stored procedure to pass the values of output parameters to a buffer and suspend execution. Execution remains suspended until the calling application fetches the contents of the buffer. Execution resumes from the statement directly after the SUSPEND statement. In practice, this is likely to be a new iteration of a looping process.

    Example

    Using the SUSPEND statement in a selectable procedure:

    1. CREATE PROCEDURE GEN_100
    2. RETURNS (
    3. )
    4. AS
    5. BEGIN
    6. WHILE (1=1) DO
    7. SUSPEND;
    8. IF (I=100) THEN
    9. EXIT;
    10. I = I + 1;
    11. END

    See also