What is the mysql equivalent of Sql Server @@ Identity and @@ errors and how to use try catch in mysql

I am looking for several global variables in mysql that are equivalent to sql server.

I want the whole list for example.

Sql Server Equivalent

@@error ---

@@Identity ---

and etc.

Basically, right now I want to know that the equivalent variable is @@ error and @@ identity.

But it will be useful if you could provide some other variable as well

+3
source share
1 answer

The last auto_incrementvalue (i.e., the last credential) generated for the current connection can be found with . LAST_INSERT_ID()


, ; , , .

show errors:

mysql> select a from b;
ERROR 1046 (3D000): No database selected

mysql> show errors;
+-------+------+----------------------+
| Level | Code | Message              |
+-------+------+----------------------+
| Error | 1046 | No database selected | 
+-------+------+----------------------+
1 row in set (0,00 sec)

, ...


, : , ()

, - @@last_error_id @@last_error_message, - .

():

, , , 5.2 , - .

+5

Source: https://habr.com/ru/post/1739835/


All Articles