- 论坛徽章:
- 0
|
给你个例子就是
- /* 0 - succ
- * <0 - error
- * >0 - warn
- */
- int
- get_complain_tms(
- exec sql begin declare section;
- parameter char *bran,
- parameter int *cnt
- exec sql end declare section;
- )
- {
- static char alrdy_prprd;
- exec sql begin declare section;
- char *pr_id = (char *)__func__;
- exec sql end declare section;
- *cnt = 0.0f;
- if (alrdy_prprd == 0) {
- sprintf(stmt, "select count(*) from m_sfa_mng_input where date <= ? and opun_cod = ?");
- /*
- WARN("stmt %s", stmt);
- */
- exec sql prepare :pr_id from :stmt;
- if (SQLCODE) {
- WARN("SQLCODE %d, msg %s", SQLCODE, sql_err_msg());
- return (-1);
- }
- alrdy_prprd ++;
- }
- exec sql execute :pr_id into :*cnt using :bran, :wrkdt;
- if (SQLCODE < 0) {
- WARN("SQLCODE %d, msg %s", SQLCODE, sql_err_msg());
- return (-1);
- }
- return (SQLCODE == SQLNOTFOUND);
- }
复制代码
[ 本帖最后由 ivhb 于 2007-7-2 10:33 编辑 ] |
|