×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Here is the "actual" code in the stored procedure: Any help would be
appreciated. I'm not sure about using a CLOB - however, the web guys use it
everywhere.
BEGIN
DECLARE STMT CLOB ;
DECLARE C1 CURSOR WITH RETURN FOR SQLSTMT ;
SET STMT = 'SELECT lh.company,
lh.EventName,
lh.CustId,
lc.FName as CoRegFname,
lc.LName as CoRegLName,
lh.ListId,
lh.EventDate,
lh.Message,
lh.EventCity,
lh.EventState,
lh.EventOccasion,
lh.Fname,
lh.Lname,
lh.CampaignID,
CWMPINH.GETEMAILADDRESS(CAST (LH.COMPANY AS CHAR(3)) , CAST(LH.CUSTID AS
INT)) AS EMAILADDRESS
FROM CWMPWEB.Listheader lh
LEFT OUTER JOIN CWMPWEB.ListCoReg lc on lh.Company = lc.Company AND
lh.CustId = lc.ParentCustId AND lh.ListId = lc.ListId
WHERE lh.ListType = 1
AND lh.Company = ' || IN_COMPANY || '
AND lh.IsDeleted = 0' ;
IF IN_REGISTRANT_FIRST_NAME <> '' THEN
SET STMT = STMT || ' AND (lower(replace(lh.Fname,''
'','''')) like lower(replace(''' || IN_REGISTRANT_FIRST_NAME || '%'', '' '',
'''')) OR lower(replace(lc.Fname,'' '','''')) like lower(replace(''' ||
IN_REGISTRANT_FIRST_NAME || '%'', '' '', '''')))' ;
END IF ;
IF IN_REGISTRANT_LAST_NAME <> '' THEN
SET STMT = STMT || ' AND (lower(replace(lh.Lname,''
'','''')) like lower(replace(''' || IN_REGISTRANT_LAST_NAME || '%'', '' '',
'''')) OR lower(replace(lc.Lname,'' '','''')) like lower(replace(''' ||
IN_REGISTRANT_LAST_NAME || '%'', '' '', '''')))' ;
END IF ;
IF IN_EVENT_CITY <> '' THEN
SET STMT = STMT || ' AND lower(replace(EventCity,''
'','''')) like lower(replace(''' || IN_EVENT_CITY || '%'', '' '', ''''))' ;
END IF ;
IF IN_EVENT_STATE <> '' THEN
SET STMT = STMT || ' AND lower(replace(EventState,''
'','''')) like lower(replace(''' || IN_EVENT_STATE || '%'', '' '', ''''))' ;
END IF ;
IF IN_EVENT_MONTH > 0 THEN
SET STMT = STMT || ' AND lh.EventMonth = ' || IN_EVENT_MONTH
||'' ;
END IF ;
IF IN_EVENT_YEAR > 0 THEN
SET STMT = STMT || ' AND lh.EventYear = ' || IN_EVENT_YEAR
||'';
END IF ;
SET STMT = STMT || ' ORDER By lh.Lname' ;
PREPARE SQLSTMT FROM STMT ;
OPEN C1 ;
SET RESULT SETS CURSOR C1 ;
END
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.