pardon me, but I am not sure what exactly you are trying to achieve
with your code.

Could you please explain the your requirement in more details?

Regards,
Sonty

On Mar 31, 2:08 am, Santana <paulito.sant...@gmail.com> wrote:
> Hi friends.
> I need your help to improve my code that is presents below.
>
> The aim of this code is replace a some tags in a string by a specifics
> values.
> Example:
> I want replace a the substring(i called tag too) "<date>" by "" and
> the substring <id> by a random value.
>
> There is another way more efficent and elegant, for example with
> regular expressions ?? Or do you have any idea to improve this code?
> I do not like much the loop cycle, and the way to initializate the
> array "l_tag_array" !!
>
> DECLARE
> TYPE lt_tags IS TABLE OF VARCHAR2(1024) INDEX BY VARCHAR2(128);
> l_tag_array    lt_tags;
> l_idx          VARCHAR2(128);
> l_filename     VARCHAR2(1024);
> l_array_value  VARCHAR2(1024);
> BEGIN
>
>   l_filename:='<date>.<id>.dat';
>
>   l_tag_array('<date>'):='TO_CHAR(SYSDATE,''ddyyyyhh24miss'')';
>   l_tag_array('<id>'):='ROUND(dbms_random.value(1,1000),0)';
>
>   l_idx := l_tag_array.FIRST;
>   WHILE(l_idx IS NOT NULL) LOOP
>
>     EXECUTE IMMEDIATE 'SELECT ' || l_tag_array(l_idx)   ||' FROM DUAL
> ' INTO l_array_value ;
>     l_filename := REPLACE(l_filename,l_idx,l_array_value);
>
>     l_idx := l_tag_array.NEXT(l_idx);
>   END LOOP;
>
>   dbms_output.put_line(l_filename);
> END;
>
> Thanks a lot,
> Santana

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to