PL/SQL (MOSC)

MOSC Banner

select statement with multiple inputs

edited Sep 6, 2011 3:55AM in PL/SQL (MOSC) 14 commentsAnswered
I want to create a stored procedure that takes in two params.  One param will occisionally be null in which case I dont want it to be used in the where clause.  so for example if two parameters are used contestid and status.  I want to be able to grab all items where the contestid matchs but status does not matter.  but other times it the status is provided or not null I want it to be included in the where.  pseudo code

if p_status = null then
where contestid = p_contestid

else
where contestid = p_contestid and status = p_status

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center