|
楼主 |
发表于 2012-5-8 12:30
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 danglihui0529 于 2012-5-29 21:00 编辑
写出来了,贴出来跟大家分享下- BEGIN
- DECLARE a INT(11);
- DECLARE b INT(11);
- DECLARE c INT(11);
- DECLARE d INT(11);
- DECLARE UPIDx BIGINT(16);
- DECLARE URIDx INT(11);
- DECLARE Actionx VARCHAR(64);
- DECLARE DirectObjectx VARCHAR(64);
- DECLARE IndirectObjectx VARCHAR(256);
- DECLARE Sourcex VARCHAR(64);
- DECLARE Resultx CHAR(1);
- DECLARE CTIDx INT(8);
- DECLARE Messagex VARCHAR(256);
- DECLARE IPAddressx VARCHAR(256);
- DECLARE Referencex VARCHAR(256);
- DECLARE Datetimex TIMESTAMP;
- DECLARE Remarksx VARCHAR(100);
- SELECT MIN(UPID) INTO a FROM GC_User_Report_2011_0401_0511;
- SELECT Max(UPID) INTO b FROM GC_User_Report_2011_0401_0511;
- WHILE(a<b) DO
- SELECT UPID,URID,Action,DirectObject,IndirectObject,Source,Result,Message,CTID,IPAddress,Reference,Datetime,Remarks
- INTO UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx
- FROM GC_User_Report_2011_0401_0511 WHERE UPID=a;
- IF (Actionx!=0) THEN CASE WHEN (Actionx='access' AND DirectObjectx='login') THEN INSERT INTO _a_tmb_1basichavior201201 VALUES(UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx); WHEN (Actionx='access' AND DirectObjectx='register') THEN INSERT INTO _a_tmb_1basichavior201201 VALUES(UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx); WHEN (Actionx='api.password' AND DirectObjectx='status') THEN INSERT INTO _a_tmb_1basichavior201201 VALUES(UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx); WHEN (Actionx='forget' AND DirectObjectx='password') THEN INSERT INTO _a_tmb_1basichavior201201 VALUES(UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx); WHEN (Actionx='click' AND DirectObjectx='code') THEN INSERT INTO _a_tmb_1basichavior201201 VALUES(UPIDx,URIDx,Actionx,DirectObjectx,IndirectObjectx,Sourcex,Resultx,Messagex,CTIDx,IPAddressx,Referencex,Datetimex,Remarksx); ELSE set c=c+1; END case; END IF;
- SET a=a+1;
- SET Actionx=0;
- END WHILE;
- SELECT c,d;
- END
复制代码 |
|