Function of lag ignoring NULL values in 10g

I have the following query that works well in 11g. I want to rewrite the query in 10g and get the same set of results. Because the offset ignoring NULL values, I used below is a new feature in 11g, someone can help me in rewriting the query below.

Prop1 - String, evar11 - String

Select prop1, evar11,.

lag (Prop1 ignores Nulls) over (partition by order of period_key of visit_page_num, visit_num, visid_low, visid_high) as prop1_lag
from TABLE_A

where period_key = '20131012' - DATE

order of visit_page_num

Thanks in advance,

H.

Hello

In Oracle 10, you can use LAST_VALUE... ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PREVIOUS instead of LAG.

As I don't have your table, I'll use scott.emp to illustrate:

SELECT hiredate, ename, comm

MOST LAG (comm IGNORE NULLS) (ORDER BY hiredate, ename) AS lag_comm

, LAST_VALUE (comm IGNORE NULLS) OVER (ORDER BY hiredate, ename)

ROWS BETWEEN UNBOUNDED PRECEDING

AND 1 PRECEDING

) AS last_value_comm

FROM scott.emp

ORDER BY hiredate, ename

;

The output shows that LAG and LAST_VALUE produce the same results:

HIREDATE ENAME LAG_COMM LAST_VALUE_COMM COMM

--------- ---------- ---------- ---------- ---------------

DECEMBER 17, 80 SMITH

FEBRUARY 20, 81 300 ALLEN

FEBRUARY 22, 81 WARD 500 300 300

2 APRIL 81 JONES 500 500

MAY 1, 81 BLAKE 500 500

JUNE 9, 81 CLARK 500 500

08 SEP-81 TURNER 0 500 500

28 SEP-81 MARTIN 1400 0 0

NOVEMBER 17, 81 1400 1400 KING

DECEMBER 3, 81 1400 1400 FORD

DECEMBER 3, 81 JAMES 1400 1400

JANUARY 23, 82 1400 1400 MILLER

APRIL 19, 87 SCOTT 1400 1400

MAY 23, 87 1400 1400 ADAMS

To run the Oracle 11.1 or earlier, comment out the call to the LAG.

Tags: Database

Similar Questions

  • Lag() ignore null values performance

    Hello

    I have looked around, but didn't find everybody talks about performance problems specifically with the use of 'IGNORE NULLS' inside of an analytic function of LAG() in a view online.

    This is a cut from the version of my sql, isolated to the question under discussion.

    select * from (
      SELECT /* use_nl (j,gjt,jt) */
         jt.id
        ,COALESCE
          (lag(jt.my_column ignore nulls /* this is the nasty critter */
            ) over (order by jt.order_seq)
          ,0
          )+1 AS start_days
        ,coalesce
          (jt.my_column
          ,last_value(jt.my_column ignore nulls
            ) over (order by jt.order_seq desc)
          ) AS end_days
      FROM  a,bunch,of,tables
      WHERE ...
      ) jt 
    where jt.id = '123456'
    

    If I remove ignores NULL values in the offset, there is no performance problem.

    Last_value() is not affected.

    If I do not use a view inline then performance is very good, although it is no different to explain the plan.

    select ..
    from ...
    where ...
    and id = '123456'
    

    Has anyone come across something like this, or have any suggestions?

    Happy to try to build a test scenario if it contributes to the discussion, but I thought I would just ask the question first.

    Scott

    Scott.Wesley wrote:

    Hello

    I have looked around, but didn't find everybody talks about performance problems specifically with the use of 'IGNORE NULLS' inside of an analytic function of LAG() in a view online.

    If I remove ignores NULL values in the offset, there is no performance problem.

    Last_value() is not affected.

    If I do not use a view inline then performance is very good, although it is no different to explain the plan.

    1. Select...
    2. Of...
    3. where the...
    4. and id = '123456'

    Scott,

    He would not have anything to do with your real problem, since you say that you get different performances during the removal of the IGNORE NULLS clause, but I doubt that you get exactly the same execution plan when online display is deleted these two queries are typically semantically the same.

    If you use the inline view, Oracle cannot push the filter on the ID in the view if the analytical functions partitions not by this ID, because the result will not be the same for the steps: with the online mode, the data is transformed without filtering for the evaluation of the expressions of the LAG etc, and then the filter is applied.

    If you remove the inline view and filter directly, it has a quite different meaning because now the data will be filtered first and then the analytical functions apply to the filtered result set.

    So the case of inline view maybe has to deal with a completely different volume (larger) identical to the variant of view data not online according to the selectivity of the filter - which could explain that the clause "IGNORE NULLS" made a significant difference in performance on this larger volume of data to deal with, but not necessarily.

    Randolf

  • function of nth_value() with IGNORE NULLS in oracle 10g

    Is there an easy way to imitate the function of ORACLE 11 g nth_value() with IGNORE NULLS clause in 10g or earlier version of Oracle?
    SQL> select  ename,
      2          sal,
      3          nth_value(sal,5) over() fifth_min_sal
      4    from  emp
      5    order by sal
      6  /
    
    ENAME             SAL FIFTH_MIN_SAL
    ---------- ---------- --------------
    SMITH             800           1250
    JAMES             950           1250
    ADAMS            1100           1250
    WARD             1250           1250
    MARTIN           1250           1250
    MILLER           1300           1250
    TURNER           1500           1250
    ALLEN            1600           1250
    CLARK            2450           1250
    BLAKE            2850           1250
    JONES            2975           1250
    
    ENAME             SAL FIFTH_MIN_SAL
    ---------- ---------- --------------
    SCOTT            3000           1250
    FORD             3000           1250
    KING             5000           1250
    
    14 rows selected.
    
    SQL> select  ename,
      2          sal,
      3          min(case rn when 5 then sal end) over() fifth_min_sal
      4    from  (
      5           select  ename,
      6                   sal,
      7                   row_number() over(order by sal nulls last) rn
      8             from  emp
      9          )
     10    order by sal
     11  /
    
    ENAME             SAL FIFTH_MIN_SAL
    ---------- ---------- --------------
    SMITH             800           1250
    JAMES             950           1250
    ADAMS            1100           1250
    WARD             1250           1250
    MARTIN           1250           1250
    MILLER           1300           1250
    TURNER           1500           1250
    ALLEN            1600           1250
    CLARK            2450           1250
    BLAKE            2850           1250
    JONES            2975           1250
    
    ENAME             SAL FIFTH_MIN_SAL
    ---------- ---------- --------------
    SCOTT            3000           1250
    FORD             3000           1250
    KING             5000           1250
    
    14 rows selected.
    
    SQL> 
    

    SY.

  • JDev 11 g: problem view VO criteria ignore Null values

    Hello

    I don't know if it's a bug or do something wrong but here is my case:
    I created an original Version of a database table.
    In page view of all of VO, aaa I bind a variable named
    Then I add a criteria-> display I add an element of criteria including bing my previously create variable to an attribute of VO-> I have defined validation on "necessary".
    Then a race my request and made a few test/dev.

    After a while, I needed to change my display criteria 'optional' with 'Ignore Null values' checked.
    I changedit, run my application and the display criteria did not work... I don't add no rows returned when I went to my variable named "null".
    After 1 or 2 days to research, I managed to notice that in fact, an attribute is missing in my VO object source.

    I needed to add explicitly in the XML of the source of this attribute:
    GenerateIsNullClauseForBindVars = 'true '.

    in the desired so ViewCriteriaItem it ignores Null values.

    I tried various combinations of the interface for presentation but non of them generated this attribute set to "true".
    Only when I put the validation 'Optional' and ' ignore values null ' unchecked, GenerateIsNullClauseForBindVars = 'false' appears in the XML source code.

    Is this a bug?
    Here's my version JDev: Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407

    Jack

    To report a bug, you must go through the MOS (aka Metalink). You need a support contract valid to log into MOS.

    Timo

  • Group by to ignore the values null

    Hi all
    Oracle version 10 g 2
    Consider the scenario

    Table: point
    Columns: Itm_id, Itm_type, appl_y_n (VALUES VALID 'Y', ' n, NULL)

    I HAVE FOLLOWING ITEM TYPES.

    TYP1
    TYP2
    TYP3

    In this appl_y_n is applicable only to the item type typ1 and it can contain y, n, or null.
    Types of remaining elements of this field may contain any value, including null, but I want to ignore these values.
    ITM_ID     ITM_TYPE     APPL_Y_N
    1     TYP1     NULL
    2     TYP1     Y
    3     TYP1     N
    4     TYP2     NULL
    5     TYP2      NULL
    6     TYP3     NULL
    7     TYP3     NULL
    now I need a group of clause which must ignore values null to appl_y_n only for TYP1

    on top of the sample output must be
    ITM_TYPE     APPL_Y_N     CNT
    TYP1     YES     1
    TYP1     NO     1
    TYP2     NULL     2
    TYP3     NULL     2
    Query, that I use for this:

    Select ITEM_TYPE, COUNT (ITM_ID), decode (itm_type, 'TYP1', DECODE(APPL_Y_N,'Y','Yes','N','No')) APPL_Y_N
    of the order of the day
    Item_type group, decode (itm_type, 'TYP1', DECODE(APPL_Y_N,'Y','Yes','N','No'))

    But he's considering typ1 as null values.

    Please give me a solution that ignores null values

    Thanks in advance
    NM

    Hello

    Check the below. It will be useful.

    SQL >
    SQL > WITH t AS)
    2 SELECT 2 ITM_ID, 'TYP1' ITM_TYPE, 'Y' APPL_Y_N FROM dual UNION ALL
    3. SELECT 3 ITM_ID, 'TYP1' ITM_TYPE, "n" APPL_Y_N FROM dual UNION ALL
    4. SELECT 1 ITM_ID, 'TYP1' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
    5. SELECT 4 ITM_ID, "TYP2' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
    6. SELECT 5 ITM_ID, "TYP2' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
    7. SELECT 6 ITM_ID, "TYP3' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
    8. SELECT 7 ITM_ID, "TYP3' ITM_TYPE, APPL_Y_N double NULL)
    9 SELECT itm_type,
    10 DECODE (itm_type, 'TYP1', DECODE (appl_y_n, 'Y', 'Yes', "n","no")) appl_y_n,.
    11 COUNT (itm_id)
    12 FROM t
    13 WHERE NOT (itm_type = 'TYP1' AND APPL_Y_N IS NULL)
    14 group of itm_type,
    15 decode (itm_type, 'TYP1', DECODE (APPL_Y_N, 'Y', 'Yes', "n","no"))
    16 ORDER BY itm_type
    17.

    ITM_TYPE APPL_Y_N COUNT (ITM_ID)
    -------- -------- -------------
    TYP1 NO. 1
    TYP1 Yes 1
    TYP2 2
    TYP3 2

    SQL >

    Rgds
    Ameya

  • SQL: fill the same value, until it gets another NOT NULL value

    It's my main table

    CREATE TABLE MAIN (EMPNO INTEGER, DATE OF EFF_DT);
    INS IN HAND VALUES(1,'2013-01-01');
    INS IN HAND VALUES(1,'2013-03-01');
    INS IN HAND VALUES(1,'2013-05-01');
    INS IN HAND VALUES(1,'2013-07-01');
    INS IN HAND VALUES(1,'2013-09-01');
    INS IN HAND VALUES(1,'2014-01-01');


    It's my table of choice

    CREATE TABLE LKP (EMPNO INTEGER, TYPE_CD VARCHAR (10), EFF_DT DATE);
    INS IN LKP VALUES(1,'A','2013-01-01');
    INS IN LKP VALUES(1,'B','2014-01-01');

    My query:

    SALT
    M.EMPNO AS MAIN_EMP,
    M.EFF_DT AS MAIN_DT,
    L.TYPE_CD
    HAND M LEFT JOIN LKP L ON M.EMPNO = L.EMPNO AND M.EFF_DT = L.EFF_DT

    Result:
    MAIN_EMP MAIN_DT TYPE_CD
    2013-01-01 1A
    1 01-03-2013?
    1 05-01-2013?
    1 01-07-2013?
    1 01-09-2013?
    2014-01-01 1, B

    Expected result: (I need to get the same value, until I have a new value of research)

    MAIN_EMP MAIN_DT TYPE_CD
    2013-01-01 1A
    2013-03-01 1A
    2013-05-01 1A
    2013-07-01 1A
    2013-09-01 1A
    2014-01-01 1, B

    Please help me in this regard.

    Concerning

    KVB

    RaminHashimzade wrote:

    For 11g (ignores null values)

    SELECT M.EMPNO AS MAIN_EMP,

    M.EFF_DT AS MAIN_DT,

    NVL (L.TYPE_CD, lag(L.TYPE_CD ignore nulls) over (partition by M.EMPNO of M.EFF_DT order)) TYPE_CD

    HAND M

    LEFT JOIN LKP L

    ON M.EMPNO = L.EMPNO

    AND M.EFF_DT = L.EFF_DT

    order by 2

    ----

    Ramin Hashimzade

    It's not only 11g, which is also 10g

  • Offset and IGNORE NULLS for LEAD/LAG

    Hi all

    so far, I thought that I understood the functioning of LEAD and the DELAY, but after you add the IGNORE NULLS and a shift, I'm confused

    I created a Fiddle SQL that executes a 11 g R2, v$ version returns Oracle Database 11 g Express Edition Release 11.2.0.2.0

    CREATE TABLE vt (part INT, ord int, val INT);
    INSERT INTO vt VALUES(1, 1, 8);
    INSERT INTO vt VALUES(1, 2, 10);
    INSERT INTO vt VALUES(1, 3, 3);
    INSERT INTO vt VALUES(1, 4, NULL);
    INSERT INTO vt VALUES(1, 5, NULL);
    INSERT INTO vt VALUES(1, 6, NULL);
    INSERT INTO vt VALUES(1, 7, 2);
    INSERT INTO vt VALUES(1, 8, NULL);
    INSERT INTO vt VALUES(1, 9, 5);
    
    
    
    
    

    Arghhh, of course, I am wrong and the result is correct

    OFFSET 2 more IGNORE NULLS does not mean ""find the next non null from two lines after the current line ", there "find the 2nd non-NULL value from directly after the current line". "

    And to compensate FOR the 1, both rules will return the same result.

    This occurs when you are focused on a specific thing and not see the forest for the trees.

  • Ignoring the Null value or 0 for an average of

    Hello

    I don't code in Java, so I'm having a problem with a form.

    We have a form of training that adds the total of the sides and then is supposed to understand on average.  My problem is that the provided average is based on the average function canned for the field, so it's the calculation of all the fields, including those who have either a Null value or a zero.  Can someone help me with this please?

    By the way.  If the N.O. is checked, the coast is n/a.

    There are also five sections that will total all the sides and will need an average of these totals.

    Thanks in advance.

    Tom

    FTO Form SCRN SHOT.png

    Screenshot taken: 15/03/2013-21:09

    Here's a generic function to calculate the average of a group of non-empty fields.

    This function takes two parameters: an array of domain names at average and a Boolean value specifying if the function should return an empty string if the result was zero.

    function averageFields (fields, blankIfZero) {}

    var total = 0;

    var n = 0;

    for (var i in fields) {}

    var f = this.getField (fields [i]);

    v var = f.valueAsString;

    If {(v)

    total += (+ v);

    n ++ ;

    }

    }

    var returnValue = (n == 0)? ' ': total/n;

    If (blankIfZero & returnValue = 0) returnValue = "";

    return returnValue;

    }

    You can set this function at the level of the document, and then call it as follows (starting a custom calculation script, in this case):

    Event.Value = averageFields (["field1", "Field2", "Field3"], false);

  • Handle null values in the aggregate function

    Dear Experts,

    Here's my query

    SELECT sum (nvl (amount, 0)) + 50 AS TXN_PER_DAY_AMNT,

    COUNT (*) AS TRAN_LOG_TABLE TXN_CNT_PER_DAY

    (TRUNC (TXNDATETIME) = TO_DATE (SYSDATE, 'DD-MM-YY'));

    Exit from the MINE

    ------------------

    TXN_PER_DAY_AMNTTXN_CNT_PER_DAY
    NULL VALUE2

    Desired output

    ------------------------------

    TXN_PER_DAY_AMNTTXN_CNT_PER_DAY
    500

    I want to treat the null value,

    If my amount is null, it should replace 0 and add my 50 amount.

    Result must be 0 + 50 = 50;

    Help, please

    Maybe

    SELECT nvl (sum (sum() 50) AS TXN_PER_DAY_AMNT,

    -case when sum(amount) is null then 0 else end of COUNT (*) AS TXN_CNT_PER_DAY

    OF TRAN_LOG_TABLE

    Concerning

    Etbin

  • Fill with the previous 'not null' value ' Null' known values

    Hi all

    I have the following requirement to fill in missing values (null values) with the "Not null" values known previously available.

    Source of the example:

    Emp_Id Start_Dt LOC Comm Grade

    A101

    01/01/2013

    NJ4000B

    A101

    15/03/2013

    CA4800

    A101

    15/05/2013

    3500C

    A101

    25/07/2013

    2500

    A101

    20/12/2013

    NY5800A

    A101

    14/02/2013

    5000

    A101

    20/05/2014

    DC6000A

    A101

    03/06/2014

    3600C

    A102

    24/05/2013

    THE5000A

    A102

    15/12/20134300

    Expected results values in columns LOC and grades:

    Emp_Id Start_Dt LOC Comm Grade
    A101

    01/01/2013

    NJ4000BA101

    15/03/2013

    CA4800BA101

    15/05/2013

    CA3500CA101

    25/07/2013

    CA2500CA101

    20/12/2013

    NY5800AA101

    14/02/2013

    NY5000AA101

    20/05/2014

    DC6000AA101

    03/06/2014

    DC3600CA102

    24/05/2013

    THE5000AA102

    15/12/2013

    THE4300A

    Any suggestions would be helpful.

    Kind regards

    Arun

    Also, I think that this is a case of analytics. Last_value is perhaps the most appropriate function for the given task:

    Select emp_id

    start_dt

    last_value(loc ignore nulls) over (partition by emp_id arrested by start_dt) loc

    comm

    last_value(grade ignore nulls) about category (partition by emp_id arrested by start_dt)

    t

  • convert NULL values to 0

    Hi guys

    am on 10g

    I have a Table with 7 fields (all numbers).

    Basically, I'm looking for a way to convert NULL values to 0 [zero], a process, a client wants.

    So no matter how the Table is large, that I must be able to do, what is the best way to do this? Example SQL? PL/SQL?

    Thank you.

    Using NVL?

    SQL> select nvl(null, '0') from dual;
    
    N
    -
    0
    
    1 row selected.
    

    NULL for all related functions:
    http://www.Oracle-base.com/articles/Misc/NullRelatedFunctions.php

  • Need to null values with the values of filling the date before weekend/holidays

    I have a table with a Date column, column Type and rate column.

    The problem is when the weekends and holidays, column Type and rate column are null.

    I need all null values with the values of Type and fill rate before that date is the weekend and public holidays.

    Example:

    I have:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * NULL NULL 07/03/2010 *.
    * NULL NULL 07/04/2010 *.
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    Will be:

    RATE OF TYPE DATE
    07/01/2010 4510 PM 3.71
    07/01/2010 CETE28 4.59
    07/01/2010 TIIE28 4.95
    07/02/2010 4510 PM 3.82
    07/02/2010 CETE28 4.63
    07/02/2010 TIIE28 5.11
    * 07/03/2010 4510 PM 3.82*
    * 07/03/2010 CETE28 4.63*
    * 07/03/2010 TIIE28 5.11*
    * 07/04/2010 4510 PM 3.82*
    * 07/04/2010 CETE28 4.63*
    * 07/04/2010 TIIE28 5.11*
    07/05/2010 4510 PM 3.91
    07/05/2010 CETE28 4.74
    07/05/2010 TIIE28 5.25

    What could I do?

    Hello

    You can use the analytic LAST_VALUE function to get the last day of work before each date into your table. It will be the same as the current day for every day of work.
    Do it a self-join to combine each current line (c) with the last day of work (l):

    WITH     got_last_work_day     AS
    (
         SELECT     dt, type, rate
         ,     LAST_VALUE ( CASE
                        WHEN  type  IS NOT NULL
                        THEN  dt
                       END
                       IGNORE NULLS
                      ) OVER (ORDER BY dt)     AS last_work_day
         FROM     table_x
    )
    SELECT       c.dt, l.type, l.rate
    FROM       got_last_work_day     c
    JOIN       got_last_work_day     l  ON       (    c.dt          = l.dt
                             AND  c.type          = l.type
                             )
                           OR     (    c.last_work_day     = l.dt
                             AND  c.type          IS NULL
                             )
    ORDER BY  c.dt
    ,       l.type
    ;
    

    Among other things, I guess that the type is NULL if (and only if) the line represents a holiday or weekend, and that the combination (dt, type) is uniuqe.

  • Treatment of Null values from database

    Hi all

    I created a form very simple record insertion using dreamweaver for an online store.

    According to some products, a field can be left blank. Problem is when I try and treat this this course comes with an error. "The 'colour_1' column cannot be null.

    How can I ignore it for some fields. And this creates a security risk?

    Please find the below coding.

    See you soon

    Tom

    <? php require_once('.. /.. / Connections/connProduct.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }


    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);


    Switch ($theType) {}

    case 'text ':

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "long":

    case "int":

    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';

    break;

    case "double":

    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';

    break;

    case "date":

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }


    $editFormAction = $_SERVER ['PHP_SELF'];

    If (isset {}

    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);

    }


    If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "form1")) {}

    $insertSQL = sprintf ("INSERT INTO product (product_ID, product_Name, product_Title, product_Height, product_Width, extra_Info, product_Price, delivery_Price, colour_1, colour_2, colour_3, colour_4, colour_5, colour_6, colour_7) VALUES (%s, %s %s %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", ")

    GetSQLValueString ($_POST ['product_ID'], "int").

    GetSQLValueString ($_POST ["'product_Name"], "text").

    GetSQLValueString ($_POST ['product_Title'], "text").

    GetSQLValueString ($_POST ['product_Height'], "text").

    GetSQLValueString ($_POST ['product_Width'], "text").

    GetSQLValueString ($_POST ['extra_Info'], "text").

    GetSQLValueString ($_POST ['product_Price'], "text").

    GetSQLValueString ($_POST ['delivery_Price'], "text").

    GetSQLValueString ($_POST ['colour_1'], "text").

    GetSQLValueString ($_POST ['colour_2'], "text").

    GetSQLValueString ($_POST ['colour_3'], "text").

    GetSQLValueString ($_POST ['colour_4'], "text").

    GetSQLValueString ($_POST ['colour_5'], "text").

    GetSQLValueString ($_POST ['colour_6'], "text").

    GetSQLValueString ($_POST ['colour_7'], "text"));


    @mysql_select_db ($database_connProduct, $connProduct);

    $Result1 = mysql_query ($insertSQL, $connProduct) or die (mysql_error ());


    $insertGoTo = 'index.php ';

    If (isset {}

    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;

    $insertGoTo. = $_SERVER ['QUERY_STRING'];

    }

    header (sprintf ("location: %s", $insertGoTo));

    }


    @mysql_select_db ($database_connProduct, $connProduct);

    $query_rsProduct = "SELECT * FROM lanterns.

    $rsProduct = mysql_query ($query_rsProduct, $connProduct) or die (mysql_error ());

    $row_rsProduct = mysql_fetch_assoc ($rsProduct);

    $totalRows_rsProduct = mysql_num_rows ($rsProduct);

    ? >

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""

    " < html xmlns =" http://www.w3.org/1999/xhtml ">

    < head >

    < meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"

    < title > Untitled Document < /title >

    < / head >


    < body > < form action = "" method = "get" > < / make > "

    < do action = "<?" PHP echo $editFormAction;? ">" method = "post" name = "form1" id = "form1" >

    < table align = "center" >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product name: < table >

    < td > < input type = "text" name = 'product_Name' value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product title: < table >

    < td > < input type = "text" name = "product_Title" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product height: < table >

    < td > < input type = "text" name = "product_Height" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = 'nowrap' align = 'right' > the product width: < table >

    < td > < input type = "text" name = "product_Width" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > additional Info: < table >

    < td > < input type = "text" name = "extra_Info" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product price: < table >

    < td > < input type = "text" name = "product_Price" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > delivery price: < table >

    < td > < input type = "text" name = "delivery_Price" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 1: < table >

    < td > < input type = "text" name = "colour_1" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 2: < table >

    < td > < input type = "text" name = "colour_2" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 3: < table >

    < td > < input type = "text" name = "colour_3" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 4 color: < table >

    < td > < input type = "text" name = "colour_4" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 5 color: < table >

    < td > < input type = "text" name = "colour_5" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 6 color: < table >

    < td > < input type = "text" name = "colour_6" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 7 color: < table >

    < td > < input type = "text" name = "colour_7" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > < table >

    < td > < input type = "submit" value = "Insert file" / > < table >

    < /tr >

    < /table >

    < input type = "hidden" name = "lantern_ID" value = "" / > "

    < input type = "hidden" name = "MM_insert" value = "form1" / >

    < / make >

    < p > < / p >

    < / body >

    < / html >

    <? PHP

    mysql_free_result ($rsProducts);

    ? >

    Thread has been moved to the Dreamweaver application development forum, which deals with PHP and other issues aside server.

    sellador315 wrote:

    According to some products, a field can be left blank. Problem is when I try and treat this this course comes with an error. "The 'colour_1' column cannot be null.

    How can I ignore it for some fields. And this creates a security risk?

    In your database, change the definition of the column in which you might want to leave it empty with null. You can do this easily in phpMyAdmin by selecting the column you want to change on the Structure tab and clicking Change icon. Then select the Null checkbox, as shown in this screenshot:

    Allowing a column store null values is not a security risk.

  • NULL values in service management LESS

    Hello

    I have the query unless you return through two date fields date... NULL values should be ignored in the calculation. I used the service LESS with NVL but not able to resolve the issue until I used the function REPLACE top of it to show the value NULL if the query returns date of NVL. Please find the tables and queries that I used...
    CREATE TABLE TEST_LEAST
    (RECORD NUMBER,
    DATE1 DATE,
    DATE2 DATE,
    DATE3 DATE);
    INSERT INTO TEST_LEAST VALUES (1, '1 AUG 2009', '23 JUN 2009', '4 APR 2009');
    INSERT INTO TEST_LEAST VALUES (2, '20 JAN 2009', '16 FEB 2009', '7 MAY 2009');
    INSERT INTO TEST_LEAST VALUES (3, NULL, '31 MAR 2009', '19 JUL 2009');
    INSERT INTO TEST_LEAST VALUES (4, NULL, NULL, NULL);
    COMMIT;
    To return date less date1 and date2, date3, I used the function LESS, but the result was not as expected with the following query:
    SELECT RECORD, LEAST(DATE1, DATE2, DATE3) FROM TEST_LEAST;
    Statement 3 should show a date of March 31, 2009.

    I changed the query to use NVL to handle NULL values...
    SELECT CASENBR, LEAST(NVL(DATE1, TO_DATE('31 DEC 9999')), NVL(DATE2, TO_DATE('31 DEC 9999')), NVL(DATE3, TO_DATE('31 DEC 9999'))) FROM TEST_LEAST;
    .. but now, the result shows that record 4 is December 31, 2009, instead of NULL.
    and finally, I replaced the date 31 DEC 2009' with null with this query...
    SELECT CASENBR, REPLACE(LEAST(NVL(DATE1, TO_DATE('31 DEC 9999')), NVL(DATE2, TO_DATE('31 DEC 9999')), NVL(DATE3, TO_DATE('31 DEC 9999'))), TO_DATE('31 DEC 9999'), NULL) FROM TEST_LEAST;
    I am not convinced with query then thought to ask THE GURUS for help. Please guide me how I can better handle nulls with LESS function.

    Thanks in advance!

    Use COALESCE with the first expression that column:

    SQL> SELECT RECORD, LEAST(COALESCE(DATE1,DATE2,DATE3),COALESCE(DATE2,DATE3,DATE1),COALESCE(DATE3,DATE1,DATE2))FROM TEST_LEAST;
    
        RECORD LEAST(COA
    ---------- ---------
             1 04-APR-09
             2 20-JAN-09
             3 31-MAR-09
             4
    
    SQL> 
    

    SY.

  • Bar chart stacked - strange behavior on display null values

    Hi all

    I'm trying to graph a county of the end dates of the activities over several years by months grouped by project.

    The problem I have is that there is a gap of 3 months where none of the activities that I am tracking complete. The default value for the stacked bar chart is to ignore the columns with no data (in my case it October-December 2015).

    To view these any given month I went to properties graphic and ticked the box "Include Null values. At this point, I get a very strange behavior. Once this option is selected, the legend explodes, showing each project in the database regardless if it meets my criteria for analysis.

    Has anyone another considering that happen? I'm doing something wrong?

    If it's important I'm in the OBI 11.1.1.7.150120

    Thank you for your help,

    Kevin Wolfe


    Hello

    You have a filter on the list of projects you want to see?

    Based on the way you describe your analysis I guess you don't have any what filter on the list of projects, but some of the filters on the other dimensions/attributes and these filters were limiting the list of projects.

    If this is the case then what you see is not a weird behavior, but everything you've asked your analysis.

    "Include null values" is not limited to the time dimension, it fits any dimension of your analysis, so no filter on projects = all projects.

Maybe you are looking for