Posts

Showing posts from November, 2015

SQLcl Aliases & The Invisible Column Trick

Image
SQLcl is the bee's knees.

Problem Today I had a common problem. I wanted to reposition a column within a table. "Oh you should use views!"  "Never reference a table directly!"  "Column position should be meaningless!" I hear you shout. Yes but, look at this table definition.
PERSON table











FIRSTNAME,ADDRESS,PHONE,LASTNAME Doesn't that drive you mad. 
I want the order FIRSTNAME, LASTNAME, ADDRESS, PHONE Or worse. You decide to add a new column  (middlename) to your table definition script. create table person (firstname varchar2(100),                             middlename varchar2(100),                                  lastname varchar2(100),                                     address varchar2(100),                                       phone varchar2(100));
But you need to update the table right now alter table person add (middlename varchar2(100)); Your table definition script will generated a different table from your live table as the live tables &…