我在Oracle中存储过程
CREATE OR REPLACE PROCEDURE procTest (p_param1 varchar2, p_param2 out varchar2)
AS
BEGIN
...
END;
如何处理参数?
_db.Execute("EXEC procTest ('dsds')");
答案 0 :(得分:-2)
关于http://pocoproject.org/docs-1.5.0/00200-DataUserManual.html
上的存储过程和函数支持存储过程和函数支持
大多数现代数据库系统都支持存储过程和/或功能。 Poco :: Data是否提供任何支持?你打赌。虽然具体可能的具体内容(例如传入和传出的数据类型,自动或手动数据绑定,绑定方向等)最终取决于数据库,但POCO Data最好能够提供合理的访问权限。通过in,out和io绑定功能的功能。顾名思义,这些函数正在执行绑定传入或接收存储过程或两者的参数。代码值千言万语,所以这是一个Oracle ODBC示例:
session << "CREATE OR REPLACE "
"FUNCTION storedFunction(param1 IN OUT NUMBER, param2 IN OUT NUMBER) RETURN NUMBER IS "
" temp NUMBER := param1; "
" BEGIN param1 := param2; param2 := temp; RETURN(param1+param2); "
" END storedFunction;" , now;
int i = 1, j = 2, result = 0;
session << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now; // i = 2, j = 1, result = 3
允许存储过程返回数据集(a.k.a.游标):
typedef Tuple<std::string, std::string, std::string, int> Person;
std::vector<Person> people;
int age = 13;
session << "CREATE OR REPLACE "
"FUNCTION storedCursorFunction(ageLimit IN NUMBER) RETURN SYS_REFCURSOR IS "
" ret SYS_REFCURSOR; "
"BEGIN "
" OPEN ret FOR "
" SELECT * FROM Person WHERE Age < ageLimit; "
" RETURN ret; "
"END storedCursorFunction;" , now;
session << "{call storedCursorFunction(?)}", in(age), into(people), now;
上面显示的代码适用于Oracle数据库。