Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2012
    Posts
    3

    Unanswered: Native sql stored procedures

    I have 2 queries regarding a stored proc using native sqls with the below inputs.

    CREATE PROCEDURE PRGTYPE1 (
    IN I_FORM_NM CHAR(50)
    IN I_NEW_FORM_NM CHAR(50)

    1.I need to see if the i/p I_FORM_NM is NULL and perform corresponding operations..
    is there any option in native sql to check whether the input is NULL or not...

    2.whether any display commands is available in native sql??

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    1)
    Code:
    IF I_FORM_NM is NULL
    THEN
    -- A bunch of statements
    ELSE
    -- Another bunch of statements
    END IF;
    2) Stored Procedures run in the Database Server. Where would they display anything? (The answer is no). The displaying os anything should be made by the entity that calls the SP.

    Andy

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Maybe you should read the manual a bit more. This is basic stuff.

    Andy

  4. #4
    Join Date
    Mar 2012
    Posts
    3

    native sql stored procedure

    Thanks for ur reply Andy....

    i did try the below thing by giving low values for my input....but it went into the ELSE part of the statements rather than the IF...

    IF I_FORM_NM is NULL
    THEN
    -- A bunch of statements
    ELSE
    -- Another bunch of statements
    END IF;

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You don't understand SQL. Low values (hex zeros) is not the same as NULL. You need a basic class in SQL. Maybe this may help:
    SQL For Dummies, 7th Edition | Free eBooks Download - EBOOKEE!
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  6. #6
    Join Date
    Mar 2012
    Posts
    3

    native sql stored procedure

    Thanks for ur encouraging reply!!!!!!!but native sql is completely new for me...and i dont have so much time to research so i thought would find right people to help out in such forums.....

    may be i will put it like ths :

    in my program if i dont get any value for I_FORM_NM i need to insert I_NEW_FORM_NM into the table and if i get value for it i need to update it with I_NEW_FORM_NM .In COBOL we have the Parameter NULL indicators in Linkage Section using which, we can validate for nulls.

    i hope we can use PARAMETER STYLE GENERAL WITH NULLS in Native SQL. But I am not sure where we declare the Parameter Null indicators for the input values....

    can u help me out with this........

  7. #7
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    For information on how to handle NULLs in COBOL, try this manual:
    Application Programming & SQL Guide, page 155
    http://publib.boulder.ibm.com/epubs/pdf/dsnapk18.pdf
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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