-
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
-
You can't pass multiple values in a single parameter in a function. You need to change the logic.
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|