WinTask uses the DbSelect() function to query the database and create a result set, and the DbGetFieldString() to retrieve values from that result set.
DbSelect
The DbSelect function creates the dataset by selecting the desired records in the ODBC database.
Syntax
Ret=DbSelect({SQL_selection}[,DYNASET|SNAPSHOT])
DbGetFieldString
The DbGetFieldString function retrieves the contents of any non-numeric field within the current record for the dataset in use.
Syntax
Ret=DbGetFieldString({field_name},{string})
DbGetFieldNumeric
The DbGetFieldNumeric function retrieves the value of a numeric field (integer) within the current record for the dataset in use.
Syntax
Ret=DbGetFieldNumeric({field_name},{value})
The {SQL selection} argument of DbSelect() is not case-sensitive, but the {field name} of DbGetFieldString() and DbGetFieldNumeric() is.
Thus:
DbSelect(“select cusip from fund_desc”, SNAPSHOT)
DbGetFieldString(“CUSIP”,Var$)
You can visualize this using PL/SQL Developer. DbSelect() accepts the same SQL statement that the SQL Window accepts. DbGetFieldString() requires the column name that PL/SQL Developer produces as output.
Similarly, when using Cast() as in :
DbSelect(“select CAST(CIK as VARCHAR2(10)) from fund_desc where CIK > 10000”, SNAPSHOT)
DbGetFieldString(“CAST(CIKASVARCHAR2(10))”,Var$)
You can see the field name created as output :
This article originally appeared in my blog: All Things Quality
My name is Joe Strazzere and I'm currently a Director of Quality Assurance. I like to lead, to test, and occasionally to write about leading and testing. Find me at http://strazzere.blogspot.com/. |
No comments:
Post a Comment