MERGE Alias Bug – No Error Thrown When Using Wrong Alias

Alas

Back in the days, when I was just beginning working as an Oracle developer, I used to view Oracle Database Server as such a great piece of software to the extent where I wouldn’t even consider that a problem which I’ve just encountered wasn’t my fault, but Oracle’s bug!

Why am I bringing this up, you might ask? Well, a few weeks ago I’ve stumbled upon a weird bug in Oracle. I was using Oracle 11.2.0.1.0. Take a look at the below example: Continue reading

Searching in the source of a view

Let's take a view at it

Once upon a time… I needed to check in the source of which objects a particular character string was included.

LONG (the pun!…) story short, non of the {USER|ALL|DBA}_SOURCE views give you a chance to search in the source of the views.

“Well, why is that a problem?!” – I hear you saying – “Don’t you know the {USER|ALL|DBA}_VIEWS views views (wait, one views too many)?”

O my, but of course! There’s a column named TEXT in them with the source of the views! Let’s try that: Continue reading

Answer to Quiz #2: NULL in Aggregate Functions

Mind the NULL!

1 Quiz #2 – NULL in Aggregate Functions

Hello again! It’s due time to provide the answers for my second quiz – the one about NULL in aggregate functions.

In this particular quiz, it wasn’t the point to pick the correct choices, but rather figure out what will be the result of running each of the SELECTs. Continue reading

Quiz #2: NULL in Aggregate Functions

Impact of NULL in Aggreaget Functions

Aww. So dusty in here. Where have I been for the past seven months?!

Either way, it’s that time. Yep, you know what I mean – it’s the QUIZ TIME!

I’ve got a new quiz for you today:

What will be the result of running each of the SELECTs? Continue reading

Ho ho ho!

Christmas cookie for you: *

Sorry for not posting anything for a long time, but I’ve caught a terrible cold.

Anyway, I’d like to wish you a Merry Christmas and a Happy New Year! I also wish you health, fast SELECTs, interesting projects and raise_salary being called for you often!

PK

Answer to Quiz #1: Package Dependency

Packages and Dependent Objects

In my last post, I’ve challenged you with a quiz about package dependency. The question was about when a dependent object will be invalidated by Oracle when the package on which it depends is recreated.

The choices which give the “INVALID” status are:
Continue reading

Quiz #1: Package Dependency

Packages and Dependent Objects

I’ve got the following quiz for you today:

After running which of the following code snippets will the ‘INVALID’ status be returned?

Assumptions:

  • Version of Oracle: 11g R2.
  • Before each snippet is run, both dummy_pkg and print_message objects do not exist.

I’ll provide the answer in my next post.

The choices:
Continue reading

Text Index With a Sync Parameter

Subtitle is on holidays.

Oracle Text Index with SYNC (EVERY …) Parameter

Just a quick tip for today. Oracle allows us to create special kind of indexes on columns containing long texts. One of them is the CONTEXT type. You don’t need any particular privileges to create an index of this type (other than being able to create indexes in you schema). At least, that’s what the documentation says.

There was a question about creating a CONTEXT index on StackOverflow:

Can’t create oracle text index with sync every

Continue reading

Unit testing in Python

Quickly, quickly!

Unit Testing in Python Using unittest Module

The goal of this article is to provide a quick introduction to Python’s unit testing module called unittest. It is the essence, the very basic information you need to quickly start unit testing in Python.

Introduction to the unittest Module

Key points about unit testing in Python:

  • modules with tests should import unittest module,
  • tests should be defined inside a class extending the unittest.TestCase class,
  • every test should start with the test word,
  • if a test has a doc. comment (between a pair of ''', i. e. three apostrophes), the comment will be printed when the test is being run (if verbose mode was set),
  • tests can have setUp and tearDown methods – those methods will be called, respectively, before and after each of the tests; there are also class-level set up and tear down methods,
  • to execute the tests when the module is run, unittest.main() should be called,
  • to see which tests are called with additional info, the -v (verbose) parameter should be specified when the module with tests is executed.

Continue reading