Subject | RE: [ib-support] Firebird Workbench, Stored Procedures |
---|---|
Author | Josipovic, Nikica |
Post date | 2003-01-09T09:17:09Z |
> -----Original Message-----SET TERM ^! ;
> 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".
>
CREATE PROCEDURE TEST1 AS
BEGIN
SELECT COUNT(*)
FROM LEVERANDOR; try a semicolon after the select statement. It works.
SUSPEND;
END ^!
SET TERM ; ^!
> Case 2:This can't work. The Into comes _after_ the complete select statement.
>
> 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".
>
> Case 3:Again a forgotten semicolon.
>
> SET TERM ^! ;
> CREATE PROCEDURE TEST1 returns (LEVERANDORCOUNT Integer) AS
> BEGIN
> SELECT COUNT(*)
> FROM LEVERANDOR
> INTO :LEVERANDORCOUNT
> SUSPEND;
> END ^!
> SET TERM ; ^!
>
CU, Nick