March 2011 archive

Columns to Rows

I was doing a code review of a view that would be going into production. The view’s SELECT statement was defined as: SELECT status.STATUS_ID, status.ITEM_ID, status.REQUEST_FLAG, status.ITEM_CODE, status.PLAN_CODE, status.STATUS_CODE FROM ( SELECT STATUS_ID STATUS_ID, ITEM_ID ITEM_ID, REQUEST_FLAG REQUEST_FLAG, ITEM_CODE ITEM_CODE, PLAN_CODE PLAN_CODE, STATUS_CODE_1 STATUS_CODE FROM SCHEMA1.STATUS_TABLE UNION ALL SELECT STATUS_ID STATUS_ID, ITEM_ID ITEM_ID, REQUEST_FLAG REQUEST_FLAG, …

Continue reading

Fun With Database Restore

I was recently given a copy of an Oracle database that I needed to bring up in our environment. The only other requirement I had was to change the database name. Changing the database name means I must create the control files anew and restore using a backup control file. On examination of the database …

Continue reading