473,699 Members | 3,186 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 1483
- 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
1778
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
1866
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
4665
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
1141
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
4454
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
1449
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
1944
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
5199
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
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9053
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...
1
8936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7776
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...
1
6540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
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
4390
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
4636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.