Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Update table with a comma seperated string
I have a string of id's and True or False values. I could have 50000
pairs. Like: "2,t,6,t,9,f" I am new to oracle and I am tring to make a
package. so basically I need to look threw the string for update
active(t or f) where id=number
I am new to Oracle. Below does not seem to work. I don't get any errors
AS
PROCEDURE Update_Route_Camera(
CSArray IN VARCHAR2)
IS
i NUMBER;
x number;
y varchar2(1);
BEGIN
-- initialise
i := 0;
LOOP
i := i+1;
EXIT WHEN instr(CSArray, ',', 1, i) = 0;
-- get first value
x := to_number(trim(substr(CSArray, instr(CSArray, ',', 1, i)-1, 1)));
-- get second value
i := i+1;
y := trim(substr(CSArray, instr(CSArray, ',', 1, i)-1, 1));
update rtcamera set rtcamera.ACTIVE = y where id = x;
END LOOP;
END Update_Route_Camera;
END Update_Route_Camera_pkg;
Received on Wed May 12 2004 - 11:26:45 CDT