Subject Re: [ib-support] inserting a blob through a stored procedure
Author Helen Borrie
At 03:35 PM 25-12-00 -0200, you wrote:
>Hello all,
>Thanks to our friend Francis I could retrieve a blob from the database,
>using a stored procedure.
>But now my stored procedure of insertion is returnig a "internal error"
>without any known cause. I would like to use the stored procedure delineated
>bellow to insert a record into the table Historic, described bellow using
>delphi 5 interbase 6, under windows 95/98.

This line won't store a blob for you:

inHistoric.parambyname('MAHA_VISHNU').AsBlob :=
Maha_Vishnu.lines.Text;

You need to be able to assign a blob to a blob.

So you need to access the TParam object InHistoricMaha_Vishnu. In order to
do so, double-click on the fields editor of the stored procedure to bring
this object into your application (easiest) or you can instantiate it at
run-time (a bit tricky). Check the attributes in the parameter's property
list and make sure the datatype is ftMemo and its paramtype is ptInput.

Then you need some code like this:

procedure....
begin
....
if Maha_Vishnu.Count > 0 then
InHistoricMaha_Vishnu.Value := Maha_Vishnu.Text;
// else InHistoricMaha_Vishnu.Value remains unchanged
....
end;

Note that, in an updating situation, you can assign the original contents
of the instantiated field object directly to the memo's Text or Lines
properties.

Just as a matter of interest, I find your practice of using the same
identifier names for everything very confusing. I admit that I haven't
examined your SP closely to determine whether it is valid.

Another observation is your use of floats for keys. A Seriously Bad
Idea. Floats have intrinsic precision problems. Databases have internal
methods to resolve them but even using them for pure data values requires a
lot of handling in your applications. Using them for keys is hopeless -
the likelihood of properly matching them in relationships is about nil.

Use integers or chars for keys and live a long and happy life.

Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________