Subject RE: [ib-support] Firebird Workbench, Stored Procedures
Author Henrik Sitter
Thanks a lot Nick. I got this code to work:

SET TERM ^! ;
CREATE PROCEDURE TEST1 returns (LEVERANDORCOUNT Integer) AS
BEGIN
SELECT COUNT(*) FROM LEVERANDOR
INTO :LEVERANDORCOUNT ; (This semicolon was missing)
SUSPEND;
END ^!
SET TERM ; ^!

So it was the semicolon, just like you said.

Henrik

-----Original Message-----
From: Josipovic, Nikica [mailto:nikica.josipovic@...]
Sent: 9. januar 2003 10:17
To: 'ib-support@yahoogroups.com'
Subject: RE: [ib-support] Firebird Workbench, Stored Procedures




> -----Original Message-----
> From: Henrik Sitter [mailto:henrik.sitter@...]
> Sent: Thursday, January 09, 2003 10:14 AM
> To: ib-support@yahoogroups.com
> Subject: [ib-support] Firebird Workbench, Stored Procedures
>
>
> Hello, I get an error when trying to write a (test) stored procedure
> using Firebird Workbench. I don't know if this is the correct
> forum, but
> I'll give it a try.
>
> I have 3 different codes, all trying to accomplish the same,
> all giving
> different errors.
>
> Case 1:
>
> SET TERM ^! ;
> CREATE PROCEDURE TEST1 AS
> BEGIN
> SELECT COUNT(*)
> FROM LEVERANDOR
> SUSPEND;
> END ^!
> SET TERM ; ^!
>
> This is the error I get: "ISC ERROR MESSAGE: Dynamic SQL Error, SQL
> error code = -104, Token unknown - line 6, char 3 SUSPEND".
>
> If I comment out SUSPEND, I get another error: "ISC ERROR MESSAGE:
> Dynamic SQL Error, SQL error code = -104, Token unknown -
> line 7, char 1
> END".
>

SET TERM ^! ;
CREATE PROCEDURE TEST1 AS
BEGIN
SELECT COUNT(*)
FROM LEVERANDOR; try a semicolon after the select statement. It works.
SUSPEND;
END ^!
SET TERM ; ^!


> Case 2:
>
> SET TERM ^! ;
> CREATE PROCEDURE TEST1 returns (LEVERANDORCOUNT Integer) AS
> BEGIN
> SELECT COUNT(*)
> INTO :LEVERANDORCOUNT
> FROM LEVERANDOR
> SUSPEND;
> END ^!
> SET TERM ; ^!
>
> This is the error I get: "ISC ERROR MESSAGE: Dynamic SQL Error, SQL
> error code = -104, Token unknown - line 4, char 1 INTO".
>

This can't work. The Into comes _after_ the complete select statement.

> Case 3:
>
> SET TERM ^! ;
> CREATE PROCEDURE TEST1 returns (LEVERANDORCOUNT Integer) AS
> BEGIN
> SELECT COUNT(*)
> FROM LEVERANDOR
> INTO :LEVERANDORCOUNT
> SUSPEND;
> END ^!
> SET TERM ; ^!
>

Again a forgotten semicolon.

CU, Nick


To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/