Subject Re: [ib-support] Datatype uknown error in a stored proc
Author Helen Borrie
At 01:56 PM 9/05/2003 +0100, you wrote:

>I’m using Firebird 1.0.2.
>Could you please tell what’s wrong with the following code in a stored
>proc :
>

>
>declare variable entie integer ;

>entier = 10 ;
>….
>
>insert into sometable select atable.field1, :entier, atable.fieldn from
>atable
>
>I’ve tried to cast ( :entier as integer )
>
>And always received the Datatype uknown error.

Joseph,

First, you would be well-advised to specify an input column list for an
insert statement in ANY case where there is not exact column mapping to a
table.

Most importantly, the documentation quite clearly states you cannot pass
either a parameter or a variable in the field list of the SELECT (see
INSERT in the Language Reference).

Read the input set in a FOR SELECT...INTO...<variables> loop and perform an
ordinary INSERT INTO ATABLE (<column-list>) VALUES (<value-list>)
statement, including your variable as a member of the value-list at each
iteration of the loop.

cheers,
heLen