Can anyone help me how to handle TimeOut exception?

I tried below code but its throwing error

DELIMITER //
DO
BEGIN

ECHO SELECT Sleep(70);

EXCEPTION
– WHEN ER_RG_TIMEOUT THEN --not supported in memsql
– ECHO SELECT ‘timeout error’;
** WHEN OTHERS THEN**
** ECHO SELECT ‘Other’;**


END; //
DELIMITER;

Hello Neha! :wave: Welcome to our community! I’m sorry you’re having this trouble.
Can you please let me know if you are running the managed or self-hosted service and the version number? Thanks

Are you setup using Resource Pools?
SHOW RESOURCE POOLS;
SELECT @@resource_pool; – Your specific pool

I have asked about this. This is not an available feature. If you can capture the EXCEPTION then you could also override the exception and this is not allowed. May want to SET resource_pool = x or CALL OPTION(resource_pool=x); that has longer time out or no time out if you have this as an option.

1 Like

Using this block of code on localhost…
version 7.6 installed in feb
Actually In this code I was trying to capture Timeout except in Exception Handling Block so that I can log that case where timeout had occurred . But Whenever the timeout occurs instead of going to Exception Block it terminate the proc.

Hello Neha!

As you noted, the WHEN ER_RG_TIMEOUT THEN is not supported in SingleStore and will throw an error. As MarkW mentioned, you can change the QUERY_TIMEOUT limit within the particular resource pool to increase the time margin before timeouts occur. Additionally, you can leverage both internal & user-defined exceptions to achieve this desired functionality.

We look forward to your updates on how it goes when trying these suggestions. Thanks, in advance.