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

Thread: PL/SQL: Passing arguement to IN fcn

  1. #1
    Join Date
    Dec 2000
    Posts
    1
    Hello,

    I am a newbee to PL/SQL - and Oracle development for that matter. Anyway I need to pass a string to a procedure that will be used in a IN Clause:

    execute procedure UPDATE_DDT(NAME, '1,2,3');

    PROCEDURE UPDATE_DDT(NAME_IN IN VARCHAR2, UPDATE_IN IN VARCHAR2)
    IS
    UPDATE DEVICE_DETAIL_TICKET
    SET NAME = NAME_IN
    WHERE ID IN (UPDATE_IN);
    END UPDATE_DDT;


    THIS procedure gives me an error unless I pass it a single number. eg. the statement
    execute procedure UPDATE_DDT(NAME, '1');
    executes correctly.

    Any ideas how to get this to work?

    Thank you

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    You can't pass multiple values in a single parameter in a function. You need to change the logic.

  3. #3
    Join Date
    Jun 2000
    Posts
    295
    I assume you want to pass:
    '1,2,3' to UPDATE_IN.

    If this is case:

    PROCEDURE UPDATE_DDT(NAME_IN IN VARCHAR2, UPDATE_IN IN VARCHAR2)
    IS
    UPDATE DEVICE_DETAIL_TICKET
    SET NAME = NAME_IN
    WHERE instr(','|| to_char(ID) ||',', ','||UPDATE_IN||',') > 0 ;
    END UPDATE_DDT;


    Basiclly, the idea is to change your ID to ',123,',
    while the passing in parameter is the format of
    '1,2,3', which is converted to ',1,2,3,'

    Good luck!


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