DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    12

    syntax to call procedure inside a procedure in db2

    Hi ,
    I want to call a procedure inside a procedure in DB2.see the code in inside IF and ELSE IF.

    CREATE PROCEDURE ANSHUL.TEST_AANA (IN INV_I INTEGER )
    ------------------------------------------------------------------------
    -- SQL Stored Procedure
    ------------------------------------------------------------------------
    P1: BEGIN
    DECLARE varFEE_BILL_TYPE_C CHAR(1);

    SELECT VCST1000.FEE_BILL_TYPE_C INTO varFEE_BILL_TYPE_C
    FROM
    ANSHUL.VCST1000 VCST1000,

    WHERE
    VCST1000.INV_I=varINV_I;


    IF UPPER(varINV_LINE_C)='N' THEN
    -- call procedure inv_generate
    -- call FEE_DETAIL_PER_INV (INV_I INTEGER, INV_LINE_C 'N')

    ELSE IF UPPER(varINV_LINE_C)='D' THEN
    -- call procedure inv_generate
    -- call procedure FEE_DETAIL_PER_INV (INV_I INTEGER, INV_LINE_C 'S')
    -- call procedure FEE_DETAIL_PER_INV (INV_I INTEGER, INV_LINE_C 'A')

    END IF;

    -------------------------------------------------------------------------

    kindly tell me the syntax how to call???

    Thanx and Regards
    Anshul




    END P1

  2. #2
    Join Date
    Jan 2004
    Location
    Alexandria, VA
    Posts
    392
    I'm not familiar with DB2.. In MS-SQL you can use "EXEC()" command/function (or the "sp_executesql" stored procedure).

    If you need to get a result set from the stored procedure, you will likely need to cache it into a temp table, like:

    Create #TempTable (<column definitions...>)
    Insert into #TempTable Exec sp_MySP <parameters...>

    However, as I said - this is MS-SQL Server... DB2 may be different...
    Bob Rouse
    Dimension Data

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links