SQL> desc cs_accounting_log;
Name Null? Type
------------------------------ ---- -------- --------------------
LOG_ID NOT NULL NUMBER(38)
BLOB_ORDINAL NOT NULL NUMBER(38)
BLOB_DATA NOT NULL VARCHAR(255)
And in column BLOB_DATA, one record is made of mutiple values. Ex.
SQL> select * from cs_accounting_log where BLOB_DATA like '%apurcell%';
How do I break down those fields in BLOB_DATA column so that I can do some query? I am thinking of creating another table with multiple columns, but how do I load the data in that table?
It appears that the column you have there is delimited by spaces. You could write a script (possibly perl) that would create a SQL script that would insert each of the parts into another table.
Since the data string has embedded spaces that separate values you could use the INSTR() function from within a PL/SQL block to 'parse' the string into separate fields. As an example:
declare
pos number:=0;
next_pos number:=0;
len number:=0;
var1 varchar2(40);
var2 varchar2(40);
var3 varchar2(40);
var4 varchar2(40);
cursor get_string is
select string
from string_table;
begin
for strng in get_string loop
next_pos := instr(strng.string, ' ', pos+1, 1);
len := next_pos - pos - 1;
var1 := substr(strng.string, pos + 1, len);
pos := next_pos;
next_pos := instr(strng.string, ' ', pos+1, 1);
len := next_pos - pos - 1;
var2 := substr(strng.string, pos + 1, len);
pos := next_pos;
next_pos := instr(strng.string, ' ', pos+1, 1);
len := next_pos - pos - 1;
var3 := substr(strng.string, pos + 1, len);
pos := next_pos;
next_pos := instr(strng.string, ' ', pos+1, 1);
if next_pos = 0 then
var4 := substr(strng.string, pos+1);
else
len := next_pos - pos - 1;
var4 := substr(strng.string, pos + 1, len);
end if;
insert into var_table
values
(var1, var2, var3, var4);
commit;
pos := 0;
end loop;
end;
/
Hopefully this will give you some idea of how to proceed.
Bookmarks