• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

'null' parameter for a stored procedure

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • 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: 39448
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • 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.
 
mooooooo ..... tiny ad ....
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!