# `sp_cursor_test1` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

_No parameters._

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `sp_cursor_test1`'`._

## Narrative

**Business context:** Developer scratch — variant of `sp_cursor_test` repurposed for `eleteststandard` / `eleteststandarditem` (检测标准, quality-test standards). Renumbers each standard's child items by setting `iOrder` to a sequential counter — the classic "rebuild ordering" maintenance idiom.

**What it does:** Opens `cur1` over `SELECT DISTINCT sId FROM eleteststandard`, drives the loop with `CONTINUE HANDLER FOR NOT FOUND`. Per parent `sId`, sets `@i:=0` and runs `UPDATE eleteststandarditem SET iOrder=(@i:=@i+1) WHERE sParentId=p_sId`, giving the children fresh consecutive `iOrder` values (but with no `ORDER BY` clause — MySQL picks whatever index order, so the resulting numbering is non-deterministic).

**Invocation:** Status: appears orphaned. No caller in any channel — no form-master, no `gdsmodule` hook, no other routine references, no xly-src reference. Sibling of `sp_cursor_CardEdit*`/`sp_cursor_test` — all four read as ad-hoc developer rebuild scripts. Candidate for cleanup; also flag the non-deterministic ordering bug if anyone ever wires it to a button.
