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

Pages

Friday, 1 April 2016

SQL-Least


This will give the least string.

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

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

LEAST LEAST
-------    -------
    a         saketh

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 Greatest                           
                            SQL Coalesce
Share this article :

2 comments:

  1. Hi Dayakar,

    In debt to you for making my learning on the SQL-Least area so hassle-free! I lay my faith on your writings.

    I am facing one ora-error while executing the procedure.
    ORA-06512: at "Lax.CLOSE_DUP"
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    Schema objects are the logical structures that directly refer to the database’s data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links.

    I am suspecting it could be length issue with some of variables I have declared inside procedure
    l_effectreqcount number;----> This is tracking no of records being fetched.
    l_postdata varchar2(999); ---> This is the variable for which I believe the error has come.
    The reason is that in this variable l_postdata I am concatenating all the data being fetched from cursor.it is something like this.

    THANK YOU!! This saved my butt today, I’m immensely grateful.

    Cheers,
    Mark

    ReplyDelete
  2. Hi Man,


    A spot on observation on what probably is “the” underlying details of the #topic.Too many people don’t even think about wherever there will be actual demand and more importantly what happens if this demand comes later (or maybe a lot later) than they expect


    1) How can I amend this select to make a sum & group by a single line....

    SELECT article_ref, status, total_amount
    FROM order_tbl
    GROUP BY article_ref, status, total_amount
    ORDER BY article_ref, status, total_amount;

    tbl_order
    article_ref status total_amount
    123456 Ordered 100
    123456 Ordered 10
    123456 Ordered 80
    123456 Pending 50
    123456 Pending 23
    123456 Pending 50
    123456 Delivered 50
    123456 Delivered 75

    And want the output to be
    123456 Ordered 190
    123456 Pending 123
    123456 Delivered 125









    It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
    Keep up the good work!

    ReplyDelete