Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Update table with a comma seperated string

Update table with a comma seperated string

From: helixpoint <dfetrow410_at_hotmail.com>
Date: 12 May 2004 09:26:45 -0700
Message-ID: <3abd1e01.0405120826.398d9b2c@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US