Partitioned Outer Joins in Oracle

From 10g onwards Oracle has had a type of join called a Partitioned Outer Join, providing a convenient syntax which can be used to fill gaps in sparse data.
The documentation describes the result of a partitioned outer join as “a UNION of the outer joins of each of the groups in the logically partitioned table with the table on the other side of the join.”

To demonstrate what this means in practice, I will run through a simple example.

We will start with two very simple tables, products and sales, which look like this:
Continue reading Partitioned Outer Joins in Oracle

iOS7 Safari default bookmarks in Chinese?

Another overly late iOS7-related post; this time it’s about the default bookmarks in Safari.

I updated to iOS7 the day it was released to the public. Like many others I sat there clicking Update in iTunes for a good two hours before getting through to to the server. Another hour and a phone reboot later and I was looking at the iOS7 that I’d already played with in beta…

But, imagine my surprise when I opened Safari and was presented with this:

iOS Safari Favourites Screen - Chinese Bookmarks

Continue reading iOS7 Safari default bookmarks in Chinese?

iOS7 fonts used for Japanese text

Is your iPhone using the correct default font for Japanese text?

Today I want to tell you about a little quirk of the system which I encountered when playing with iOS7.

With successive releases of iOS, Apple occasionally add new fonts to the system. Aside from app developers, it is something to which most of us are probably oblivious. There aren’t that many apps where a user has the need or opportunity to select a font (iBooks being an exception). Probably the majority of developers opt to stick with the default system font, which offers a clean and simple look and ensures their UI looks and feels like it belongs on the platform.

I don’t know if this was the case in earlier iOS versions, but there are currently different default system fonts used for each out of Chinese, Japanese and Korean.
When an iPhone displays Chinese, Japanese or Korean text, it will begin by looking in the current system default font for the required character. If it doesn’t find it, then it seems to fall back to the default system font specific to the language with which that character is primarily associated.

The default system font is changed when switching between the three languages, and because all three fonts contain the Japanese Hiragana and Katakana characters, Japanese text will appear different when the iPhone system language is set to Chinese or Korean.

All pretty straightforward so far, but… if you happen to be using your phone to display Japanese text, while the system default language is set to anything other than Chinese, Japanese or Korean, which font does it choose?
Continue reading iOS7 fonts used for Japanese text

ORA-29284 File Read Error with UTL_FILE.GET_RAW

UTL_FILE.GET_RAW fails on long lines if the file is opened in text mode.

Today while debugging a previously developed PL/SQL package, I had to investigate an ORA-29284: file read error.
The cause was not immediately apparent, as the procedure had been reading in and parsing other files ok, and had read in this particular file just fine up until it reached a certain point.
The file being read was text rather than binary, but the code was using GET_RAW not GET_LINE since the process was not interested in line breaks. With a little investigation, it turned out that the place where the error occurred was when the procedure began trying to read from a line which was 175,000 characters long.

If you’ve used the functions in UTL_FILE, then you’ll know that functions like GET_LINE support a maximum line size and buffer size of 32767 bytes. However in this case, the call to GET_RAW was specifying a much smaller number of bytes to read. So why did it fail? Continue reading ORA-29284 File Read Error with UTL_FILE.GET_RAW