into a table? I need some help in figuring out how to insert something like: 12, 23, 24, 78, ... which gets passed on to me into a table:
I would appreciate your coach. thanks!
If you are receiving this data as a string, and wish to insert each value separately into a table, you could create a stored procedure which takes the string as input, parses it and does the inserts.
I'll give you some code later tonight if you don't get it done. Let me know here.
Thanks Kmesser! I'll give it a shot...haven't found a way to parse it correctly yet so I would appreciate any tips.
Try this piece of code.
str varchar2(200) := '123,456,789,90000,1,2,3,5,78,90,' ;
stpos number := 1;
endpos number ;
for i in 1..length(translate(str,',0123456789',','))+1
endpos := instr ( str ,',',stpos ) ;
dbms_output.put_line( substr( str,stpos,abs(endpos - stpos )) ) ;
stpos := endpos + 1 ;
end loop ;
It works! Thank you Victoria! I was playing with the substr and instr...but this code simple works great.
Click Here to Expand Forum to Full Width