• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

'null' parameter for a stored procedure

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This must be a very basic question. Lets say we have a stored procedure:


Now we want the procedure to be able to take a dummy value which tells the sp that it needs to handle the request differently from when an integer 'someId' is passed in. How is this kind of situation normally handled?

Is it usually handled by passing in a 'null'?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sharad,
I favor creating another stored procedure that does the other thing and calling that. This is similar to the non-database task of having a Java method do something different. Messing with the parameters (either as nulls or magic number values) makes the code more confusing to call and harder to maintain.
reply
    Bookmark Topic Watch Topic
  • New Topic