Subject Re: [firebird-support] Passing a blob to a stored procedure
Author Helen Borrie
At 09:34 AM 10/06/2004 +0000, you wrote:
>Procedure
>The script as I run.
>
>CREATE PROCEDURE INSERT_TRANSACTIONEX(
> TRANS_ID VARCHAR(22),
> CELL_NUMBER VARCHAR(15),
> THE_MESSAGE BLOB SUB_TYPE 1,
> MSG_ID VARCHAR(8),
> STATUS CHAR(1),
> USER_ID VARCHAR(20),
> VIS CHAR(1),
> CONTNAME CHAR(50))
>AS
>BEGIN
> INSERT INTO TRANSACTIONS
>(TRANSID,CELLNUMBER,THEMESSAGE,MSGID,STATUS,THETIMESTAMP,USERID,
>VISIBLE,CONTACTNAME)
> VALUES
>(:TRANS_ID, :CELL_NUMBER, :THE_MESSAGE, :MSG_ID, :STATUS, 'now', :USER
>_ID,:VIS,:CONTNAME);
>END;
>
>I execute the procedure with the following line.
>
>EXECUTE PROCEDURE INSERT_TRANSACTIONEX('1','123','test
>message','123','1','testuser','T','test user')
>
>I get an internal error in ib admin.

The string 'test message' isn't a blob, it's a string. The procedure
expects a blob as input. If you're using Firebird, change the input
parameter declaration to a suitably sized varchar and it should compile. If
you're using InterBase, you'll have to do something a bit more complicated
inside the SP to convert the string to a blob, i.e. call a UDF such as
String2Blob.

/heLen