Subject | REPLACE() Retaining EOF marker from BLOB |
---|---|
Author | red_october2009 |
Post date | 2012-08-07T04:36:40Z |
BACKGROUND INFO:
I have a stored procedure with two BLOB SUB_TYPE 1 variables declared. One contains a letter template, the other contains the letter text. In the template I have the character string [LETTER_BODY] at the place where I want the letter text to appear. (It is placed in the middle of the template.. there is standard text in the template that appears after the [LETTER_BODY] character string.
Here is what I do in the stored procedure:
...
DECLARE vLTR_TXT BLOB SUB_TYPE 1;
DECLARE vCHT_TXT BLOB SUB_TYPE 1;
...
--Both variables are populated from BLOB SUB_TYPE 1 fields in two different tables.
...
vLTR_TXT = REPLACE(:vLTR_TXT, '[LETTER_BODY]', :vCHT_TXT);
...
-- The vLTR_TXT is then used in an UPDATE statement to save the new letter text to a BLOB SUB_TYPE 1 field in yet another table.
The REPLACE() correctly replaces the [LETTER_BODY] tag with the text contained in :vCHT_TXT variable. Text in the template that occurs BEFORE the [LETTER_BODY] tag is still there, however, a problem occurs, in that NO TEXT AFTER what was inserted from the :vCHT_TXT variable is preserved. It's as if there is an EOF marker at the end of :vCHT_TXT that is being "obeyed" by the :vLTR_TXT BLOB.
Note that this problem DOES NOT OCCUR if I use a hard coded string value. Like:
vLTR_TXT = REPLACE(:vLTR_TXT, '[LETTER_BODY]', 'My String');
QUESTION:
Is there a way of removing the EOF character at the end of :vCHT_TXT so that it "looks like" a simple string? I don't want to change :vCHT_TXT to a VARCHAR(32000) because it is conceivable that a user could enter more than 5 pages of text (more than 32000 characters).
(Or will removing that character cause a malfunction of FB?)
Is there any other suggestions that will solve this problem? (I've tried declaring the variables as BLOB SUB_TYPE 0, makes no difference.. same problem occurs)
-- Thanks in advance for any help you can provide.
I have a stored procedure with two BLOB SUB_TYPE 1 variables declared. One contains a letter template, the other contains the letter text. In the template I have the character string [LETTER_BODY] at the place where I want the letter text to appear. (It is placed in the middle of the template.. there is standard text in the template that appears after the [LETTER_BODY] character string.
Here is what I do in the stored procedure:
...
DECLARE vLTR_TXT BLOB SUB_TYPE 1;
DECLARE vCHT_TXT BLOB SUB_TYPE 1;
...
--Both variables are populated from BLOB SUB_TYPE 1 fields in two different tables.
...
vLTR_TXT = REPLACE(:vLTR_TXT, '[LETTER_BODY]', :vCHT_TXT);
...
-- The vLTR_TXT is then used in an UPDATE statement to save the new letter text to a BLOB SUB_TYPE 1 field in yet another table.
The REPLACE() correctly replaces the [LETTER_BODY] tag with the text contained in :vCHT_TXT variable. Text in the template that occurs BEFORE the [LETTER_BODY] tag is still there, however, a problem occurs, in that NO TEXT AFTER what was inserted from the :vCHT_TXT variable is preserved. It's as if there is an EOF marker at the end of :vCHT_TXT that is being "obeyed" by the :vLTR_TXT BLOB.
Note that this problem DOES NOT OCCUR if I use a hard coded string value. Like:
vLTR_TXT = REPLACE(:vLTR_TXT, '[LETTER_BODY]', 'My String');
QUESTION:
Is there a way of removing the EOF character at the end of :vCHT_TXT so that it "looks like" a simple string? I don't want to change :vCHT_TXT to a VARCHAR(32000) because it is conceivable that a user could enter more than 5 pages of text (more than 32000 characters).
(Or will removing that character cause a malfunction of FB?)
Is there any other suggestions that will solve this problem? (I've tried declaring the variables as BLOB SUB_TYPE 0, makes no difference.. same problem occurs)
-- Thanks in advance for any help you can provide.