Jesupriyan

Jesupriyan

  • NA
  • 10
  • 0

How to write procedures with one Parameter even if i declare two parameters?

Feb 15 2010 3:58 AM
Hi!,

I have declared two parameters in Stored Procedures.

I want to write 2 sections.

One section has only one parameter. So I used that parameter only. If I didnt mentions the 2nd parameter in coding means It shows an error.

For Ex.

Fname varchar(50),
DOB Date,
flag varchar(50)

===============
if flag='NameWise' then

select * from tbl_sample where FirstName=Fname;

elseif flag='DateWise' then

select * from tbl_sample where DateofBirth=DOB;

end if;

====================
????? 

From the Above when If use 'Name Wise' means I will pass only the 'name'. So It shows  'DOB' error which has not declared.

Reply me soon. Please








Answers (4)