Thread View: borland.public.interbase.sql
5 messages
5 total messages
Started by Ryan Born
Sat, 16 Mar 2002 22:52
Simple Stored Procedure Problem
Author: Ryan Born
Date: Sat, 16 Mar 2002 22:52
Date: Sat, 16 Mar 2002 22:52
34 lines
1914 bytes
1914 bytes
After an accidental post on my last one, here is my real problem! I have this Attempt to create a SP, but it won't work. ------------------------------------------------------------ SET TERM !!; CREATE PROCEDURE my_procedure RETURNS (a_value INTEGER) AS BEGIN SELECT count(*) FROM Banners; END !! SET TERM ;!! ------------------------------------------------------------ And I get this error: ------------------------------------------------------------ Dynamic SQL Error SQL error code = -104 Token unknown - line 5, char 27 ; Statement: CREATE PROCEDURE my_procedure RETURNS (a_value INTEGER) AS BEGIN SELECT count(*) FROM Banners; END ------------------------------------------------------------ What is my problem here? This is the most simple of all stored Procs. I am in client Dialect 1. -Ryan
Re: Simple Stored Procedure Problem
Author: Helmut W�ss
Date: Sun, 17 Mar 2002 08:00
Date: Sun, 17 Mar 2002 08:00
45 lines
2213 bytes
2213 bytes
you forgot to put the result into the ouput variable! must be: SELECT count(*) FROM Banners into :a_value; bye, helmut "Ryan Born" <ryanborn@uiuc.edu> schrieb im Newsbeitrag news:3c93cc5f$1_2@dnews... > After an accidental post on my last one, here is my real problem! > > I have this Attempt to create a SP, but it won't work. > ------------------------------------------------------------ > SET TERM !!; > > CREATE PROCEDURE my_procedure > RETURNS (a_value INTEGER) > AS > BEGIN > > SELECT count(*) FROM Banners; > > END !! > > SET TERM ;!! > ------------------------------------------------------------ > And I get this error: > ------------------------------------------------------------ > Dynamic SQL Error > SQL error code = -104 > Token unknown - line 5, char 27 > ; > Statement: CREATE PROCEDURE my_procedure > RETURNS (a_value INTEGER) > AS > BEGIN > SELECT count(*) FROM Banners; > END > ------------------------------------------------------------ > What is my problem here? This is the most simple of all stored Procs. > I am in client Dialect 1. > > -Ryan > >
Re: Simple Stored Procedure Problem
Author: Jan Henrik Sylvester
Date: Sun, 17 Mar 2002 17:13
Date: Sun, 17 Mar 2002 17:13
33 lines
1935 bytes
1935 bytes
"Helmut W�ss" <h.woess@iis-edv.at> schrieb im Newsbeitrag news:3c944d23$1_1@dnews... > you forgot to put the result into the ouput variable! > must be: > SELECT count(*) FROM Banners into :a_value; > > bye, > helmut > > "Ryan Born" <ryanborn@uiuc.edu> schrieb im Newsbeitrag > news:3c93cc5f$1_2@dnews... > > After an accidental post on my last one, here is my real problem! > > > > I have this Attempt to create a SP, but it won't work. > > ------------------------------------------------------------ > > SET TERM !!; > > > > CREATE PROCEDURE my_procedure > > RETURNS (a_value INTEGER) > > AS > > BEGIN > > > > SELECT count(*) FROM Banners; > > > > END !! > > > > SET TERM ;!! In addition to Helmut W�ss reply, don't forget the "SUSPEND;" if you want any return value... HTH, Jan Henrik Sylvester <me@janh.de>
@Jan Henrik
Author: Helmut W�ss
Date: Mon, 18 Mar 2002 16:20
Date: Mon, 18 Mar 2002 16:20
52 lines
2422 bytes
2422 bytes
Hi Jan,
do i really need a suspend in this case ? I thought it is only necessary
if i have a resultset and use
myProc.Open;
but here the result comes back in an output parameter, so i use
myProc.ExecProc;
and get the result with myProc.ParamByName('aValue).AsInteger;
or am i wrong?
bye,
helmut
"Jan Henrik Sylvester" <me@janh.de> schrieb im Newsbeitrag
news:3c94ceb1_1@dnews...
> "Helmut W�ss" <h.woess@iis-edv.at> schrieb im Newsbeitrag
> news:3c944d23$1_1@dnews...
> > you forgot to put the result into the ouput variable!
> > must be:
> > SELECT count(*) FROM Banners into :a_value;
> >
> > bye,
> > helmut
> >
> > "Ryan Born" <ryanborn@uiuc.edu> schrieb im Newsbeitrag
> > news:3c93cc5f$1_2@dnews...
> > > After an accidental post on my last one, here is my real problem!
> > >
> > > I have this Attempt to create a SP, but it won't work.
> > > ------------------------------------------------------------
> > > SET TERM !!;
> > >
> > > CREATE PROCEDURE my_procedure
> > > RETURNS (a_value INTEGER)
> > > AS
> > > BEGIN
> > >
> > > SELECT count(*) FROM Banners;
> > >
> > > END !!
> > >
> > > SET TERM ;!!
>
> In addition to Helmut W�ss reply, don't forget the "SUSPEND;" if you want
> any return value...
>
> HTH,
> Jan Henrik Sylvester <me@janh.de>
>
>
>
Re: @Jan Henrik
Author: Jan Henrik Sylvester
Date: Mon, 18 Mar 2002 16:55
Date: Mon, 18 Mar 2002 16:55
19 lines
1757 bytes
1757 bytes
"Helmut W�ss" <h.woess@iis-edv.at> schrieb im Newsbeitrag
news:3c9613ab$1_1@dnews...
> Hi Jan,
>
> do i really need a suspend in this case ? I thought it is only necessary
> if i have a resultset and use
> myProc.Open;
> but here the result comes back in an output parameter, so i use
> myProc.ExecProc;
> and get the result with myProc.ParamByName('aValue).AsInteger;
>
> or am i wrong?
AFAIK, a procedure only returns a value on SUSPEND.
It has nothing to do with the way you access the return values in your
application.
HTH,
Jan Henrik Sylvester <me@janh.de>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads