Total Pageviews

2013/04/23

The Software Craftsman


Top 10 Traits of a Rockstar Software Engineer

  1. Loves To Code
  2. Gets Things Done
  3. Continuously Refactors Code
  4. Uses Design Patterns
  5. Writes Tests
  6. Leverages Existing Code
  7. Focuses on Usability
  8. Writes Maintainable Code
  9. Can Code in Any Language
  10. Knows Basic Computer Science

2013/04/15

Test a string for a numeric value


Environment 
Oracle 11g

Problem

I write wrong value into specific column, it should accept numeric only.


Solution

To test a string for numeric characters, you could use a combination of the length function, trim function, and translate function built into Oracle.

You can use the following command:




This function will return a null value if vio_yr is numeric. It will return a value "greater than 0" if vio_yr contains any non-numeric characters.


Reference: http://www.techonthenet.com/oracle/questions/isnumeric.php

2013/04/09

ALL_TAB_COLUMNS Usage

Environment 
Oracle 11g 

Problem 

Customer requests to update ACS_NO this column length from 8 to 10. But I have more than 100 tables in my system, how do I quickly get the table which have ACS_NO column? 

Solution 

Making good use of ALL_TAB_COLUMNS. ALL_TAB_COLUMNS provides by Oracle, it describes the columns of the tables, views, and clusters accessible to the current user. 

We can use this SQL statement to find out the result:



See....we can get the result easily, and start to author alter table script.



Reference : http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2094.htm