Manipulation of strange STRING_TO_TABLE/TABLE_TO_STRING colon (would be great if someone from the dev team could enlighten us...)

Hello

I was going to replace some of my old text, parsing code with these 2 functions (that I guess they are more effective and more elegant than my code), but I'll probably wait a while... at least until that specified. I wonder how these functions manage colones and if there are any other 'special' characters which has escaped or replaced. I can't find anywhere in the documentation that these two functions are supposed to escape from anything, so the behavior is quite surprising.

Here is the code:

DECLARE
  v_vc_arr2 apex_application_global.vc_arr2;
  v_vc2 VARCHAR2(100);
BEGIN
  v_vc_arr2(1) := 'abc:123';
  v_vc_arr2(2) := 'def:456';
  --convert to string
  v_vc2 := apex_util.table_to_string(v_vc_arr2,',');
  dbms_output.put_line(v_vc2); --returns abc:123,def:456 (both colons are being escaped) but expected output would be abc:123,def:456
  --convert back to an array
  v_vc_arr2 := apex_util.string_to_table (v_vc2, ',');
  FOR i IN 1..v_vc_arr2.count
  LOOP
    DBMS_OUTPUT.PUT_LINE(v_vc_arr2(i));
    /*
    --output is (&#58 is unescaped only in one case)
    abc:123
    def:456
    --expected output would be
    abc:123
    def:456
    */
  END LOOP;
END;


Please, everyone has no explanation why semicolons sometimes are unescaped, sometimes not and why they escaped even? It would be really nice to read the source code for these two functions, because the behavior is a complete mystery to me.

Thank you very much

Pavel

Hi Pavel,

Sorry, I haven't read the entire thread. The string_to_table function does not cancel the replacement ":" in the last element. There is no other (UN-) escape. It has been like that since the beginning, and this is probably the reason why there are several string_to_table % and table_to_string % functions in wwv_flow_utilities, with a slightly different behavior. I added the functions split/join wwv_flow_utilities and we use these in the new code. We should really do new audiences in a press release, because they are healthier and more powerful.

Unfortunately, I have to repeat that any change to the existing public API functions could cause regressions, so we can not do this.

Kind regards

Christian

Tags: Database

Similar Questions

Maybe you are looking for