Hi Kal,
first a short querstion: Is this a kind of legacy db your're working with?
If not:
It's a little strange to have a table with only one column where the data is structured by "tags".
For your problem it would be much easier if your log_tbl would look like this:
DEPT_CODE NUMBER(4) NOT NULL
MSG VARCHAR2(40) NOT NULL
TRACKING_ID VARCHAR2(200)
where DEPT_CODE and MSG are the foreign key to deptlog_tbl.
But let's work with the structure you described in your post.
First of all I do not think you're really joining the two tables, at least I can't see anything in your result which you can't select directly from table log_tbl.
Without joining the problem looks pretty much like the one from the beginning of this
thread. Maybe a problem could be that some strings are shorter than the substring you are using.
You should have a look at the Oracle
string functions:
Oracle String Functions
The result maybe something like this:
I hope I did understand what you want to do...
John