Regular expressions can save you hours or even days of work in some cases. For anyone not yet familiar with regular expressions, I definitely recommend to get to know at least the basics. That’s what Tanel Poder advised his readers and I agree with him. To that end, here is a list of resources (in no specific order) that will help you and me understand and learn regular expressions:
And here is a list of Oracle related regular expressions links:
Note that Oracle regular expressions support started with the Oracle database version 10gR1 and above.
Filed in Links with 4 Comments | Tags: Links, regular-expressionI have stumbled upon the following presentation by Mark Townsend, the vice president of database product management, titled The Future of Database Technology. Towards the middle of the presentation, there is a high level overview of many Oracle database 11g features like SQL replay, online table and index redefinition, automatic diagnostic workflow, support for online hot patching and other highlights.
Here is the full document: (more…)
Filed in Oracle with 2 Comments | Tags: 11gReading through other programmers’ code I often discover interesting things that sometimes I find hard to explain. For example, consider the following simple PL/SQL block:
DECLARE CURSOR emp_cur IS SELECT first_name FROM employees WHERE employee_id = 100; l_emp_name employees.first_name%TYPE; BEGIN IF emp_cur%ISOPEN THEN CLOSE emp_cur; END IF; OPEN emp_cur; FETCH emp_cur INTO l_emp_name; CLOSE emp_cur; END;
The PL/SQL package I was reviewing had the same exact pattern for every query. Basically, every query was declared as an explicit cursor and code similar to the above was used to open, fetch and close every cursor in the program.
I do not understand two things here: the need for an explicit cursor, and the need for this “IF cur%ISOPEN THEN CLOSE cur; END IF;” before “OPEN cur …. CLOSE cur“. Do you?
I would have coded the above like this:
DECLARE l_emp_name employees.first_name%TYPE; BEGIN SELECT first_name INTO l_emp_name FROM employees WHERE employee_id = 100; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line ('Not found'); END;
In this example, since the employee_id is the primary key of the employees table, there is no need to code for the TOO_MANY_ROWS exception.
Andrew Clarke has a good post about implicit and explicit cursors in response to Misbah Jalil’s post about the same subject. And here is a virtual book about cursors in Oracle DB 10gR2.
Filed in Oracle with 7 Comments | Tags: cursor
As you may already know, Google recently released Google Gears, an open source browser extension that lets developers create web applications that can run offline using JavaScript APIs.
Google Gears provides three key features:
Apart from the coolness and usefulness of Gears (I can now read my Google Reader feeds offline), what also caught my attention was its use of a database to store and access data. After all, that’s what databases are good at, data storage and management. I was curious to know what type of a database Gears uses. Well, according to its database module API, Google Gears uses the open source SQLite database system.
SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.
SQLite is really interesting. There is no set up procedure to initialize it before using it. Databases need minimal or no administration. There is no need to maintain a separate server process dedicated to SQLite. It supports ACID and is thread-safe.
SQLite supports a large subset of SQL-92 data definition and manipulation features. You can create tables, indexes, triggers, and views. You can manipulate stored information using INSERT, DELETE, UPDATE, and SELECT SQL constructs. However, some SQL-92 features are not yet supported.
SQLite stores an entire database in a single, ordinary native file that can reside anywhere in a directory of the native file system. Any user who has a permission to read the file can read anything from the database.
What’s also interesting about SQLite is its size. The whole code footprint ranges from 224KB up to 513KB depending on what compiler optimizations are used. I downloaded the pre-compiled SQLite binaries for windows, it is just one 359KB file, sqlite3.exe.
sqlite3 is somewhat similar to Oracle’s SQL*Plus. You can use it to enter SQL commands. For example, from the DOS command prompt, the following creates a database file named eddie.db:
C:\Users\Eddie\Documents\sqlite>sqlite3 eddie.db
SQLite version 3.3.17
Enter “.help” for instructions
sqlite>
Now, let’s do some DML and DDL:
sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values(‘hello!’,10);
sqlite> insert into tbl1 values(‘goodbye’, 20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite> CREATE TABLE tbl2 (
…> f1 varchar(30) primary key,
…> f2 text,
…> f3 real
…> );
sqlite>
Does SQLite have a data dictionary? Yes it does, and it’s only one table called sqlite_master:
sqlite> select * from sqlite_master;
table|tbl1|tbl1|2|CREATE TABLE tbl1(one varchar(10), two smallint)
table|tbl2|tbl2|3|CREATE TABLE tbl2 (
f1 varchar(30) primary key,
f2 text,
f3 real
)
index|sqlite_autoindex_tbl2_1|tbl2|4|
sqlite>
Interesting. Going back to Gears, if you are wondering where the location of the database file is, it basically depends on the browser and the platform you are using.
If you are wondering what can SQLite be used for, of course, you have Google Gears as a perfect example. But, there are other appropriate uses as well.
By now, you may be thinking about Oracle Database Express Edition as also being an entry-level, small-footprint database, but hey, SQLite does not even come close to Oracle XE. Each one serves and is suitable for different types of applications. Moreover, do you really think that a 359KB RDBMS can put a dent into a 165MB RDBMS?
Filed in Oracle, Technology with Comments Off | Tags: sql, sqlite, sqlplus, xeI have lost confidence in Oracle’s ANSI style SQL. Eric, in his comment to the post Back to basics: anti-joins and semi-joins, warned me of the following gotcha:
If you are writing queries that select from many tables, like denormalizing data for warehousing, and the sum of the columns in those tables exceeds 1,050, you’ll always get ORA-01445. This occurs from 9i through 10g2, and has happened often enough to me that I avoid my preference for ANSI syntax on Oracle databases, unless I’m just selecting from a few tables.
Well, it just happened to me. Below are two queries. They both select from standard Oracle E-Business Suite (11.5.10) tables. The two queries are identical except that the first uses the ANSI style syntax, and the second uses the Oracle syntax. As you can see below, the query that uses ANSI joins failed miserably with the error:
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table.
This looks like a bug to me. Interestingly, if you change the SELECT NULL to SELECT COUNT(*), the query executes successfully. (more…)
Filed in Joins, Oracle with 17 Comments | Tags: concepts, joinOracle SQL Developer, the free graphical tool for database development, has just been upgraded from 1.1 to 1.2. Here is the list of bug fixes and here is the release notes document including new features and known issues.
If you are already running production release 1.1 (v 1.1.0.23.64) or above, you can use Help > Check for Updates to update your SQL Developer environment. Otherwise, you can download Oracle SQL Developer 1.2 from here.
Filed in Oracle with 1 Comment | Tags: sql-developerHere is the email I received from Oracle:
Dear Edward Awad,
The history of information technology is a journey, defined by innovations such as the internet and grid computing. Oracle would like to personally welcome you to see the next generation of innovation by inviting you to the launch of Oracle Database 11g.
This is your opportunity to join Oracle President Charles Phillips and Oracle Senior Vice President Andy Mendelsohn, as well as leading industry experts from some of the most innovative companies of our time. Collectively, they will help you understand what’s needed to compete at this point in history, and how Oracle’s latest database release will help meet those needs.
The launch event is going to take place on July 11 in New York city.
Moreover, watch for 11g demos up on Morgan’s Library within a week of the production release.
Filed in Oracle with 1 Comment | Tags: 11g, OracleResumes seem to be mostly useless, this is what Andrew Wulf thinks, and I can’t agree more. I have been conducting a few interviews lately to fill a PL/SQL contract position, and in almost all cases the resume was so overcharged with buzzwords and all kinds of technologies created in the past 10 years. However, when the moment of truth (the interview) comes, few candidates know the answer to very basic questions.
Moreover, the resumes I have seen were obviously made to order. I know that when I get the resume as an email file attachment and the Word document file name is something like: JohnDoeCompanyName.doc. This is an obvious hint that a different Word document (resume) is created for every company the staffing agency or the candidate submits the resume to. They basically tailor the resume to the specific job requirement the hiring company is looking for.
I totally agree with these quotes from Andrew Wulf’s article:
In any case, here are a few links to Oracle interview questions:
I’m not a big fan of blogrolls. A blogroll is a collection of links to other blogs. I believe what’s more interesting and useful is to have a a collection of links to other blog posts and web pages, or a linkblog. Some bloggers use the shared items in Google Reader as their linkblog. Robert Scoble uses this approach for his famous linkblog.
But even a linkblog can be limiting. What if you want to blog not only links, but also photos, quotes, dialogues and video, quickly and easily. Well, there is a special type of blog, called tumblelog, that does exactly that. Unlike blogs, there is no commenting on tumblelogs.
I like this tumblelog idea. So I set up one, Eddie Awad Randomized (feed). I’ll be posting interesting, educational, useful or just plain fun tumbles, Oracle and non-Oracle related. I also set it up to to automatically import my shared items in Google Reader. But unlike Google Reader’s shared items, I can search my tumblelog using any known blog search service.
Eddie Awad Randomized is powered by tumblr, a free and extremely easy online tool for creating tumblelogs.
Note: I’m writing this blog post using Windows Live Writer, I like it.
Filed in Links, Oracle, Technology with 5 Comments | Tags: blog, Links