Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Friday, 1 April 2016

SQL-Greatest


This will give the greatest string.

     Syntax: greatest (strng1, string2, string3 … stringn)     

     Ex:
           SQL> select greatest('a', 'b', 'c'), greatest('satish','srinu','saketh') from dual;

GREAT GREAT
-------  -------
    c         srinu

If all the parameters are nulls then it will display nothing.
 If any of the parameters is null it will display nothing.



You May Like                                             
                            SQL Abs
                            SQL Sign
                            SQL Sqrt
                            SQL Mod
                            SQL NVL
                            SQL NVL2
                            SQL Power
                            SQL Exp
                            SQL Ln
                            SQL Log
                            SQL CEIL
                            SQL Floor
                            SQL Round
                            SQL Trunc
                            SQL Bitand                          
                            SQL Least
                            SQL Coalesce
 
Share this article :

2 comments:

  1. Hi dayakar,

    Smokin hot stuff! You’ve trimmed my dim. I feel as bright and fresh as your prolific website and blogs!


    CREATE table irt_test
    (
    mob numeric(20),
    acct varchar(20),
    mmid varchar(20),
    err_msg varchar(20),
    )

    insert into irt_test(MOB,ACCT,MMID) values(999,123,456)
    insert into irt_test (MOB,ACCT,MMID)values(999,123,456)

    insert into irt_test (MOB,ACCT,MMID) values(102,856,987)
    insert into irt_test (MOB,ACCT,MMID) values(102,625,987)

    insert into irt_test (MOB,ACCT,MMID) values(632,152,954)
    insert into irt_test (MOB,ACCT,MMID) values(632,962,357)



    If mob,acc and mmid
    is repeated then i want to update as duplicate mob,acct,mmid
    if for same mob and same repeated then i want to update as Duplicate MMID FOR same MOB


    select * from irt_test

    Expected result

    mob acct mmid err_msg
    999 123 456 Duplicate record mob,acct and MMID
    999 123 456 Duplicate record mob,acct and MMID

    102 856 987 Duplicate MMID for same MOB
    102 625 987 Duplicate MMID for same MOB
    632 152 954
    632 962 357

    Thanks a lot. This was a perfect step-by-step guide. Don’t think it could have been done better.

    Many Thanks,
    Irene Hynes

    ReplyDelete
  2. Hi Dayakar,

    I learnt so much in such little time about Oracle Applications. Even a toddler could become smart reading of your amazing articles.

    We had requirement that we need to alter table which contains huge data nearly 25 millions records.
    Its range partitioned table and having 60 Partitions.
    We want to add some extra columns to the same table.

    Obviously it will take more time. What is the efficient way of doing this?
    Do I need to disable all the indexes or Table gathering

    I know that when we have bulk insertions into the table, disabling the indexes will help .
    When we are selecting the data by applying indexed column where conditions, gathering statistics will help.

    But in this case PARALLE HINT will help?
    or
    Do I need to go the Multi columns alter?
    or
    Do we have any other best solution?

    Please help me to resolve the problem

    Details : Table Size : 25 Millions Records
    No of Partitions : 60
    Partition Type : Range Partition on EntryDate Column
    Oracle Version :Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production.

    By the way do you have any YouTube videos, would love to watch it. I would like to connect you on LinkedIn, great to have experts like you in my connection (In case, if you don’t have any issues).

    Gracias,
    Sandy

    ReplyDelete