September 25th, 2003, 12:41 AM
Q. about a couple of oracle commands
got a couple of 'how to' questions about a couple of oracle commands.
First one is how do u get items in a column that you have produced from a select statement to be aligned to the right.
Second, is it possible to rename an item in a report that you have produced. For example if in the table that you created the report off, there is a column called head size and the values in that column are either S,M,L. but in the report u want those values to appear as Small, Medium,Large.
September 25th, 2003, 09:13 AM
(1) You can specify alignment of a column value using SQL*Plus command:
for example in 'emp' table, you want column 'ename' to be appear right justified.
SQL>COLUMN ENAME JUSTIFY RIGHT
(2) DECODE funtion provides IF.... THEN.....ELSE implementation in SELECT statement. For example
DECODE(Size,'S', 'Small', 'M',Medium', 'L', 'large'),
If you are using Oracle9i then you can also use CASE....WHEN expression.
September 25th, 2003, 01:33 PM
BTW, The CASE....WHEN expression is also available in 8.1.6.