Save 
Join IIUG
 for   
 

Informix News
29 July 09 - Wall Street Journal - IBM to Acquire SPSS, Adding to Acquisitions... Read
11 February 09 - InformationWeek - IBM Drifts Slowly Toward Mainstream Cloud Computing... Read
11 February 09 - CNNMoney.com - IBM to Deliver Software via Cloud Computing With Amazon Web Services... Read
07 January 09 - Huliq News - IBM Power Servers Helps Bank of Chengdu Build Up Core Banking System.. Read
04 December 08 - Steeleye - Multicarta achieves 99.997% uptime for its Informix-based Credit Card Authorization Centre... Read
16 October 08 - VendorRate - Informix Earns Top Customer Satisfaction Score on VendorRate in Q3... Read
14 August 08 - IIUG.org - Sellout Expected for the 2009 IIUG Informix Conference... Read
29 April 08 - IntelligentEnterprise.com - IBM Informix Upgrade Enhances Clustering, Database Management... Read
29 April 08 - itweek.com - IBM 'Cheetah 2' mauls data costs... Read
28 April 08 - eWeek.com - IBM Uncages Cheetah 2 Data Server... Read
28 April 08 - CNNMoney.com - IBM Helps Clients Reduce Data Management Costs With New Informix Dynamic Server... Read
09 April 08 - CNNMoney.com - MediaSpan Embeds IBM Informix Dynamic Server Software for Delivering News to Print, Web and Wireless Devices... Read
08 April 08 - IT-Director.com - Informix seeks developers... Read
18 February 08 - marketwire.com - Icarus Studios Partners With IBM to Upgrade Performance, Availability for Its Online Games... Read
17 January 08 - eWeek.com - IBM Adds Mac Support to IDS for Higher Education... Read
17 January 08 - informationweek.com - Lotus Notes For iPhone Signals Closer Ties Between IBM, Apple... Read
16 January 08 - marketwire.com - IBM Informix Dynamic Server to Deliver Support for Mac OS X... Read
16 January 08 - internetnews.com - IBM's IDS to Support Mac Platform... Read
28 June 07 - REG Developer - IBM and Informix tie down Cheetah... Read
27 June 07 - CBRonline.com - IBM corrects its own Informix customer figures... Read
14 June 07 - vnunet.com - IBM changes spots with Informix 'Cheetah' database... Read
14 June 07 - eChannelLine - IBM expands scope for IDS... Read
14 June 07 - Resellernews - IBM: Informix database alive and kicking... Read
13 June 07 - DB2 Magazine - Cheetah is now out of the gate... Read
12 June 07 - IBM - IDS 11 release announcement (pdf)... Read
12 June 07 - ChannelWeb Network - IBM Uncages IDS 11, Aka Cheetah, Database... Read
12 June 07 - eWeek.com - IBM's 'Cheetah' Ready to Pounce... Read
12 June 07 - InformationWeek - IBM Unleashes 'Cheetah' Database... Read
12 June 07 - WebWire - IBM Strengthens Database Portfolio With New Informix Dynamic Server... Read
12 June 07 - Intelligent Enterprise - IBM Unveils Informix Upgrade... Read
12 June 07 - ComputerWeekly.com - IBM's Cheetah IDS makes leap to better data centre clustering... Read
12 June 07 - ebiz - IBM Unveils Next Generation Informix Dynamic Server... Read
12 June 07 - computerworld.com - Will 'Cheetah' help IBM's Informix chase down market share?... Read
12 June 07 - Internetnews.com - No Data Can Outrun This 'Cheetah'... Read
12 June 07 - de.internet.com - IBM neuer Datenbank-Server mit Codenamen Cheetah ist fertig... Read
12 June 07 - verifox.de - IBM stärkt Datenbank-Portfolio mit neuem Informix Dynamic Server... Read
12 June 07 - golem.de - Informix 11 vorgestellt... Read
12 June 07 - Computerwoche.de - IBM stellt neue Informix-Version vor... Read
12 June 07 - IBM.de - IBM stärkt Datenbank-Portfolio mit neuem Informix Dynamic Server... Read
12 June 07 - Heise - IBM gibt Informix 11 frei... Read
25 May 07 - Taiwan.CNET.com - Local Taiwan Informix user group established... (Chinese language) ... Read
18 May 07 - ChannelWeb Network - IBM Musters Partners For Cheetah Release... Read
18 May 07 - eWeek.com - IBM Looks to 'Cheetah' to Speed Up Blade Servers... Read
7 May 07 - DB2 Magazine - SQL Shortcuts - Use these tricks to generate IDS SQL scripts... Read


End of Support Dates

[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

IDS Forum

Re: INOUT parameters in stored procedure

Posted By: Art Kagel
Date: Tuesday, 23 June 2009, at 7:10 p.m.

In Response To: INOUT parameters in stored procedure (MARK COLLINS)

To pass args back from a procedure just use RETURNING. So prob_b is defined
as:

create function

returning varchar as io_rsp1_des, varchar as io_rsp2_des, varchar as
io_rsp3_des, varchar as io_rsp4_des,;

define lcl_rsp1_desc, lcl_rsp2_desc, lcl_rsp3_desc, lcl_rsp4_desc varchar;

...
select r1.response_desc1, r1.response_desc2, r1.response_desc3,
r1.response_desc4
into lcl_rsp1_desc, lcl_rsp2_desc, lcl_rsp3_desc, lcl_rsp4_desc
from survey_questions q
left outer join survey_response r1 on r1.survey_form_nbr = q.survey_form_nbr
and r1.surv_question_nbr = q.surv_question_nbr
where q.survey_form_nbr = i_form_nbr and q.surv_question_nbr =
i_question_nbr;

...

return lcl_rsp1_desc, lcl_rsp2_desc, lcl_rsp3_desc, lcl_rsp4_desc;

end function;

Then proc_a becomes:

create procedure proc_a()

define form_nbr smallint;
define question_nbr smallint;
define rsp1_desc varchar(80);
define rsp2_desc varchar(80);
define rsp3_desc varchar(80);
define rsp4_desc varchar(80);

let form_nbr = 4;
let question_nbr = 1;

let, rsp1_desc, rsp2_desc, rsp3_desc, rsp4_desc = proc_b(form_nbr,
question_nbr);

trace rsp1_desc;
trace rsp2_desc;
trace rsp3_desc;
trace rsp4_desc;
..
..
..

Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)

Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do
those opinions reflect those of other individuals affiliated with any entity
with which I am affiliated nor those of the entities themselves.

On Tue, Jun 23, 2009 at 2:38 PM, MARK COLLINS <markc@myfastmail.com> wrote:

> I may be misunderstanding how INOUT parameters are supposed to be used, so
> please correct me if that is the case.
>
> I have a procedure proc_a that needs to populate several procedure
> variables,
> and I was hoping to populate these by using another procedure proc_b. Take
> the
> following snippet from proc_a:
>
> create procedure proc_a()
>
> define form_nbr smallint;
> define question_nbr smallint;
> define rsp1_desc varchar(80);
> define rsp2_desc varchar(80);
> define rsp3_desc varchar(80);
> define rsp4_desc varchar(80);
>
> let form_nbr = 4;
> let question_nbr = 1;
> call proc_b(form_nbr, question_nbr, rsp1_desc, rsp2_desc, rsp3_desc,
> rsp4_desc);
>
> trace rsp1_desc;
> trace rsp2_desc;
> trace rsp3_desc;
> trace rsp4_desc;
> ..
> ..
> ..
>
> And here is proc_b:
>
> create procedure test_question(i_form_nbr smallint
>
> , i_question_nbr smallint
>
> , inout io_rsp1_desc varchar
>
> , inout io_rsp2_desc varchar
>
> , inout io_rsp3_desc varchar
>
> , inout io_rsp4_desc varchar)
>
> select r1.response_desc1, r1.response_desc2, r1.response_desc3,
> r1.response_desc4
> into io_rsp1_desc, io_rsp2_desc, io_rsp3_desc, io_rsp4_desc
> from survey_questions q
> left outer join survey_response r1 on r1.survey_form_nbr =
> q.survey_form_nbr
> and r1.surv_question_nbr = q.surv_question_nbr
> where q.survey_form_nbr = i_form_nbr and q.surv_question_nbr =
> i_question_nbr;
> ..
> ..
> ..
>
> Since the manual states that INOUT parameters are passed by reference, I
> had
> hoped that when proc_b was executed, the values that it SELECTed into the
> io_*_desc fields would end up populating the variables ques_desc and
> rsp[1-4]_desc in proc_a.
>
> However, when I run proc_a, I get error "-9752 Argument must be a Statement
> Local Variable for an OUT/INOUT parameter." The manual indicates that SLVs
> are
> only used in the WHERE clause, not in the CALL statement. I tried using
> SLVs
> in the CALL statement and got a different error. I tried putting an SLV in
> the
> WHERE clause (where q.survey_form_nbr = i_form_nbr # smallint), but that
> caused a "201: A syntax error has occurred."
>
>
>
> *******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>

--001636c5a8d1b0d74f046d0c1802

Messages In This Thread

[ View Thread ] [ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

IDS Forum is maintained by Administrator with WebBBS 5.12.