If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > calling a procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-04-02, 05:05
aravindgorthy aravindgorthy is offline
Registered User
 
Join Date: Oct 2002
Location: India
Posts: 6
Question calling a procedure

Hi,
1.
I want to call a procedure from a procedure..
The calling procedure returns a result set.
How do I proceed and what is the way of doing it.
I am a novice to Informix and migrating a stored procedure from oracle.
Could any one help me in solving this issue.
2.
I get an error saying "460: Statement length exceeds maximum."
When I execute a procedure. The total length of the procedure is around 70KB. what should I do in order to increase the maximum length..

thanks and Regards
Arvind
Reply With Quote
  #2 (permalink)  
Old 10-04-02, 05:52
Roelwe Roelwe is offline
Registered User
 
Join Date: Aug 2002
Location: Belgium
Posts: 534
Re: calling a procedure

I Think we need more input here:
Can you post the two procedures?
When do you get the error? On the execute procedure statement?
__________________
rws
Reply With Quote
  #3 (permalink)  
Old 10-04-02, 06:56
aravindgorthy aravindgorthy is offline
Registered User
 
Join Date: Oct 2002
Location: India
Posts: 6
Re: calling a procedure

Quote:
Originally posted by Roelwe
I Think we need more input here:
Can you post the two procedures?
When do you get the error? On the execute procedure statement?
CREATE PROCEDURE ONE ( id int)
RETURNING VARCHAR(10),VARCHAR(10);
DEFINE v_name;
DEFINE v_add;
If (id =2 )
FOREACH Outputcur FOR
SELECT Ename, Address INTO v_name, v_add FROM Employee
RETURN v_name, v_add WITH RESUME;
END FOREACH
ELSE
CALL PROCEDURE TWO(id int);
END PROCEDURE;

Now if the condition does not match and goes to the else part ..then what about the return value of the ONE procedure. How this takes place How should i proceed..


For 2nd question.
There was a mistake it was not happening while executing the procedure it was happening while CREATING the procedure.

Thanks for the immediate reply
Reply With Quote
  #4 (permalink)  
Old 10-04-02, 09:38
Roelwe Roelwe is offline
Registered User
 
Join Date: Aug 2002
Location: Belgium
Posts: 534
Why don't you crate a third (central) procedure:

CREATE PROCEDURE TEST (int id)
If (id =2 )
CALL PROCEDURE ONE;
ELSE
CALL PROCEDURE TWO;
END IF
END PROCEDURE

CREATE PROCEDURE ONE
RETURNING VARCHAR(10),VARCHAR(10);
DEFINE v_name;
DEFINE v_add;
FOREACH Outputcur FOR
SELECT Ename, Address INTO v_name, v_add FROM Employee
RETURN v_name, v_add WITH RESUME;
END FOREACH
END PROCEDURE
__________________
rws
Reply With Quote
  #5 (permalink)  
Old 10-07-02, 00:44
aravindgorthy aravindgorthy is offline
Registered User
 
Join Date: Oct 2002
Location: India
Posts: 6
By doing so As the calling procedure (one, two) returns more than one value errors will be arising..
I want to call a procedure inside a procedure which will written set of rows...is it possible in informix ???
Reply With Quote
  #6 (permalink)  
Old 10-07-02, 05:33
Roelwe Roelwe is offline
Registered User
 
Join Date: Aug 2002
Location: Belgium
Posts: 534
Fro a procedure returning more than one row you need:

fareach execute procedure one into ..., ...

...

end foreach;

Error -460:

The statement text in this PREPARE, DECLARE, or EXECUTE IMMEDIATE statement is longer than the database server can handle. The actual limit differs with different implementations, but it is always generous, in most cases up to 32,000 characters. Review the program logic to ensure that an error has not caused it to present a string that is longer than intended (for example, by overlaying the null string terminator byte in memory). If the text has the intended length, revise the program to present fewer statements at a time.

I think you might want to dig deeper in yr code.


The WITH RESUME option.

It will continue to return rows until no more rows are to be returned.
__________________
rws
Reply With Quote
  #7 (permalink)  
Old 10-07-02, 08:19
aravindgorthy aravindgorthy is offline
Registered User
 
Join Date: Oct 2002
Location: India
Posts: 6
Thumbs up

Thanks alot Roelwe
It really helped me solve a big issue
thanks once again





Quote:
Originally posted by Roelwe
Fro a procedure returning more than one row you need:

fareach execute procedure one into ..., ...

...

end foreach;

Error -460:

The statement text in this PREPARE, DECLARE, or EXECUTE IMMEDIATE statement is longer than the database server can handle. The actual limit differs with different implementations, but it is always generous, in most cases up to 32,000 characters. Review the program logic to ensure that an error has not caused it to present a string that is longer than intended (for example, by overlaying the null string terminator byte in memory). If the text has the intended length, revise the program to present fewer statements at a time.

I think you might want to dig deeper in yr code.


The WITH RESUME option.

It will continue to return rows until no more rows are to be returned.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On