Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    4

    Unanswered: Optional Parameters for DB2 sprocs?

    Ive got a stored proc that has a signature like this:

    CREATE PROCEDURE sp_dcs_getCompetenciesForPosition(
    IN v_mPositionID INT,
    IN v_mUniqAssessmentIDD INT)


    However, sometimes, i don't need v_mUniqAssessmentIDD to be set to anything, and therefore changing some of what the sp returns.

    I come from a MSSQL background, and would usually do:

    CREATE PROCEDURE sp_dcs_getCompetenciesForPosition(
    IN v_mPositionID INT,
    IN v_mUniqAssessmentIDD = -1 INT)

    to default v_mUniqAssessmentIDD to -1. How can I replicate this behavior in DB2? Thanks.

  2. #2
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Use COALESCE?

    VALUES (COALESCE(v_mUniqAssessmentIDD, -1)) INTO v_mUniqAssessmentIDD;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •