Subject If statements in an SP
Author flexmate6
The following SP works, but I want to do some additional selection
inside the SP.
The input parameter CORP is 'C' for customers, 'P' for prospects
and blank for either.
The code inside the comments kills IBADMIN.
Can someone please point me in the right direction?
I would also like to order by conditionally using an input parameter.
Is this something that can be accomplished?


REATE PROCEDURE CUSTSELECT_CUSTID (CORP Char(1))
returns (CUSTID Char(10),
COMPANY Char(60),
ZIP Char(14),
CUSTPROS Char(1),
ZIPCODE Char(14),
ZIPCITY Char(40),
ZIPSTATE Char(24))
AS

begin
for
select C.CUSTID, C.COMPANY, C.ZIP, C.CUSTPROS,
Z.ZIPCODE, Z.ZIPCITY, Z.ZIPSTATE
from CUSTOMER C join ZIPCODE Z on Z.ZIPCODE = C.ZIP
/* if :CORP <> '' then
begin
and C.CUSTPROS = :CORP
suspend;
end; */
order by CUSTID
into :CUSTID, :COMPANY, :ZIP, :CUSTPROS, :ZIPCODE, :ZIPCITY,
ZIPSTATE
do
suspend;

end