473,748 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing the return value of called procedure

-
this is one way of creating a stored procedure in mysql:

CREATE PROCEDURE some_procedure (IN value1, OUT value2)
BEGIN
SELECT ... INTO value2 FROM ....
END//
and if called from another procedure, i can access the variable this way:

CREATE PROCEDURE another_procedu re (....)
BEGIN
DECLARE count INT;
...
CALL some_procedure( ..., count);
IF (count ... ) THEN
END IF;
...
...
END//
there is another way of creating a stored procedure in mysql without
using a variable:

CREATE PROCEDURE some_procedure (IN value1)
BEGIN
SELECT ... FROM ....
END//
if i were to use this way, how can i access the return value?

CREATE PROCEDURE another_procedu re (....)
BEGIN
...
CALL some_procedure( ...); <==== how to access the value?
...
...
END//
i tried several ways:

1) SET count = CALL some_procedure( ...);
2) IF ((CALL some_procedure( ...)) ...) THEN

but both produce an error.
Jul 23 '05 #1
1 1485
- wrote:
i tried several ways:

1) SET count = CALL some_procedure( ...);
2) IF ((CALL some_procedure( ...)) ...) THEN

but both produce an error.


A procedure that returns a value instead of having an OUT parameter is
called a FUNCTION. This is created with the CREATE FUNCTION statement.
Functions are very similar to procedures, except that they cannot
reference any tables; that is, they can't perform queries.

Looking in the grammar source code for MySQL 5.0.2, there _appears_ to
be support for queries of the form:
SELECT * FROM PROCEDURE procname();
But I can't get it to work. It might be an unfinished feature. We are
using 5.0 alpha, after all.

Is it a problem to use a variable and fill it by passing it as an OUT
parameter to the procedure?

Regards,
Bill K.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1780
by: stjulian | last post by:
I have a stored procedure that is supposed to 1. Increment a counter in Table A via a transaction 2. Use this value as the primary key to add in an address to customers Table B (Referenced as a "DECLARE @CustomerID INT" just after the AS clause) 3. Return the primary key. This works perfectly when being called from Query Analyzer supplying values in an EXEC line, however, accessing it from .ASP (IIS 5.0 on Win2K), the
1
1869
by: Jay | last post by:
I hope this is the correct place to post this. I'm using a stored procedure to simply look up and return a value from a database. The db key is an integer, everything else is varchar. The stored proc is: CREATE procedure SP_IMAGE_NAME( @MAT_ID varchar(13), @TYPE varchar(1), @IMAGE_NM varchar(100) OUTPUT ) as
2
4670
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info Center: To return a result set from a procedure to the originating application, use the WITH RETURN TO CLIENT clause. When WITH RETURN TO CLIENT is specified on a result set, no nested procedures can access the result set.
1
1144
by: PeteZ | last post by:
I can access results returned from a stored procedure call OK, my question is how do you access the value from a RETURN statement in a stored procedure ? eg. In the Example below - how can I check on the Value -1000 (Customer not found) ? @CID = customer id . . . .
8
4455
by: Christopher Weaver | last post by:
I'm having trouble accessing the value of an output parameter of a stored procedure. The SP looks like this: SET TERM ^ ; CREATE PROCEDURE SP_NEW_TASK RETURNS ( "uidTask" INTEGER) AS begin
1
1452
by: Evan Kontos | last post by:
I am having an issue w/regard to stored procedures. If I do the following: Dim OccCnctn As New OleDb.OleDbConnection Dim OccCmd As New OleDb.OleDbCommand Dim OccRdr As OleDb.OleDbDataReader OccCnctn.ConnectionString = "Integrated Security=SSPI;Packet Size=4096;Data Source='COMTEK-9100WXP';Tag with column collation when possible=False;Initial Catalog=Move Manager;Use Procedure for Prepare=1;Auto Translate=True;Persist Security
5
1945
by: RSH | last post by:
I havent been able to set a property from another class with out getting some sort of error. Can someone please tell me what I'm doing wrong here? Public Class Form1
3
5202
by: Odd Bjørn Andersen | last post by:
Is there a way to check the return status from a stored procedure when called from a OS (Windows) script? I have a stored procedure that does some checking in the database, and the return status is set to 0 or -1 if 'OK' or 'not OK' respectively. When I call the from CLP I get something like this: Value of output parameters --------------------------
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.