Subject Re: [firebird-support] Invalid argument in EXECUTE STATEMENT - cannot convert to string
Author Tim Ward
It was in fact elementid being null.

Having discovered this I was unable to tell the list as a reply to my original message because this list doesn't seem to send messages to their originator.

On 25/06/2014 18:34, Mark Rotteveel mark@... [firebird-support] wrote:

On 25-6-2014 16:08, Tim Ward tdw@... [firebird-support] wrote:
> Anyone know what this error message actually means?

May I suggest that you also include the error in the message body, when
reading e-mail on a mobile device, long subject lines have a tendency to
get truncated.

(The error in the title is: Invalid argument in EXECUTE STATEMENT -
cannot convert to string )

> Yes I am trying to run an EXECUTE STATEMENT, but it's not clear to me
> what an "argument" means in this context, or what it is that something
> is trying to convert to a string, or why it's trying to do so, or why it
> can't be done.
> execute statement
> 'select first 1 MODULEID, ELEMENTID from TBLMODULE' ||
> :tableType || ' ' ||
> 'where ELEMENTID = ' ||:ELEMENTID || :userClause || '
> order by 1 ASC'
> into :nModuleId, :nElementId;
> tableType is a varchar
> elementid is a bigint
> userclause is a varchar
> nmoduleid is a bigint
> nelementid is a bigint
> The only thing I can think of, after struggling for some time to
> understand the message, is that the thing between "statement" and "into"
> is the "argument", and the only reason I can think of that it might not
> be a string - despite obviously looking like one!! - is that elementId
> is null (neither of the other variables can ever be null). Does that
> make sense?

If the statement is NULL, you get an 'unexpected end of command' or an
'invalid token' instead.

It would probably be easier to know the actual values of :tableType,
:ELEMENTID and :userClause

Mark Rotteveel

Tim Ward