SELECT
Utility.primaryAlternateID,
Utility.concernRoleID,
Utility.name,
Utility.registeredName,
Utility.utilityTypeCode,
ConcernRole.sensitivity,
city.elementValue,
addressLine1.elementValue
INTO
:primaryAlternateID,
:concernRoleID,
:name,
:registeredName,
:utilityTypeCode,
:sensitivity,
:city,
:addressLine1
FROM
ConcernRole,
Utility,
AddressElement city,
AddressElement addressLine1
WHERE
(
:searchByName = '0'
OR Utility.upperName like :name
)
AND
(
:searchByRegisteredName = '0'
OR Utility.upperRegisteredName like :registeredName
)
AND
(
:searchByUtilityTypeCode = '0'
OR Utility.upperUtilityTypeCode like :utilityTypeCode
)
AND ConcernRole.concernRoleID = Utility.concernRoleID
AND addressLine1.addressID = ConcernRole.primaryAddressID
AND addressLine1.elementType = :addressLine1Type
AND city.addressID = ConcernRole.primaryAddressID
AND city.elementType = :cityType
AND
(
:searchByAddressLine1 = '0'
OR addressLine1.upperElementValue like :addressLine1
)
AND
(
:searchByCity = '0'
OR city.upperElementValue like :city
)
|