|
想对某人的还款计划的本金进行检查(12行数据),打算的是用函数从数据库中取出来值,然后和期望值进行比对,但是发现问题如下:
1、期望值只能为整数,而我的输出值为2精度的DECIMAL类型的数值,这点让人很郁闷,难道期望值不能为小数吗?
2、多行转列后无法输出为333.33,444.44或222.22|555.55类型,就算我将.替换为0,333033进行比对,但是12期的值就很长了,直接期望值给我科学计数法计算了,导致不论怎么比都是失败的。
麻烦哪位大神能帮看看....
或者有能和excel比对的方法也行
反正要实现的就是从库中查出一组小数的数据然后和预期值进行比对
sql转换前:select group_concat(RETURNSUM) as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
sql转换后:select group_concat(conv(( RETURNSUM ) , 10, 10 ) separator"0" ) as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
自定义了一个数据库验证函数 :
Function VerifySQLDaTa(conStr,sqlStr,verifyProperty,expectValue)
Set adoConn = CreateObject("ADODB.connection")
adoConn.Open conStr
Set adoRst = adoConn.Execute(sqlStr)
actualValue = adoRst.Fields.Item(verifyProperty).value
If CStr(expectValue)= CStr(actualValue) Then
Reporter.ReportEvent micPass,"sql_data_check","[ expectValue = actualValue = " + CStr(actualValue)+"]"
Else
Reporter.ReportEvent micFail,"sql_data_check","[ expectValue = " + cstr(expectValue) + " ;actualValue = " + cstr(actualValue)+" ]"
End If
adoConn.Close
Set ado = Nothing
End Function
Environment.LoadFromFile "d:\qtpconfig\sqlconfig.xml"
verifySQLDaTa Environment.Value("ConnStr"),Environment.value("sqlStr"), "test",84250842508425084250842508425084250842508425084250842508426
xml:
<Environment>
<Variable>
<Name>ConnStr</Name>
<Value>DRIVER={MySQL ODBC 3.51 Driver}; DATABASE=xedk;DSN=loan;OPTION=0WD=adminORT=3306;SERVER=192.168.2.223;UID=xedk</Value>
</Variable>
<Variable>
<Name>sqlStr</Name>
<Value>select RETURNSUM as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
</Value>
</Variable>
</Environment> |
|