September 10, 2002
What not to do with SQL
I'm busy redoing our database classes to not be oracle specific.. ran accross this gem:
"SELECT MAX(NVL(COLUMN_NAME,0)) + 1 NEW_VAR FROM TABLE_NAME"
Which creates a new variable, select a max on a column, sets that value on a new variable and returns that..
Which accomplishes the same as this:
"SELECT MAX(COLUMN_NAME) FROM TABLE_NAME" + add 1
which is not oracle specific and more efficient on top of that..
Posted September 10, 2002 02:00 PM in Geek Stuff
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/112
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/112
Comments