Subject Re: [firebird-support] Dynamic statement construction and BLOB variables in SP
Author Helen Borrie
On 24 Jul 2006 at 13:12, Miroslav Penchev wrote:
>Hello,
>
>I have a problem executing that simple SP:
>
>CREATE PROCEDURE NEW_PROCEDURE
>as
>declare variable from_part blob sub_type 1 segment size 80;
>declare variable temp_str blob sub_type 1 segment size 80;
>begin
> from_part = 'VIEW_DOCUMENT_DATA';
> temp_str = 'SELECT * FROM ' || :from_part;
>end
>
>On execution of second line I get error "Column unknown.
>VIEW_DOCUMENT_DATA".
>I am try to assemble a complex SQL statement to execute it with EXECUTE
>STATEMENT. I am missing something? If local variables are VARCHARs
>everything is OK.

At 09:31 PM 24/07/2006, Dimitry Sibiryakov wrote:

> You can't work with BLOBs in PSQL.

That's not altogether true and it's not the cause of the problem here.

from_part = 'VIEW_DOCUMENT_DATA';
You can't assign a string to a blob.

temp_str = 'SELECT * FROM ' || :from_part;
You can't concatenate a blob to anything.

Why would you want to use a blob here anyway?

Did you know that it is also pointless to define a segment size for a blob?

./heLen