0

我正在linux下编写ac程序以连接到oracle DB并使用oracle pro/c执行存储过程。我的问题是我想暂停调用此过程,然后我可以通过 TIME_OUT 错误(最好是从 pro/c 返回此错误)获得控制权,那么如何以编程方式或带有预编译器选项??

我的 .pc 文件将包含类似

bool connectToDb() {
/*variables declaration and assigning*/
EXEC SQL CONNECT :local_username IDENTIFIED BY :local_password USING :local_connectionString; // to connect to DB
/*error handling*/
}

我调用了一个休眠 30 秒的测试程序。我想让它超时,让我们说 5 秒后 5 秒我想要一个错误(ORA 错误)返回指示超时

bool callProcedure() {
/*variables declaration and assigning*/
EXEC SQL CALL  SLEEP_TEST(); //this line that I don't want to be blocked
/*errors handling*/
}

注意:我使用处理所有错误

EXEC SQL WHENEVER SQLERROR GOTO SQLError;
/*my sql logic*/
goto EndOf_function;
SQLError:
/*Error handling portion that I want to catch the timeout*/
EndOf_function:;

有什么建议么??

4

0 回答 0