Results 1 to 3 of 3

Thread: call SP

  1. #1
    Join Date
    Jul 2003
    Location
    porto - Portugal
    Posts
    74

    Unanswered: call SP

    Hi people,
    I need a help...

    i want to receive an parameter from another procedure.

    Example:

    This is the first procedure....and i store the result on the variable p_wk_id that i define like a output parameter...


    CREATE PROCEDURE RMLEITE.Proc5 (OUT p_wk_id INTEGER )
    LANGUAGE SQL
    ------------------------------------------------------------------------
    -- SQL Stored Procedure
    ------------------------------------------------------------------------
    P1: BEGIN
    DECLARE p_wk_id INTEGER;

    declare PROC CURSOR FOR
    SELECT app.config_val
    FROM rmleite.app_config app
    WHERE app.config_name='TW'
    for read only;

    open PROC;
    fetch PROC into p_wk_id;
    close PROC;
    end p1

    ...My second procedure must receive this parameter(p_wk_id)
    this is the second procedure:

    CREATE PROCEDURE teste_sls (IN p_wk_id INTEGER)
    SPECIFIC TESTE_SLS
    LANGUAGE SQL
    ---------------------------------------------------------------
    -- SQL Stored Procedure
    ---------------------------------------------------------------
    P1: BEGIN

    .....

    CALL rmleite.PROC5(p_wk_id);
    SET v_yr_wk_id = p_wk_id;
    ...etc..


    But the problem is that when i want to run the second procedure, the stored procedure builder ask me to input the value for the parameter p_wk_id!
    ..How can i resolve it?

    Rui

  2. #2
    Join Date
    Jul 2003
    Location
    porto - Portugal
    Posts
    74
    ...sorry i forget this on my first procedure...

    open PROC;
    fetch PROC into v_p_wk_id;
    SET p_wk_id = v_p_wk_id;
    close PROC;

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    I'm not sure what you problem is ... But you can refer to the following thread for a nested proc example

    http://dbforums.com/showthread.php?t...ghlight=damian

    Cheers

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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