25/02/2013

Oracle delete purge object

In Oracle, when you delete a table with the DROP TABLE statement (or another object for that matter), it's not definitevly deleted as it goes instead into the recycle bin. This can be good as you may recover your objects with the FLASHBACK command but can also cause issues if other objects depend on or refer to the deleted one.

To permanently delete the object, you can either disable the recycle bin or use the PURGE command along with you DROP statement.

Oracle test if nested table has elements

If you're using nested tables in Oracle and need to check wether they're empty or not, you can use the IS EMPTY statement:

SELECT nt.*
FROM myTable t, TABLE(t.myNested) nt
WHERE t.myNested IS [NOT] EMPTY;

Oracle get nested table element value without column name

In Oracle, if you have a nested table with a single unnamed column (usually named simply "element"), you can access its value by using the COLUMN_VALUE keyword:

SELECT nt.COLUMN_VALUE
FROM myTable t, TABLE(t.myNested) nt;

07/02/2013

Oracle get MAX or MIN between multiple values

In order to get the MAX or MIN between multiple values (NOT just numbers!) you can respectively use GREATEST or LEAST.

NOTE: beware! If one of the parameters you pass is NULL, then the function will return NULL!

Windows 7 enable Telnet client

So, you're happily using Windows 7 when suddenly you feel the urge to Telnet but your console says: 'telnet' is not recognized as an internal or external command, operable program or batch file.

If you get this error, you must add the Telnet client to your Windows installation. Go to Control panel->Programs and features->Turn Windows features on or off then scroll down to "Telnet Client", check it and press OK.
Now wait until installation is complete and you're done!