syntax to call procedure inside a procedure in db2


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: syntax to call procedure inside a procedure in db2

  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

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center