-
在esql中使用的变量声明
这些变量在使用时前面要加上:
- execsqlbegindeclaresection;
- char_id[10];
- char_name[20];
- char_password[18];
- char_branchid[9];
- char_roleid[2];
- chardb_name[128+1];
- char_sql[]="updateuserinfosetpassword=?whereuserid=?";
- execsqlenddeclaresection;
动态SQL操作例1
- EXECSQLDECLAREcursor1CURSORFOR\
- selectuseridfromuserinfo;
- EXECSQLOPENcursor1;
- do
- {
- EXECSQLFETCHcursor1INTO:_id;
- if(sqlca.sqlcode==100)break;
- printf("%10s\n",_id);
- }while(1);
动态SQL操作例2
- execsqlbegindeclaresection;
- char_id[10];
- char_name[20];
- char_password[18];
- char_sql[]="updateuserinfosetpassword=?whereuserid=?";
- execsqlenddeclaresection;
- memset(_id,0x00,sizeof(_id));
- memset(_password,0x00,sizeof(_password));
- sprintf(_id,"%s","001");
- sprintf(_password,"%s","haha");
- EXECSQLPREPAREprep_statFROM:_sql;
- EXECSQLEXECUTEprep_statUSING:_password,:_id;
本文介绍了ESQL中如何使用动态SQL进行数据操作,包括变量声明、游标使用及参数化查询更新等关键技术点。
898

被折叠的 条评论
为什么被折叠?



