Author |
Message
|
RocknRambo |
Posted: Thu Jan 05, 2006 7:48 am Post subject: Replace Function in MB V5.0 |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
Trying to use the REPLACE function..
Is this chunk of code correct?
Code: |
DECLARE v_InputBLOB BLOB BITSTREAM(InputRoot.XML);
SET v_InputBLOB = REPLACE(v_InputBLOB, X'1A' );
SET OutputRoot."BLOB"."BLOB" = v_InputBLOB; |
the whole input Tree is repeated twice. In other 3KB message of input, 6KB of Ouput
any thoughts are appreciated
Thanks
-RR |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 05, 2006 7:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Jan 05, 2006 8:07 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
NOT using BITSTREAM, how do we take whole input as BLOB ?using the CAST ? else how ?
regarding the Replace Function:
I'm pretty sure we can say the replace string as optional, notes from the pdf.
Quote: |
If you do not specify the replace string expression, the replace string defaults to an empty string and the behavior of the function is to delete all occurrences of the search string from the result. |
Besides, this is what I'm trying to achieve, -
I need to remove a charecter from the input, the charecter is known, what would be best way ?
Thanks
-RR |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 05, 2006 9:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The function you want instead of BITSTREAM is ASBITSTREAM.
Try that, see if that fixes your duplication problem.
If it doesn't, try specifing an empty replace string. The manual also says "If any parameter is NULL, the result is NULL".
If that doesn't fix your problem, then post your entire ESQL. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Jan 05, 2006 8:44 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi RocknRambo,
For your problem
Quote: |
the whole input Tree is repeated twice. In other 3KB message of input, 6KB of Ouput |
Before doing this
Quote: |
Quote: |
Code:
DECLARE v_InputBLOB BLOB BITSTREAM(InputRoot.XML);
SET v_InputBLOB = REPLACE(v_InputBLOB, X'1A' );
SET OutputRoot."BLOB"."BLOB" = v_InputBLOB; |
|
Did you do this also
Quote: |
SET OutputRoot = InputRoot; |
If yes, then dont do it.
Regards. |
|
Back to top |
|
 |
RocknRambo |
Posted: Fri Jan 06, 2006 6:29 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
Thanks elvis_gn !!
thts correct I choose
Code: |
SET OutputRoot = InputRoot; |
, by removing it .. made it working
and ASBITSTREAM is giving error but BITSTREAM did the job
-RR |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 06, 2006 6:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If ASBITSTREAM is giving an error, it's because you're using it wrong.
I promise you that you want to use ASBITSTREAM and not BITSTREAM.
BITSTREAM does something subtly different than ASBITSTREAM, which is explained in the info center - and BITSTREAM is supposed to be deprecated which means it could go away at any time (although I had hoped it would be gone in v6). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RocknRambo |
Posted: Fri Jan 06, 2006 8:31 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
U were right. my mistake, was not using it properly.
bottomline, Yes I'm able to chop off spl char
Thanks
-RR |
|
Back to top |
|
 |
|