Subject | Re: [ib-support] Re: UDFs returning BLOB cause error -804 |
---|---|
Author | Claudio Valderrama C. |
Post date | 2002-02-28T06:56:10Z |
""mircostange"" <mirco@...> wrote in message
news:a5ig32+iskh@......
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-Function unknown
-F_STRBLOB
SQL> select string2blob('hello') from rdb$database;
STRING2BLOB
=================
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-SQLDA missing or incorrect version, or incorrect number/type of variables
If you throw the substring() in the middle, you will return to string. But
you can do a workaround:
SQL> set term ^;
SQL> create procedure p2b(i varchar(300)) returns(o blob) as begin o =
string2blob(i); suspend; end^
SQL> set term ;^
SQL> select * from p2b('hello');
O
=================
0:cc21ac
=====================================================
O:
BLOB display set to subtype 1. This BLOB: subtype = 0
=====================================================
SQL> set blob 0;
SQL> select * from p2b('hello');
O
=================
0:cc0c10
=====================================================
O:
hello
=====================================================
I don't know really what do you want to do. For converting between two blob
types, there are special udfs called blob filters, poorly documented
however. It's strange that you want to convert a string to blob and then
pass it to the calling application. It almost has no sense. This trick was
needed when you had to convert a string to blob before inserting it into a
blob field (otherwise, use parameterized queries) but that now inserting
literal strings into blob fields is supported directly by Firebird.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
news:a5ig32+iskh@......
>But in such case, it would say instead:
> > Yes, it's the right place. :))
> >
> > -804 is returned when you call an unknown function...did you
> declare your
> > functions to the database?
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-Function unknown
-F_STRBLOB
> Yes, I did. There is a free udf lib that has a strblob function. As IThat's almost equivalent to the string2blob() function in the fbudf.
> understand, it's supposed to take a string and return a blob. I
> declared it with
>
> declare external function f_StrBlob
> cstring(254),
> blob
> returns parameter 2
> entry_point 'StrBlob' module_name 'FreeUDFLib.dll';
> However, when I try to execute:This is not supported by DSQL.
>
> select f_strblob('X') from sampletype
SQL> select string2blob('hello') from rdb$database;
STRING2BLOB
=================
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-SQLDA missing or incorrect version, or incorrect number/type of variables
If you throw the substring() in the middle, you will return to string. But
you can do a workaround:
SQL> set term ^;
SQL> create procedure p2b(i varchar(300)) returns(o blob) as begin o =
string2blob(i); suspend; end^
SQL> set term ;^
SQL> select * from p2b('hello');
O
=================
0:cc21ac
=====================================================
O:
BLOB display set to subtype 1. This BLOB: subtype = 0
=====================================================
SQL> set blob 0;
SQL> select * from p2b('hello');
O
=================
0:cc0c10
=====================================================
O:
hello
=====================================================
I don't know really what do you want to do. For converting between two blob
types, there are special udfs called blob filters, poorly documented
however. It's strange that you want to convert a string to blob and then
pass it to the calling application. It almost has no sense. This trick was
needed when you had to convert a string to blob before inserting it into a
blob field (otherwise, use parameterized queries) but that now inserting
literal strings into blob fields is supported directly by Firebird.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing