Subject Re: [ib-support] TStringList and SP
Author R. Tulloch
"R. Tulloch" wrote:
>
> Hi:
>
> I want to create an sp to do the block below. How does one handle to
> items
> I am adding to and using in the stringlist?
>
> Thanks.
>
> Best regards


Never mind. This SP works fine with a "stringworktable"

SET TERM ## ;
CREATE PROCEDURE "GENERATEUSPSQUALDATA"
AS
BEGIN
DELETE FROM USPSQUALREPORT;
DELETE FROM STRINGWORKTABLE;
INSERT INTO STRINGWORKTABLE(STRING1)
SELECT DISTINCT SUBSTR(ZIP,1,5) AS ZIP FROM NEWSLET;
INSERT INTO STRINGWORKTABLE(STRING1)
SELECT DISTINCT SUBSTR(ZIP,1,3) AS ZIP FROM NEWSLET;
END ##
SET TERM ; ##





>
> }
> TStringList *QualReport = new TStringList(); <-------
> try
> {
> QualReport->Clear();
> IBQualReportQuery->SQL->Clear();
> IBQualReportQuery->SQL->Add("Select distinct substr(ZIP,1,5) as
> ZIP from NEWSLET");
> IBQualReportQuery->Prepare();
> IBQualReportQuery->Open();
> IBQualReportQuery->First();
> while (!IBQualReportQuery->Eof)
> {
>
> QualReport->Add(Trim(IBQualReportQuery->FieldByName("ZIP")->AsString));
> IBQualReportQuery->Next();
> }
> IBQualReportQuery->Close();
> IBQualReportQuery->SQL->Clear();
> IBQualReportQuery->SQL->Add("Select distinct substr(ZIP,1,3) as
> ZIP from NEWSLET");
> IBQualReportQuery->Prepare();
> IBQualReportQuery->Open();
> IBQualReportQuery->First();
> while (!IBQualReportQuery->Eof)
> {
>
> QualReport->Add(Trim(IBQualReportQuery->FieldByName("ZIP")->AsString));
> IBQualReportQuery->Next();
> }
> IBQualReportQuery->Close();
> Result = true;
> }
> catch(EIBError *E)
> {
> DisplayMsg(E->IBErrorCode, E->Message);
> delete QualReport;
> IBMailingTransaction->Rollback();
> return false;
> }