Tuesday, May 12, 2009

Oracle SQL: ROWID Pseudocolumn

Again, one of my students asked me a question during the Oracle 11g Introduction to SQL class.

"How would you delete only 1 record of 2 identical records, all with same column values and there is no PK (Primary Key) to uniquely identify them?"

I told her that we can make use of the ROWID pseudocolumn.The ROWID pseudocolumn returns the physical address of the row. Oracle Database rowid values contain information necessary to locate a row:
  • The data object number of the object
  • The data block in the datafile in which the row resides
  • The position of the row in the data block (first row is 0)
  • The datafile in which the row resides (first file is 1). The file number is relative to the tablespace.

Usually, a rowid value uniquely identifies a row in the database. However, rows in different tables that are stored together in the same cluster can have the same rowid. Values of the ROWID pseudocolumn have the datatype ROWID or UROWID.

Rowid values have several important uses:

  • They are the fastest way to access a single row.
  • They can show you how the rows in a table are stored.
  • They are unique identifiers for rows in a table.

You should not use ROWID as the primary key of a table. If you delete and reinsert a row with the Import and Export utilities, for example, then its rowid may change. If you delete a row, then Oracle may reassign its rowid to a new row inserted later.

Although you can use the ROWID pseudocolumn in the SELECT and WHERE clause of a query, these pseudocolumn values are not actually stored in the database. You cannot insert, update, or delete a value of the ROWID pseudocolumn.

The ROWID Demo

To simulate the scenario, I created a sample table named Test:
SQL> CREATE TABLE Test
(test varchar2(10));
Then, I inserted two identical records with no primary key
SQL> INSERT INTO Test
VALUES ('Test1');
SQL> INSERT INTO Test
VALUES ('Test1');
Then, selected the rowid of two identical records
SQL> SELECT rowid, test
FROM Test;
Then, the query returned

ROWID TEST
-------------------- ---------------
AAASDcAAEEAADOMAAA Test1
AAASDcAAEEAADOMAAB Test1
Then, I tried to delete one of the two identical records
SQL> DELETE FROM Test
WHERE rowid = 'AAASDcAAEEAADOMAAA';
Then, the result says 1 row deleted

Yey, we've successfully deleted one of the two identical records. ^_~

Tuesday, May 5, 2009

Oracle SQL: Traditional Outer Join Syntax

I was teaching Oracle 11g SQL Fundamentals and PL/SQL Fundamentals course when one of my students asked me a startling question right after I've discussed JOIN topic.

"What's the difference of using the JOIN keyword and using the (+) for joining of tables?"

Then, he showed me a SQL script using the (+) syntax and explained to me that his mentor taught him to use this syntax and that they are also using this SQL syntax in all their systems and applications.

For a while, I wondered... because I've never encountered this (+) syntax with Oracle 9i, 10g and 11g books and course materials. I told him, maybe it was the old JOIN syntax being used by earlier versions of Oracle.

To support my wild guess... that it is really an old JOIN syntax still supported by Oracle, I started to google about it and I landed on Oreilly's
Oracle SQL*Plus Pocket Reference, 2nd Edition, by Jonathan Gennick, sample chapter excerpt: http://oreilly.com/catalog/orsqlpluspr2/chapter/ch01.html


According to the book, the (+) syntax for joining tables is an old syntax for outer joins until Oracle 8i. An outer join returns rows for one table, even when there are no matching rows in the other. You specify an outer join in Oracle by placing a plus sign (+) in parentheses following the column names from the optional table in your WHERE clause. For example:
SELECT ut.table_name, uc.constraint_name
FROM user_tables ut, user_constraints uc
WHERE ut.table_name = uc.table_name(+)

The (+) after uc.table_name makes the user_constraint table optional. The query returns all tables, and where there are no corresponding constraint records, Oracle supplies a null in the constraint name column. Full outer join is not supported using the (+) syntax.

At the release of Oracle 9i and later versions, full outer join is already supported using the JOIN syntax. 

SELECT ut.table_name, uc.constraint_name
FROM user_tables ut FULL OUTER JOIN user_constraints uc
ON ut.table_name = uc.table_name

Although you could still use the old (+) syntax for outer joins for backward compatibility, Oracle strongly encourage to use the new JOIN syntax for full outer join support. 

Wednesday, February 4, 2009

CamStudio - Open Source

CamStudio is an open-source and free streaming video software which is able to record all screen and audio activity on your computer and create industry-standard AVI video files and using its built-in SWF Producer can turn those AVIs into lean, mean, bandwidth-friendly Streaming Flash videos (SWFs).


Cool, right? ^_^

So, when can you use this FREE software?
  • You can use it to create demonstration videos for any software program
  • You can create video tutorials for school or college class
  • You can use it to record a recurring problem with your computer so you can show technical support people
  • You can use it to create video-based information products you can sell
  • You can even use it to record new tricks and techniques you discover on your favourite software program, before you forget them

CamStudio can also add high-quality, anti-aliased (no jagged edges) screen captions to your recordings in seconds and with the unique Video Annotation feature you can even personalise your videos by including a webcam movie of yourself "picture-in-picture" over your desktop.

And if all that wasn't enough, CamStudio also comes with its own Lossless Codec that produces crystal clear results with a much smaller filesize compared with other more popular codecs, like Microsoft Video 1.

You have total control over the output of your video: you can choose to use custom cursors, to record the whole screen or just a section of it and can reduce or increase the quality of the recording depending on if you want smaller videos (for emailing to people, for instance) or you can have "best quality" ones for burning onto CD/DVD.

For more details, check out their website - http://camstudio.org/

Tuesday, June 24, 2008

Real-Time Collaboration of Flow Charts

Meeting face to face with all the people involved in the system is quite difficult due to schedule conflicts. As I search for a way for me and our client to talk about the actual business processes while both of us design the flowchart without the need of meeting up, I came upon http://www.flowchart.com

Flowchart.com is an online multi-user, real-time collaboration flowchart software. Flowcharting made easy. It does not require any software download, it works with your favorite browser such as Fire Fox, IE, Opera, Safari, Konquerer plus it works on any Operating System.

Create and share your flowcharts for free! This is a very useful tool for teams whose members are working remotely. You can collaborate with your colleagues in real-time. All collaborating parties can chat and design a flowchart at the same time.

Below are the features of flowchart.com:
  • Free
  • Easy to use
  • No plugins to install
  • Works in all browsers
  • Drawing Tools (Lines, Arrows, Curves) and objects (flowchart objects, clipart)
  • Real-time online collaboration between multiple users with different browsers
  • Save your flowchart as a PDF or PNG formats
  • Upload your original clipart and use it in your flowchart, or share them with the community, or sell them.

Tuesday, June 10, 2008

Using SE K610i Mobile Phone as Modem

Last month, our office's internet connectivity was down for 1 week and our work was affected. I got dismayed with Globe and PLDT customer service as the support came too late. Internet has been quite a necessity in my everyday life so I came up with an alternative solution - using my 3G mobile phone as a modem.

Luckily, Globe also offers competitive connectivity rates such as Smart for Php10.00/30 mins. Just switch from per KB charging rate (the default) to time based charging rate by texting TIME to 1111 and you would be receiving the confirmation within an hour. You are now ready to surf!

Overview of Sony Ericsson K610i Phone


A compact classic

Slim, elegant, with a back-lit keypad and large screen; you can access the most used functions in one or two steps and talk and surf at the same time.

Big on business

Push email and PC synchronisation ensure you’re always on top of things; and it’s a high-speed modem to connect your PC to the Internet on the go.

Enjoy the small world

News and events are at your fingertips with RSS feeds, and you’ve got music, video and games to entertain you in flight or when you deserve a break.

Size does matter

One of the smallest 3G phones available, it’s packed with powerful features including a discreet quality camera and always-on, high speed Internet.

Getting ready to surf the Internet
  • Connect the mobile phone to the PC thru USB cable provided with the unit.
  • Choose Phone Mode when prompted in the mobile phone screen.
  • Open Sony Ericsson PC Suite 3.1 and phone would be detected as modem.
  • PC Suite would be in phone mode and screen would be shown like in the figure below.

  • Click Internet Connection and this screen would be shown.

  • Click connect and the phone modem would establish connection.



  • When connection is estbalished, this screen would be displayed.


Voila! You can now enjoy surfing the internet. =) An alternative way of connecting to the internet - the mobile way. ^_~

Tuesday, June 3, 2008

no {frills}: the philippine {heroes }community launch event

Organized by PHINUG, PHISSUG and PHIWUG

Date:
June 7, 2008


Venue: Windows Vista, Exchange and Office Rooms - Microsoft Philippines
16/F 6750 Ayala Office Tower, Ayala Avenue, Makati City

Admission: Php 100

***Visual Studio Track

Developing with Windows Live SDK by Roman Canlas
WCF: SOA and Beyond by Warren Yu
Silverlight Unit Testing by Jonjon Limjap
Migrating your applications to ASP.NET 3.5 by Eduardo Lorenzo

***Microsoft SQL Server 2008 Track

SQL Server 2008: Reporting Services 101 by Glenn Gamboa
CASE: “The Always Available Simple Search Application” by Vince Azcuna and Glenn Gamboa
SQL Server 2008: TSQL Enhancements (Change Data Capture + Table Valued Parameters) by Michael Corpuz

***WIndows Server 2008 Track

Windows Server Management
Windows Server Clustering by Randy Datan
Windows Deployment Services by Jay-R Barrios
Windows Server Terminal Services by Chester Coronel and Jasper Jugan

Sign up now for this event at http://www.clicktoattend.com/?id=128964

Tuesday, May 20, 2008

[PHP User Group Philippines] tri{php}letreat@USAutoPartsPhilippines - May 24, 2008

Brought to you by PHP User Group Philippines, Inc. (PHPUGPH)
In cooperation with US Auto Parts Network (Philippines) Corp.

Event Details

Date: May 24, 2008
Time: 9:00 AM - 5:00 PM
Venue: US Auto Parts Network (Philippines) Corp.
Training Room 6/F RCC Center 104 Shaw Blvd. Pasig City
(Near Jade Palace)

Topics

Search Engine Optimization (SEO)
Riz Sanchez, SEO Manager, US Auto Parts Network (Philippines) Corp.

Model-View-Controller (MVC) 101: A Web Development Architecture
Reynold Lariza, Web Development Supervisor, Glocorp IT Solutions, Inc.

Web Application Security by Example
Richard Peter Ong, Lead Developer, Internal Projects, SysIQ Inc.

Event Fee

Php 500.00/head (inclusive of lunch and snacks)

*refundable Php 100 for attendees who have resumes, refundable Php 50 for early birds

PHP 350.00 for those early bird with resume.
PHP 450.00 for those who don't have resume.

Note:
Limited seats, good only for 35 slots. First come, first serve basis. Registration is open until May 22, 2008. Your registration expires if no payment is made within 2 days.

Payment Details

All payments must be made within 2 days after online registration through bank deposit.
Bank account details are listed below:

Bank: BPI Family Savings Bank
Account No: 6006-6267-67
Account Name: Cherrie Ann B. Domingo

Scanned deposit slips should be sent to chean@phpugph.com for payment confirmation.

Registration

While waiting for official PHPUGPH.COM registration page please register on this temporary link: http://phpugph.wufoo.com/forms/php-user-group-philippines-event/


Contact Us

For more details or any other inquiries, kindly contact Cherrie Ann B. Domingo at: +639178652412(Mobile), (632) 7253053(Office), chean@phpugph.com(E-mail) or visit our website at http://www.phpugph.com