Subject Re: [firebird-support] Why is END invalid
Author Marcin Bury
Uwe

W dniu 21.07.2011 13:49, Uwe pisze:
> Could somebody tell me why the following error is received when I try to compile this SQL statement. Using firebird 64 bit v 2.5 ?
>
> SET TERM ^ ;
>
> CREATE PROCEDURE TestProc
> AS
> BEGIN
> IF ( EXISTS(SELECT * FROM OBJECTTYPE)) THEN
> SELECT 'Test message.'
>
> END^
>
> SET TERM ; ^
>
> Error: *** IBPP::SQLException ***
> Context: Statement::Prepare(
>
> CREATE PROCEDURE TestProc
> AS
> BEGIN
> IF ( EXISTS(SELECT * FROM OBJECTTYPE)) THEN
> SELECT 'Whats Up'
>
> END
> )
> Message: isc_dsql_prepare failed
>
> SQL Message : -104
> Invalid token
>
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 9, column 1
> END
>
>
>
> ------------------------------------

Try to compile the procedure with semicolon ";" after IF..THEN:
IF ( EXISTS(SELECT * FROM OBJECTTYPE)) THEN SELECT 'Whats Up'; <-- note
semicolon here

Marcin


>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>