0
votes

i working since some days with APEX and i added a Shuttle also a text field which contains after processing the selected values.

for the shuttle i have made a LOV (contains stations) example: Be Fd Au ...

the target is get all object's which contains the selected station's but if i run the select i get more objects - also the object which does not contain any selected station, but i don’t know why

in the SQL statement i have the following: (ds_bess001 is the field for stations)

AND INSTR (:P4_BES_EN, zl.ds_bes001) > 0

for the shuttle i use PL/SQL below

DECLARE
   v_selected   APEX_APPLICATION_GLOBAL.VC_ARR2;
   v_in_text    VARCHAR2 (500) := '';
BEGIN
   v_selected := APEX_UTIL.STRING_TO_TABLE (:P4_BES);

   FOR i IN 1 .. v_selected.COUNT
   LOOP
      v_in_text := v_in_text || v_selected (i);

      IF i < v_selected.COUNT
      THEN
         -- v_in_text := v_in_text || ', ';
         v_in_text := v_in_text || ',';
      END IF;
   END LOOP;

   -- v_in_text := '''' || replace(:P1_SHUTTLE, ':', ''',''') || '''';
   :P4_BES_EN := v_in_text;
END;

could anybody help me please?!

now i found the Problem i get the variable example Ap','Fd','Ab and the Problem is thats the variable miss the ' at the beginning and at the end

could anybody tel me how i could add the missing ' in the variable?

1

1 Answers

0
votes

try it with

:P4_BES_EN := ''''||v_in_text||'''';

for ' at the beginning and the end.

and i think you have to alter your instr to something like this

:P4_BES_EN := ','''||v_in_text||''',';

AND INSTR (:P4_BES_EN, ','||zl.ds_bes001||',') > 0

e.g.:

DECLARE
  v_in_text    VARCHAR2 (500) := 'Ap'',''Fd'',''Ab';
BEGIN
  v_in_text :=  ','''||v_in_text||''',';
  dbms_output.put_line(v_in_text);
END;