Your code cannot give the result you want, because your calling procedure (SPADDINSTITUTION) is failing to consume the result set returned by SPSYSTEMMESSAGE.
This is frequently asked, and you can find samples if you research.
Opening a cursor in the nested sproc is not enough, the calling sproc must consume the result-set.
Learn about these statements, all of which must appear in your calling procedure:
You have not explained how exactly the caller procedure should act on the result set, but that is a separate matter from consuming the result set.
You might want to pipeline the fetched result-set rows (one by one, with the PIPE()
statement) to pass to the client program, we don't know, as you have not made it clear.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…