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.

Tags: Dreamweaver

Similar Questions

  • How to fill the area of the bean with values from database

    I have a box of bean shaped which act as last autocomplete, I want to fill it with dynamic values of database, any help will be appreciated.
    http://Forms.PJC.Bean.over-blog.com/article-16369664.html "It is the example that I am"

    Best regards.

    An example with the EMP table:

    DECLARE
      cursor cur is select empno,ename from emp;
    BEGIN
      -- initialise the ComboBox twin values --
      for c in cur loop
       if c.empno is not null then
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN',c.empno||','||c.ename);
       else
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN_NULL',c.empno||','||c.ename);
       end if ;
      end loop;
      Set_Custom_Property('BL.BEAN',1,'ADD_TWIN','[END_DATA]');
      Set_Custom_Property('BL.BEAN',1,'SET_ALIGNMENT','right');
    END;
    

    François

  • Draw lines based on values from database

    I want to draw the line based on the data from database.

    Number of lines will be the number of records in the query.

    line length will be based on the value of the column in centimetres.

    by example, if the query selects 3 folders 3 lines will be drawn.

    If the first record column value is 5 then 5 cm line will be drawn.

    Thank you.

    Please find the sample report and xml.

    Kaya.

  • BI Publisher treatment of Null Values in total

    Hi guys,.

    I need help in the treatment of nulls in the totals.

    Backend table: -.

    Day

    Hour

    A1

    A2

    A3

    1

    00

    3

    1

    01

    4

    1

    02

    3

    4

    1

    03

    4

    6

    2

    00

    3

    5

    2

    01

    4

    7

    2

    02

    3

    2

    03

    4

    Output to the exception: - (based on the day totals)

    Day

    A1

    A2

    A3

    1

    14

    -

    10

    2

    14

    -

    12

    I can't get A2 and A3 total value except production based on day. Can someone help me please to solve this.

    Thank you much in advance.

    -Raj

    Code below you will get the desired result

    -

    -

    -

    Attached schema predetermined as for your refrence.

  • Properties: Treatment of NULL values

    I wanted to ask you how you deal with NULL values, on the properties of JavaFX.

    Properties of the wrapper for the primitive data types like SimpleIntegerProperty or SimpleBooleanProperty Don t accepts NULL values.

    Example:

    1. IntegerProperty integerProperty = new SimpleIntegerProperty() )
    2. integerProperty. setValue (null) ;
    3. System. out. println () integerProperty. getValue ());

    Output is 0 (default value for "int").

    I think the primitive property wrappers (IntegerProperty, BooleanProperty and friends) as of the wrappers for primitive types. Probably they shouldn't really inherit WritableValue as which allows the call to setValue with a type reference, but I think that indigestion API would be worse than the implementation of setValue with a slightly incorrect signature. I would just avoid defining a wrapper of primitive type to null property: If you want to restrict yourself using set (.) instead of setValue (...) you are forced to spend in the primitive type: either you cannot pass null.

    If you want an integer property where null values are handled in an intuitive manner, use ObjectProperty .

    The test below shows that call setValue (null) on IntegerProperty assigns the default value. (Although I don't see the behavior documented anywhere).

    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    
    public class PrimitivePropertyWrapperTest {
    
        public static void main(String[] args) {
            IntegerProperty integerProp = new SimpleIntegerProperty();
            integerProp.addListener(new ChangeListener() {
    
                @Override
                public void changed(ObservableValue observable,
                        Number oldValue, Number newValue) {
                    System.out.println("integerProperty changed value from "+oldValue+" to "+newValue);
                }
            });
    
            ObjectProperty objectProp = new SimpleObjectProperty<>();
            objectProp.addListener(new ChangeListener() {
    
                @Override
                public void changed(ObservableValue observable,
                        Integer oldValue, Integer newValue) {
                    System.out.println("objectProperty changed value from "+oldValue+" to "+newValue);
                }
            });
    
            integerProp.setValue(null);
            integerProp.setValue(1);
            System.out.println("setting integerProp back to null:");
            integerProp.setValue(null);
            System.out.println("setting integerProp to 0:");
            integerProp.setValue(0);
            integerProp.setValue(null);
    
            objectProp.setValue(null);
            objectProp.setValue(1);
            objectProp.setValue(null);
            objectProp.setValue(0);
            objectProp.setValue(null);
    
        }
    
    }
    
  • eliminate null values from the popup list item

    Dear all,

    I have create a contextual list at run time, it indicates a value empty nowhere among the values that I said while the drop-down list box is not.
    I want to eliminate the value null empty in the pop-up list.
    Need help.

    Thank you and best regards.

    Muhammad,

    Try the following code. I just gave a name to the field 2nd in the record group and first assigned default value. And his works fine.

    PROCEDURE Department_proc IS
         RG RECORDGROUP;
         n  NUMBER;
         GC_ID     GROUPCOLUMN;
    BEGIN
         Remove_Record_Group('RG');------ this is another procedure which checks for Record group existance and remove it.
         RG := CREATE_GROUP_FROM_QUERY('RG4', 'SELECT NAME, TO_CHAR(DEPT_ID) DEPT_ID FROM TAB_DEPT_SECTION
    UNION
    SELECT '||'''All Departments'''||'AS NAME,'||'''0'''||' AS DEPT_ID FROM DUAL');
         n := POPULATE_GROUP(RG);
         POPULATE_LIST('control_block.department', RG);
      GC_ID := Find_Column('RG4.DEPT_ID');
      :control_block.department := GET_GROUP_CHAR_CELL(GC_ID, 2);
    END;
    

    Kind regards

    Manu.

    If my response or response from another person was helpful, please mark accordingly

  • You want to varify each form field with the value from database?

    Hello Experts,

    I have to implement a feature that will confirm the change for each text field on the form.

    Scenario:

    I have a form with several fields of database tables.

    We have set the indicator for each column of each table to Yes or no in a master table to access.

    When users navigate to any text field in any database block, procedure, or a function will varify that access is granted for the amendment of this column.

    If the access flag is set to yes, user can change. otherewise fast with the message, you are nor allow to change this field.

    I don't want to call this procedure and a function in each field.

    Also, if in the future if a new field will add to this form, there is no need to change in the code or we should not require to remember to check the indicator of access to this column.

    Please help me.

    Thank you

    Yoann

    NEXT-KEY is always triggered, then you can try to put that code in WHEN-VALIDATE-ITEM trigger. This way you can navigate on this field if it's empty DB, but can not force the user to enter data in a new record. Alternatively, you can ask again priviledge change data in your trigger KNI.

  • detection of apex_item in javascript null value

    Request Express 3.2.0.00.27

    I have the javascript code that is called from a trigger of js on charge.
    I have a manually created form tablur here is the code for the form region:
    SELECT APEX_ITEM.POPUP_FROM_LOV(15,c001,'AUTH_LOV',NULL,NULL,0,NULL,NULL,NULL,'YES','f15_' || '#ROWNUM#') authid,
      apex_item.hidden(16, c002, NULL,'f16_'|| '#ROWNUM#') empid,
    --  apex_item.display_and_save(16,c002,'f16_'|| '#ROWNUM#') empid,
      apex_item.date_popup(17, rownum, c003, 'DD-MON-YYYY',20,2000,NULL,'f17_' || '#ROWNUM#')deldate,
      apex_item.textarea(18,c004,5,40,NULL,'f18_'|| '#ROWNUM#') "Delegation scope",
      apex_item.textarea(19,c005,5,40,NULL,'f19_'|| '#ROWNUM#')"Delegation limits",
      apex_item.select_list_from_lov(20,c006,'YESNO_LOV',NULL,'NO','N','%','f20_'|| '#ROWNUM#')"ORA Signed",
      apex_item.date_popup(21, rownum, c007, 'DD-MON-YYYY', 20,2000,NULL,'f21_' || '#ROWNUM#') "Del expiry",
      apex_item.date_popup(22, rownum, c008, 'DD-MON-YYYY', 20,2000,NULL,'f22_' || '#ROWNUM#') "Date removed",
      apex_item.textarea(23,c009,5,40,NULL,'f23_'|| '#ROWNUM#') "Delegation comments",
      apex_item.POPUP_FROM_LOV(24,c010,'DELEGATION_LOV',NULL,NULL,0,NULL,NULL,NULL,'YES','f24_' || '#ROWNUM#') "Delegator",
      apex_item.display_and_save(25,c011,'f25_'|| '#ROWNUM#') status,
    --  apex_item.display_and_save(26,seq_id,'f26_'|| '#ROWNUM#') seq_id,
      apex_item.hidden(26, seq_id,NULL,'f26_'|| '#ROWNUM#') ||
      apex_item.checkbox(27, seq_id,NULL,NULL,':','f27_'|| '#ROWNUM#') chkbx
        
     FROM apex_collections
    WHERE collection_name = 'DELEG_COLL'
      AND c011 IN ('O','N','U','D')
    --order by c001
    If the column that is passed to in ('f15') is not null I want to change the display type to hidden and the t20data class. This I hope that this makes it visible, but not updateble.
    Otherwise when rendering I want to render with default values of the api apex_item for a LOV.

    I check a null like this:
    function changeProp(pCol) {
       var elms = document.getElementsByName(pCol);
       for (i=0; i< elms.length; i++) {
     /*       elms.style.backgroundColor = 'yellow'; */
    if $v_IsEmpty(elms[i].value) {
    alert('The value is' + elms[i].value);
    }
    }
    }

    function changeProp(pCol) {
    var elms = document.getElementsByName(pCol);
    for (i=0; i< elms.length; i++) {
    /* elms[i].style.backgroundColor = 'yellow'; */
    if (elms[i].value == null or elms[i].value == '%null%') {
    alert('The value is' + elms[i].value);
    }
    }
    }
    The alert (  alert('The value is' + elms.value); is only used to verify I am readying the value correctly. WHen executed outside of the if clause it does show the correct value.

    However the code above is not execting when a new row is created and hence f15 should be null. In the code above you can see I have tried to check for a null value in two different ways with no success.

    Once it detects the null I would want to change the class to t20data and the type to hidden.

    I could do this in the report query, instead of using JavaScript, but nvl, nvl2and coalesce are better than decode for the treatment of NULL values:

    nvl2(
      c001,
      apex_item.display_and_save(15,c001,'f15_'|| '#ROWNUM#'),
      apex_item.popup_from_lov(15, c001, 'AUTH_LOV', null, null, 0, null, null, null, 'YES', 'f15_' || '#ROWNUM#')) authid,
    

    The error message is due to the use of page focus of the cursor attribute, or some custom JavaScript that attempts to set the focus of cursor in an element that cannot be entered. If the focus of the cursor is set to 'First element on the page', try replacing it "do not focus cursor. (If this corrects the problem, but you want to focus on the first entrable element at the entrance to the page that you need to write some custom JS to do this).

  • How to find null values in the table

    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    ADF 7 wrote:
    Hi experts,

    my version is oracledb10g:

    I am doubted simple.

    for example:

    create table ex1 (e varchar2 (20));

    Insert ex1 (null).

    insert into ex1 (e)

    number of will be: 2

    It depends on what you expect. If you issue count (*) you ask Oracle "how many lines there. If you issue a County () you ask Oracle 'how non null values for are there. "

    ADF 7 wrote:

    I can easily find the value "e".

    so my question is:

    How can I find null values in the table and I want to remove the null values from the table.

    delete from 
    where  is null;
    

    Ideally you would simply place a NOT NULL constraint on the column in question, thus prohibiting NULL values into the system (assuming that your business needs, it is that the column MUST always have a value).

  • Starting from two data tables, how do you get the values in two columns using values in a column (values get col. If col. A is not null values and get the pass. B if col. A is null)?

    Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?

    Guessing

    Select nvl (x.col_a, y.col_b) the_column

    from table_1 x,.

    table_2 y

    where x.pk = y.pk

    Concerning

    Etbin

  • calculated formula database field trying to insert the null value

    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Any suggestions?

    Forms 11g

    Thanks in advance

    794018 wrote:
    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Point formula should not be issue of database. And insert the value in the result column in the database is not good idea.
    Then, if you want to save it. create the database result item and write trigger (When-validate-point) on amount and filed rates and the trigger code, write

    :result:=:amount*:rate;
    

    To display the result on the form, create the database no item and change the formula property and write the formula.

    Hope this will help you

    If someone useful or appropriate, please mark accordingly.

  • Create null values in the database for interactive report link column values

    Hello

    I'm pretty new to APEX and tries to create an interactive report with the form. This report examines essentially for more information for a particular employee. If the employee has any information in the table, the report presents information with a button change beside him. If there is no record in the table for this employee, a create button appears. Now when you click create, a new creation page. This page contains the employee number as a single display field with the value from the previous page. This value is displayed in the page, but it is not in the database. Create the page has view-only number and a couple of other columns. The other columns get inserted into the table with an empty number!

    Can someone please? Looks like the page keeps the value zero for the number of the employee who came during the search of the interactive report. Hope I made myself clear, being the newbie hope I haven't used any incorrect terminology.

    Thank you!
    Robet

    Without the DB column, apex will not determine which DB column the data in this field are mapped to (it would be quite impossible to guess the destination since the name of the element column).

    If you want to assign to the previous element of the page, use the default section

    return: P1_EMP_NUM

    By default the value Type: body of the PLSQL function

    and configure the attributes of source as I said before

  • Best practices for retrieving a single value from the Oracle Table

    I'm using Oracle Database 11 g Release 11.2.0.3.0.

    I would like to know the best practice to do something like that in a PL/SQL block:

    DECLARE
        v_student_id    student.student_id%TYPE;
    BEGIN
        SELECT  student_id
        INTO    v_student_id
        FROM    student
        WHERE   last_name = 'Smith'
        AND     ROWNUM = 1;
    END;

    Of course, the problem here is that when there is no success, the NO_DATA_FOUND exception is thrown, which interrupts the execution.  So, what happens if I want to continue despite the exception?

    Yes, I could create a block nested with EXCEPTION section, etc, but it seems awkward for what seems to be a very simple task.

    I've also seen this handled like this:

    DECLARE
        v_student_id    student.student_id%TYPE;
        CURSOR c_student_id IS
            SELECT  student_id
            FROM    student
            WHERE   last_name = 'Smith'
            AND     ROWNUM = 1;
    BEGIN
        OPEN c_student_id;
        FETCH c_student_id INTO v_student_id;
        IF c_student_id%NOTFOUND THEN
            DBMS_OUTPUT.PUT_LINE('not found');
        ELSE
            (do stuff)
        END IF;
        CLOSE c_student_id;   
    END;

    But it still seems to kill an Ant with a hammer.

    What is the best way?

    Thanks for any help you can give.

    Wayne

    201cbc0d-57b2-483a-89f5-cd8043d0c04b wrote:

    What happens if I want to continue despite the exception?

    It depends on what you want to do.

    You expect only 0 or 1 rank. SELECT INTO waiting for exactly 1 row. In this case, SELECT INTO may not be the best solution.

    What exactly do you do if you return 0 rows?

    If you want to set a variable with a NULL value and continue the treatment, Frank's response looks good, or else use the modular Billy approach.

    If you want to "do things" when you get a line and 'status quo' when you don't get a line, then you can consider a loop FOR:

    declare
      l_empno scott.emp.empno%type := 7789;
      l_ename scott.emp.ename%type;
    begin
      for rec in (
        select ename from scott.emp
        where empno = l_empno
        and rownum = 1
      ) loop
    l_ename := rec.ename;
        dbms_output.put_line('<' || l_ename || '>');
      end loop;
    end;
    /
    

    Note that when no line is found, there is no output at all.

    Post edited by: StewAshton - Oops! I forgot to put the result in l_ename...

  • Alter the State of Session? -Apex form publishes text with null value

    Recently I discovered a problem with our Apex facility in which all selected as source for a text field value will eventually be displayed as a null value in the database.
    We run APEX version 3.2 in an Oracle 10.2.0.4 database using Oracle HTTP Server from 10 g companion disc.

    At first glance, everything seems to work as expected; I created a simple table called "oracle_sr" with 2 columns, as both not null:

    SQL > desc capacity.oracle_sr
    Name Null? Type
    ORACLE_SR_ID NOT NULL NUMBER
    TIMESTAMP NOT NULL DATE

    In APEX, the form wizard has been used to create a form on this table.
    After execution of the pages and you enter a value for the timestamp field, I can create folders without problem.

    The question arises when I choose a source for the timestamp field value.
    All the source options causes the same error (including a static value) so I'll focus on the SQL query to the source as:

    Select sysdate double;

    This should replace the date system in the area of text timestamp when the page is executed.
    As expected, the value appears in the text box, but when I submit the form to create the folder I get the error:

    ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")

    I have worked with APEX for quite awhile and have successfully used this technique in many applications but just to begin to see this error in recent days. What's particularly odd about this message is by default postings "not null" created by the form wizard sees timestamp class as having a value. Session state information included below reports a value yet the database is to launch the ORA-01400.

    Someone has a similar problem? I have spent a good amount of time to try looking for this problem but can't seem to find any similar messages.

    I have included the release of my test page, debugging from what I see, it seems to be a value associated with the filed timestamp:

    0.00: a C C E P t: request = "CRΘER."
    0.00: metadata: go look up the definition and application shortcuts
    0.00: NLS: wwv_flow.g_flow_language_derived_from = FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language = en - us
    0.00: alter session set nls_language = "AMERICAN."
    0.00: alter session set nls_territory = 'AMERICA '.
    0.00: NLS: CSV charset = WE8MSWIN1252
    0.00:... "NLS: decimal separator Set =". »
    0.00:... NLS: Set NLS Group separator = ",".
    0.00:... NLS: Date Format Set = "DD-MON-RR.
    0.01:... Setting session time_zone in-06: 00
    0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
    0.01:... NLS: Date Format Set = "DD-MON-RR.
    0.01: fetch database session state
    0.01:... Check the owner of the 2303701116904676 session
    0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
    0.02:... NLS: Date Format Set = "DD-MON-RR.
    0.02:... Check for expiration of the session:
    0.02:... Metadata: Page Fetch, calculation, process and branch
    0.02: session: extract information from session header
    0.02:... Metadata: Retrieve the attributes of the page for application 109, page 50
    0.02:... Validate page affinity point.
    0.02:... Check off the items hidden_protected.
    0.03:... Check authorization security systems
    0.03: session state: Save elements of form and p_arg_values
    0.03: *... Session state: you save newValue of the object "P50_ORACLE_SR_ID" = "" "escape_on_input ="N"* 0.03: *..." " Session state: you save the object "P50_TIMESTAMP" = newValue ' 26 May 09 "" escape_on_input = "N" * ""»
    0.03:... Session state: Save "P0_CURRENT_PERSONNEL_ID" - registration of same value: "1."
    0.03:... Session state: Save "P0_OFFSET" - registration of same value: "0".
    0.03:... Session state: Save "P0_ACTIVE_WEEK" - registration of same value: "24 May 09".
    0.03: point of treatment: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: branch point: BEFORE_COMPUTATION
    0.03: point of calculation: AFTER_SUBMIT
    0.03: tabs: make the connection for the tab queries
    0.03: branch point: BEFORE_VALIDATION
    0.03: perform validations:
    0.03:... Point Not Null Validation: P50_TIMESTAMP
    0.04: branch point: BEFORE_PROCESSING
    0.04: point of treatment: AFTER_SUBMIT
    0.04:... Process 'PK get': PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin C1 in (select ORACLE_SR_SEQ.nextval double next_val) loop return c1.next_val; end loop; end; Start: P50_ORACLE_SR_ID: = get_pk; end;
    0.04:... * session state: saved point new value "P50_ORACLE_SR_ID" = "6."
    0.04:... Treat "Line of ORACLE_SR process": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER #:ORACLE_SR:P50_ORACLE_SR_ID:ORACLE_SR_ID | IUD
    0.04: see the error page...
    0.04: execute rollback...

    ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")

    Cannot process the row in the ORACLE_SR table.
    Back by demand.

    Any thoughts would be appreciated.

    Thank you

    Justin.

    If you have changed the Source Type of an element of database column to something else, so he cannot participate in the automated line choreography Fetch/automatic line processing (DML). You must leave the Type of Source, as it was and change the default value of the element fill when the ARF process retrieves a null value for the column.

    Scott

  • to get the values of database apex CheckBox as checked or unchecked

    Hi gurus
    Apex 4
    Oracle 11g
    How to load data from database for the checkbox if values = 1 then verified and id = 0 then value not controlled.
    can you please help me solve this problem
    Example of table

    En0 empname pack1 pack2 pack3 pack4
    1 1 0 0 1
    2 b 0 1 0 0
    c 3 1 1 1 1
    4 0 1 1 D 0


    my output in APEX should watch for ename 1
    Checkbox checked Pack1
    Pack of 2 box unchecked
    Pack of 3 box unchecked
    Pack4 checked

    and im the new user in the apex can help u
    Thanks in advance

    r

    Published by: on 13 April 2011 19:26

    Please a little patience!

    For a standard report, your SQL would look like this:

    SELECT eno,
           empname,
           apex_item.Checkbox(1, pack1, Decode(pack1, 1, 'CHECKED', NULL)) AS pack1,
           apex_item.Checkbox(1, pack2, Decode(pack1, 1, 'CHECKED', NULL)) AS pack2,
           apex_item.Checkbox(1, pack1, Decode(pack3, 1, 'CHECKED', NULL)) AS pack3,
           apex_item.Checkbox(1, pack1, Decode(pack4, 1, 'CHECKED', NULL)) AS pack4
    FROM   sample_tbl  
    

    Under column attributes, make sure that your box columns are displayed as a Standard report column

    Jeff

Maybe you are looking for