Subject | RE: [firebird-support] Newbie Questions |
---|---|
Author | Martin Catherall |
Post date | 2004-04-01T21:01:23Z |
hi,
I don't think you are alloow to use the "select * " syntax. I think you
have to actually have a select list and place a suspend "loop" at the
bottom of the query.
I too am an sql server user and this drove me nuts when i first started
using firebird.
If you have IB EXPERT then you can script out the syntax of the sp from
"sql editor"
cheers
martin.
CREATE PROCEDURE NEW_PROCEDURE
RETURNS (
ID INTEGER,
TEMPLATE_NAME VARCHAR(50),
DEFAULT_TEMPLATE CHAR(1),
HEAD_OPEN_SECTION BLOB,
INTERNAL_STYLE BLOB,
HEAD_CLOSE_SECTION BLOB,
SCRIPTS_BODY_START BLOB,
BODY_START BLOB,
EMAIL_CONTENT BLOB,
SCRIPTS_BODY_END BLOB,
BODY_END BLOB,
PLAIN_TEXT BLOB,
CREATED DATE,
EE_SECURITY_ID INTEGER)
AS
BEGIN
FOR
select * from ee_msg_template;
INTO :ID,
:TEMPLATE_NAME,
:DEFAULT_TEMPLATE,
:HEAD_OPEN_SECTION,
:INTERNAL_STYLE,
:HEAD_CLOSE_SECTION,
:SCRIPTS_BODY_START,
:BODY_START,
:EMAIL_CONTENT,
:SCRIPTS_BODY_END,
:BODY_END,
:PLAIN_TEXT,
:CREATED,
:EE_SECURITY_ID
DO
BEGIN
SUSPEND;
END
END
Check out www.ubique.webscape.co.nz <http://www.ubique.webscape.co.nz/>
Ubique --> "Drives Your Business"
W E B S C A P E
PO Box 22571
25 Carlyle Street
Christchurch
http://www.webscape.co.nz <http://www.webscape.co.nz/>
Phone 03 964 4020
Fax 03 365 9115
Email mc@... <mailto:tmc@...>
-----Original Message-----
From: Aage Johansen [mailto:aagjohan@...]
Sent: Friday, 2 April 2004 8:33 a.m.
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Newbie Questions
I don't think you are alloow to use the "select * " syntax. I think you
have to actually have a select list and place a suspend "loop" at the
bottom of the query.
I too am an sql server user and this drove me nuts when i first started
using firebird.
If you have IB EXPERT then you can script out the syntax of the sp from
"sql editor"
cheers
martin.
CREATE PROCEDURE NEW_PROCEDURE
RETURNS (
ID INTEGER,
TEMPLATE_NAME VARCHAR(50),
DEFAULT_TEMPLATE CHAR(1),
HEAD_OPEN_SECTION BLOB,
INTERNAL_STYLE BLOB,
HEAD_CLOSE_SECTION BLOB,
SCRIPTS_BODY_START BLOB,
BODY_START BLOB,
EMAIL_CONTENT BLOB,
SCRIPTS_BODY_END BLOB,
BODY_END BLOB,
PLAIN_TEXT BLOB,
CREATED DATE,
EE_SECURITY_ID INTEGER)
AS
BEGIN
FOR
select * from ee_msg_template;
INTO :ID,
:TEMPLATE_NAME,
:DEFAULT_TEMPLATE,
:HEAD_OPEN_SECTION,
:INTERNAL_STYLE,
:HEAD_CLOSE_SECTION,
:SCRIPTS_BODY_START,
:BODY_START,
:EMAIL_CONTENT,
:SCRIPTS_BODY_END,
:BODY_END,
:PLAIN_TEXT,
:CREATED,
:EE_SECURITY_ID
DO
BEGIN
SUSPEND;
END
END
Check out www.ubique.webscape.co.nz <http://www.ubique.webscape.co.nz/>
Ubique --> "Drives Your Business"
W E B S C A P E
PO Box 22571
25 Carlyle Street
Christchurch
http://www.webscape.co.nz <http://www.webscape.co.nz/>
Phone 03 964 4020
Fax 03 365 9115
Email mc@... <mailto:tmc@...>
-----Original Message-----
From: Aage Johansen [mailto:aagjohan@...]
Sent: Friday, 2 April 2004 8:33 a.m.
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Newbie Questions
On Thu, 1 Apr 2004 11:00:24 +0000 (UTC), Martijn Tonies wrote:
>> I'm a fluent SQL Server user and am investigating Firebird
and was
>> wondering if someone could help me with a couple of issues.
>>
>> 1) I'm trying to create a stored procedure as follows but it
always
>> errors and won't compile. Any idea what is wrong?
>>
>> create procedure testproc as
>> begin
>> select * from testtable;
>> end
>
> With Firebird, you cannot just create procedures that return
> a resultset.
>
> If you want to create a SELECT-able procedure, that can be
> used like this:
>
> select * from testproc [(optional variables)]
>
> Then use something like:
>
> create procedure testproc returns (output1 integer, output2
integer)
> as begin
> for select column1, column2
> from testtable
> into :output1, :output2
> do suspend;
> end
If he isn't interested in returning the result to the client
(just using
data within the SP) he should remove the "suspend", and put in
an "begin
<do_work_here> end" section.
Also, one might need "SET TERM", and I usually misplace the ";"
...
--
Aage J.
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> .
=========================================================
This e-mail has been scanned for Viruses and Content and cleared by NetIQ MailMarshal
[Non-text portions of this message have been removed]