Subject | How to check and see if a blob is empty in StoredProcedure |
---|---|
Author | Michael L. Horne |
Post date | 2001-12-05T21:34:23Z |
Hello,
I have a Stored Procedure that I use to check and return some info
about records in a DB. Below is the relevant parts. I am trying to
check and see if some data is in a blob. If so I want to return a
flag with that knowledge. The user doesn't need to see the note at that
time and to conserve bandwidth I don't want to transmit the note text.
The SP below compiles fine, but causes an error on execution.
If I remove the (Notes <> '') line the procedure returns '*'
even if the Notes field is empty. So what do I need to do
to get this info?
CREATE PROCEDURE SPPARTSNOTES (
XPART VARCHAR (16))
RETURNS (NOTESFLAG CHAR (1))
AS
Declare variable Notes BLOB SUB_TYPE TEXT SEGMENT SIZE 8192;
begin
xPart = Upper(:xPart);
/* The Inv Records */
for Select Inv_Notes
from inv
where inv_Part = :XPart
into :Notes
do begin
if (Notes is not null) then
begin
if (Notes <> '') then /* <==== Error Here */
NotesFlag = '*';
end
suspend;
end
exit;
end
Thanks
Michael L. Horne
I have a Stored Procedure that I use to check and return some info
about records in a DB. Below is the relevant parts. I am trying to
check and see if some data is in a blob. If so I want to return a
flag with that knowledge. The user doesn't need to see the note at that
time and to conserve bandwidth I don't want to transmit the note text.
The SP below compiles fine, but causes an error on execution.
If I remove the (Notes <> '') line the procedure returns '*'
even if the Notes field is empty. So what do I need to do
to get this info?
CREATE PROCEDURE SPPARTSNOTES (
XPART VARCHAR (16))
RETURNS (NOTESFLAG CHAR (1))
AS
Declare variable Notes BLOB SUB_TYPE TEXT SEGMENT SIZE 8192;
begin
xPart = Upper(:xPart);
/* The Inv Records */
for Select Inv_Notes
from inv
where inv_Part = :XPart
into :Notes
do begin
if (Notes is not null) then
begin
if (Notes <> '') then /* <==== Error Here */
NotesFlag = '*';
end
suspend;
end
exit;
end
Thanks
Michael L. Horne