dolthub / dolthub/dolt

Support declare error code

Open
#7,460 0 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
enhancement sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

Support [declare error code](https://dev.mysql.com/doc/refman/8.0/en/declare-condition.html):

```
{
Name: "create DECLARE HANDLERs",
SetUpScript: []string{
`DROP TABLE IF EXISTS t1;`,
`CREATE TABLE t1 (pk BIGINT PRIMARY KEY);`,
`CREATE PROCEDURE proc_named_condition()
BEGIN
DECLARE a, b INT DEFAULT 1;
DECLARE cur1 CURSOR FOR SELECT * FROM t1;
OPEN cur1;
BEGIN
DECLARE eof CONDITION FOR 1329;
DECLARE EXIT HANDLER FOR eof SET a = 2;
tloop: LOOP
FETCH cur1 INTO b;
IF a > 1 THEN
LEAVE tloop;
END IF;
END LOOP;
END;
CLOSE cur1;
SELECT a;
END;`,
},
Assertions: []ScriptTestAssertion{
{
Query: "CALL proc_named_condition();",
Expected: []sql.Row{{2}},
},
},
},
```

```
unsupported syntax: declare eof condition for 1329
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.