Subject Re: [ib-support] Re: problem with very simple Stored Procedure
Author Helen Borrie
At 06:38 PM 27-08-02 +0000, you wrote:

>Ok, i tried this code, suggested by helebor:
>
> > SET TERM ^;
> > CREATE PROCEDURE SET_TIMEOUT
> > AS
> > begin
> > update online_ set timeout = current_timestamp;
> > end ^
> >
> > SET TERM ; ^
>
>but still, the same error message appears to me:
>
> > Statement #1:
> > Unknown error.

If you are trying to do this interactively:

This is one command:

SET TERM ^;

This is another:

CREATE PROCEDURE SET_TIMEOUT
AS
begin
update online_ set timeout = current_timestamp;
end ^

And this is another:

SET TERM ; ^

In SQL you can't submit multiple commands in a single statement.

But also your query tool probably can't let you use SET TERM and the
alternative terminator, since these are language features of the
command-line isql utility and scripts.


>What i realised today is that I AM UNABLE to run any procedure using
>EXECUTE PROCEDURE.
>
>If i add a return value and i run the procedure through a SELECT
>query (i.e. SELECT * FROM SET_TIMEOUT), the procedure runs fine. But
>using EXECUTE PROCEDURE only produces an error message.

What kind of error message?

Be aware that you can't SELECT from a procedure that does only DML (data
manipulation language) as in your example; and you will get errors trying
to EXECUTE a procedure that generates a multi-row dataset.

>I use IB Query to code my procedures, i am not sure what type of SQL
>it uses (iSQL, dSQL, xxxSQL...). I have used this software for a
>while, but always to create procedure called by SELECT queries.

iSQL is the language of the isql utility. A subset of it is available for
use in scripts.
DSQL is dynamic SQL - your "regular" SQL (as opposed to static SQL, which
is precompiled inside an embedded application).
ESQL is embedded SQL - the slightly different language set that is used
inside embedded applications.
DDL is data definition language, use for creating and modifying metadata
objects, such as your example here, CREATE PROCEDURE.
DML is data manipulation language - statements that operate on data
(SELECT, INSERT, UPDATE, DELETE).

>Maybe it's IB Query which is the problem. What are other good
>software for programming firebird?

Lots, as indicated by Artur. But I think it's possible your confusion is
coming from trying to run scripts as DSQL and/or running DSQL in scripts
without the correct syntax.

Although IB_SQL is my regular database admin tool. I've used the IB Query
tool without any of the problems you report.

Some time you are going to have to bite the bullet and start using the manuals.

heLen