diff --git a/pkg/src/ctsql/pl/executor/pl_lines_executor.c b/pkg/src/ctsql/pl/executor/pl_lines_executor.c index 5eb590208dbb00defd3f3ce224e51d176c5efc98..1d81e628dd458347546fe169a6c5e083c0ef2498 100644 --- a/pkg/src/ctsql/pl/executor/pl_lines_executor.c +++ b/pkg/src/ctsql/pl/executor/pl_lines_executor.c @@ -1499,6 +1499,17 @@ status_t ple_open(ple_line_assist_t *line_ass) exec->recent_rows = sub_stmt->total_rows; sub_stmt->cursor_info.sql_executed = CT_TRUE; + if (sub_stmt->cursor_info.param_buf == NULL && exec->curr_input != NULL) { + if (ple_keep_input(sub_stmt, exec, (void *)exec->curr_input, exec->is_dyncur) != CT_SUCCESS) { + sql_free_stmt(sub_stmt); + ref_cursor->stmt_id = CT_INVALID_ID16; + ple_free_ref_cursor(ref_cursor); + var->value.v_cursor.ref_cursor = NULL; + PLE_RESTORE_STMT(stmt); + return CT_ERROR; + } + } + // sql is reparsed, sub stmt's context is changed if (ple_check_substmt_ctx(sub_stmt, save_ctx)) { // set procedure/function status to invalid