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

Pages

Friday, 1 April 2016

SQL-Ln

This is based on natural or base e logarithm.

     Syntax: ln (value)     -- here value must be greater than zero which is positive only.

     Ex:
          SQL> select ln(1), ln(2), ln(null) from dual;

                        LN(1)      LN(2)          LN(NULL)
                        -------      ------------      ------------
                            0        .693147181

          Ln and Exp are reciprocal to each other.
            EXP (3) = 20.0855369

            LN (20.0855369) = 3


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

1 comments:

  1. Hello,

    SQL-Ln being contrived to exist for many projects simply so it can be run will be the first to hit the wall, but those projects where the functions to make existing transactions cheaper in real world applications will find the elusive real world demand.

    I am trying to use this in a materialized view and got below error:


    SQL Error: ORA-12015: cannot create a fast refresh materialized view from a complex query

    12015. 00000 - "cannot create a fast refresh materialized view from a complex query"

    *Cause: Neither ROWIDs and nor primary key constraints are supported for

    complex queries.

    *Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE

    option or create a simple materialized view.


    select IR.rowid MV_INST_LOBR_ROWID, J.rowid Job_ROWID, J.* FROM JOB J

    LEFT JOIN MV_INST_LOB_R IR ON

    (IR.I1503_CUST_AC_NO_PT1 = J.I3200_CUST_AC_NO_PT1 AND IR.I1503_CUST_AC_NO_PT2 = J.I3200_CUST_AC_NO_PT2 AND IR.I1503_INST_SEQ_NO = J.I3200_INST_SEQ_NO)

    WHERE IR.I1503_CUST_AC_NO_PT1 IS NOT NULL AND IR.I1503_CUST_AC_NO_PT2 IS NOT NULL

    UNION SELECT null, J.rowid Job_ROWID, J.* FROM JOB J WHERE J.I3200_CUST_AC_NO_PT1 IS NULL AND J.I3200_CUST_AC_NO_PT1 IS NULL;

    Basically, the intention is to get all the records joining MV_INST_LOB_R and JOB table
    where MV_INST_LOB_R do not have record for the joining condition J.I3200_CUST_AC_NO_PT1 / J.I3200_CUST_AC_NO_PT2


    Can you help me in converting to simple query, so that I can use simple materialized view.

    Follow my new blog if you interested in just tag along me in any social media platforms!


    ,Merci
    Radhey

    ReplyDelete