#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    3
    Rep Power
    0

    Q. about a couple of oracle commands


    hi all,
    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.

    thanks, waz.
  2. #2
  3. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    Hi,
    (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

    SELECT Item#,
    Ord_qty,
    DECODE(Size,'S', 'Small', 'M',Medium', 'L', 'large'),
    FROM Order_detail
    /

    If you are using Oracle9i then you can also use CASE....WHEN expression.


    Regards
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    11
    BTW, The CASE....WHEN expression is also available in 8.1.6.

    Cheers,
    Dan

IMN logo majestic logo threadwatch logo seochat tools logo