DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Function

  1. #1
    Join Date
    Sep 2002
    Posts
    376

    Function

    Hi,

    When i pass the modified IN parameter(vz) ( ie., adding the quotes to make it a string ) to the cursor, it is not working. But if i hardcode the same it will works

    Am i missing something ??



    function Func_one(px EMP.ID%type) return varchar2
    AS
    vx varchar2(200);
    vy varchar2(200);
    vz varchar2(200);
    k varchar2(200);
    x varchar2(200);
    vz1 varchar2(200);
    v_var varchar2(40);

    cursor c1 (str in varchar2) is select ID from EMP where ID in (str);

    begin
    vy:= replace(px, ',' , ''',''');
    vz:=ltrim(rtrim(''''||vy||'''')) ;
    vz1:='';
    for x in c1(vz)
    loop
    dbms_output.put_line('PERSONID: '||x.ID);
    vz1:= vz1 ||','||x.ID;
    end loop;
    dbms_output.put_line('vz after for loop'||vz1);
    return (vz1);
    end;
    ------------------------------------------------------------------------
    The most enjoyable things in the world are either Immoral or too Expensive or otherwise Inaccessible anyway

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Cool


    You better use Tom Kyte's solution.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width