No geometry validation on insert ?

Hi!
How come Oracle let me insert a non-closed polygon in an spatial-indexed table ? When I run SDO_GEOM.VALIDATE_GEOMETRY() I get the right error code (ORA-13348 polygon boundary is not closed) but I really CAN insert it !!!
Here's the polygon i've inserted. This is really just example 2.3.3, but modified to be a polygon instead of a line.
INSERT INTO cola_markets VALUES(
11,
'compound_line_string',
MDSYS.SDO_GEOMETRY(
2003,
NULL,
NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1005,2, 1,2,1, 3,2,2),
MDSYS.SDO_ORDINATE_ARRAY(10,10, 10,14, 6,10, 14,10)
Is it the programmer's responsability to write his own trigger to validate the geometry that is inserted ? I dont mind doing it, but I still think there's something weird going on !
Thank you!
Mathieu Gauthier
Development Team
JCMB Technology Inc

Oracle Spatial does not do geometry validation on insert, as you've found. The reason for this is that some people require geometry loading to go as fast as possible, and having a trigger on every insert would slow things down.
You can create a trigger to do the validation as you've described, if you need it.

Similar Messages

  • SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT for polygon geometry validation

    Hi,
    I would like to make a validation of the polygon geometry upon a table SCHEMA.TABLE with the GEOM field, where the geometry is stored.
    Can someone help me with a sample SQL sentence to fill my SCHEMA.VALIDITY table with all the detected errors that occured in the SCHEMA.TABLE?
    Thanks!
    Dejan

    Greg
    Have you tried scrolling down to the bottom of that section? You will see the following example (as in all descriptions in the documentation):
    Examples*
    The following example validates the geometry objects stored in the SHAPE column of the COLA_MARKETS table. The example includes the creation of the result table. For this example, a deliberately invalid geometry was inserted into the table before the validation was performed.
    -- Is a layer valid? (First, create the result table.)
    CREATE TABLE val_results (sdo_rowid ROWID, result varchar2(1000));
    -- (Next statement must be on one command line.)
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('COLA_MARKETS','SHAPE','VAL_RESULTS');
    Call completed.
    SQL> SELECT * from val_results;
    SDO_ROWID
    RESULT
    Rows Processed <12>
    AAABXNAABAAAKYAAC+
    +13349 [Element <1>] [Ring <1>][Edge <1>][Edge <3>]+
    CREATE TABLE val_results (sdo_rowid ROWID, result varchar2(1000));
    would have been in your case:
    CREATE TABLE schema.validity (sdo_rowid ROWID, result varchar2(1000));
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('COLA_MARKETS','SHAPE','VAL_RESULTS');
    would have been in your case:
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('SCHEMA.TABLE','GEOM','SCHEMA.VALIDITY');
    SQL> SELECT * from val_results;
    would have been in your case:
    SELECT * from schema.validity;
    If you would like to have your id included:
    Select a.id, b.*
    from schema.validity b left outer join schema.table a
    on (b.sdo_rowid= a.rowid);
    In order to help people making their life easier with the management of spatial metadata, spatial index and geometry validation, like yours, and possible fix up, 1Spatial has a product named Radius Check.
    Have a look at the second item from the top here: http://www.oracle.com/technology/products/spatial/htdocs/spatial_partners_downloads.html
    or
    http://www.1spatial.com/products/radius_check/index.php
    Maybe you can find it usefull.
    Luc

  • PHP Form Validation and Insert Records

    Hi There,
    I've been scratching my head for 2 days and couldn't find a solution.
    Here is my problem:
    Go to http://ecopethandbags.com/contactTest.php and click the "Send Comments" button.
    You will see that the validation works.
    Now, go to http://ecopethandbags.com/contactTestInsert.php, this time, I've inserted the "Insert Record" server behavior.
    Click the "Send Comments" button again.
    You will see the ugly message like "Column 'firstname' cannot be null" in a plain white page.
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    I am attaching the files.
    Thank you for you help!

    boloco wrote:
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    Use simple PHP logic to merge the scripts together.
    Dreamweaver automatically puts the Insert Record server behavior code at the top of the script. You need to adapt it so that the validation is done first. If the validation succeeds, use the Insert Record server behavior. If not, redisplay the form.
    if (array_key_exists('send', $_POST)) {
      // validate the form input
      if (!$suspect && empty($missing)) {
      // send the mail
        if ($mailSent) {
        unset($missing);
        // insert the Insert Record server behavior code here

  • Documentation of Geometry validity in Oracle Spatial?

    Is there anywhere in the 10g Spatial documentation where the geometric conditions required for a geometry to be valid are defined? I've found a few sentences spread through the document, but I would have expected that such an important concept would have had a single place where it was summarized.

    As the designer of JTS, I'm intimately familiar with the OGC SFS spec!
    Of course it's always nice to see statements about adherence to specs. But it's even nicer to see vendor documentation that explicitly states the semantics of the data model, to confirm the adherence to the spec. Actually most of that information is in the Spatial docs, I think - it's just spread out and a bit hard to find.
    Also, the OGC SFS does leave some room for implementations to vary. For instance, the SFS does not mandate the orientation of rings in polygons, whereas Oracle requires a specific orientation. This kind of thing is very important for developers to be aware of.
    Anyway, my primary concern was about whether valid LineStrings can self-intersect, and I think that's answered now.

  • My Proxy: How to implement a validation before insert/update

    Hi,
    In my env, the OIM User has an attribute called Employee Grade. When the user is configuring My Proxy, he/she can select users who grade who has grade equals or higher... I created a Rule Generator adapter and I tried to assign it to the Pre-Insert of Users.Proxy data object. Problem: There is no field availabe for this entity and I thought it was related to the table PXD (PXD_ORIG_USR_KEY and PXD_PROXY_KEY).
    If I could access those fields, I would search the proxy user by PXD_PROXY_KEY and get he/she grade. After that, compare with the grade of the original user.
    I alse have to iimplement the same logic when the user reasign a task to another user.
    Have you ever implemented that or have any idea?
    Thanks,
    Renato Guimaraes.
    Edited by: Renato.Guimaraes on 05/10/2009 13:58 - Implement the same logic to reassign task

    One option is to implement the proxy funtion as a separate RO. Makes it possible to do validation in the approval process but will force you to manually implement any functionality that you would like to have associated with the function.
    Probably not easier than a GUI customization but I wanted to mention the option.
    Best regards
    /Martin

  • Validation on Insert of Record

    I have a custom method validation on a field in the Entity Object which works fine when I am updating a record, and returns the error message that I want ( The validation checks for a NULL Field and gives the user a nice message "Name English Cannot be NULL" ), but when I create a new record I get a oracle.jbo.AttrValException JBO-27014: Attribut NameEn in AppModule.BannerView is required.
    How do I get my custom validation to fire instead as the default?
    Cory

    I would like to leave the field required.
    Is there anyway to send bilingual labels from the ADF, so the message are like.
    "English Description is requried" instead of default DescEN.
    I have tried to change the names in the entity and views and it always passes back DescEn.
    I am using JClient.
    Cory

  • Validations when inserting records into database using table control?

    hi , guru's.
          iam inserting records into database table through table control when i press insert i want check which record is existing and which is not . so please give me any sample code
    regards,
    satheesh.

    hi , arjun.
    please check this code.
        WHEN 'INSERT'.
        data: g_vcontrol_itab1 like table of zcust_call_rec,
              g_vcontrol_wa1 like g_vcontrol_wa.
         SELECT *  FROM zcust_call_rec
                   INTO CORRESPONDING FIELDS OF TABLE g_vcontrol_itab1
                   FOR ALL ENTRIES IN g_vcontrol_itab
                   WHERE kunnr = g_vcontrol_itab-kunnr AND budat = g_vcontrol_itab-budat.
            loop at g_vcontrol_itab into g_vcontrol_wa.
               read table g_vcontrol_itab1 into g_vcontrol_wa1
                    with table key  g_vcontrol_wa-kunnr = kunnr and g_vcontrol_wa-budat = budat.
                     if sy-subrc = 0.
                       delete g_vcontrol_itab.
                     endif.
            endloop.
          LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
            INSERT into zcust_call_rec values g_vcontrol_wa.
          ENDLOOP.
    with this iam getting error message like this.
              <b>g_vcontrol_wa-budat is not expected.</b>

  • Need validation when insert the data through AddAnotherRow  functionality

    hi All,
    i need to validate customer id when i insert the data through AddAnotherRow functionality in AdvancedTable.
    CO:
    if ("AdvanceTabRN".equals(pageContext.getParameter(SOURCE_PARAM)) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
    am.insrtCustcondtls();
    AM:(For Inserting the Data based on EO Based VO)
    public void insrtCustcondtls()
    XxcurTradeCustomerDtlsEOVOImpl CrteVO=getXxcurTradeCustomerDtlsEOVO1();
    Number cust_seq=getOADBTransaction().getSequenceValue("customer_id_seq");
    CrteVO.setMaxFetchSize(0);
    Row row=CrteVO.createRow();
    CrteVO.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    Here Customer ID is Primary key.
    if customer id is already in the table then i need to throw an exception like customer id is already existing or we need to throw an exception.
    Thanks,
    Mallik.

    Hi Mallik,
    Our doDml() method fires when you try to issue commit if you want to validate data at commit then just add the code in the Entity Object Class as I posted in previous post or if you want to validate records with data at add new Row button then you can follow the following aproach.
    1. create a data base pl/sql function which take the customer id as input and return 1 if the customer already existed or 0 if not existed.
    2. Now we can call this database function at Add new Row button
    i. if it returns 1 then we will throw Exception.
    ii. if it return 0 then we will let the record save in data base.
    The following code will help you.
    private String getCustomerId(OAPageContext pageContext,
    OAWebBean webBean, String customerID) {
    OAApplicationModule am =
    (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();
    String value = null;
    CallableStatement cs = null;
    try {
    String plSqlStatement =
    "begin :1 := nameOfYourFunction(" + customerID +
    "); end;";
    System.out.println(plSqlStatement);
    cs = transaction.createCallableStatement(plSqlStatement, 0);
    System.out.println("got executed");
    cs.registerOutParameter(1, Types.CHAR);
    cs.executeUpdate();
    value = cs.getString(1).toString();
    return value;
    } catch (Exception e) {
    e.printStackTrace();
    return value;
    Finally you can call this method as follow
    if ("AdvanceTabRN".equals(pageContext.getParameter(SOURCE_PARAM)) && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
    String custID;
    am.insrtCustcondtls();
    custID=getCustomerId(pageContext,webBean,customerID)
    if(custID.equals("1")) {
    throw new OAException("Your message");
    Now its up to you which aproach you follow.
    Haroon.

  • Detailed validation not working with insert in to two tables

    Hi All,
    Hope your well!
    I have a small issue relating to the detailed validation when inserting two tables.
    The mastervalidation will work to identify any errors but will not look at the detailed one at all.
    I have config all "Required" form elements to produce an error message but as I say I don't know why or how this is happening.
    I have never noticed it before so I tested it out and did the basic of basic insert in to two table with error messages and still on the mastervaildation works.
    Does anyone have any suggestions?
    Cheers,
    Joe

    One way:
    WITH child AS
            (SELECT 1 id, 'Genentech' AS name FROM DUAL
             UNION ALL
             SELECT 2 id, 'Altana Pharma AG' AS name FROM DUAL
             UNION ALL
             SELECT 3 id, 'Yamanouchi' AS name FROM DUAL
             UNION ALL
             SELECT 4 id, 'Sigma-Tau' AS name FROM DUAL
             UNION ALL
             SELECT 5 id, 'Schering-Plough' AS name FROM DUAL
             UNION ALL
             SELECT 6 id, 'Pharma AG' AS name FROM DUAL
             UNION ALL
             SELECT 7 id, 'Pfizer' AS name FROM DUAL),
         parent AS
            (SELECT 1 id, 'Genentech number' AS names FROM DUAL
             UNION ALL
             SELECT 2 id, 'Altana Pharma AG' AS names FROM DUAL
             UNION ALL
             SELECT 3 id, 'AG site/Yamanouchi' AS names FROM DUAL
             UNION ALL
             SELECT 4 id, 'sigMa Tau' AS names FROM DUAL
             UNION ALL
             SELECT 5 id, 'Schering-Plough' AS names FROM DUAL
             UNION ALL
             SELECT 6 id, 'AG' AS names FROM DUAL
             UNION ALL
             SELECT 7 id, 'Inc' AS names FROM DUAL)
    SELECT *
      FROM child a, parent bc
    WHERE a.id = bc.id
           AND UPPER (REGEXP_REPLACE (a.name, '[^[:alnum:]]')) NOT LIKE
                  '%' || UPPER (REGEXP_REPLACE (bc.names, '[^[:alnum:]]')) || '%';
    Regexp_replace can be avoided and replaced by translate there if you know for sure what characters you are expecting.
    ID NAME ID_1 NAMES
    1 Genentech 1 Genentech number
    3 Yamanouchi 3 AG site/Yamanouchi
    7 Pfizer 7 Inc
    Cheers,
    Manik.

  • Node Insertion - ensure validity against DTD

    I want to create a new XML document, insert elements one by one. How do I ensure that the element is insertable according to DTD specified (i.e. it is valid to insert the new element to the XML document)?
    Thank you

    You can use class com.ibm.xml.parser.DTD to load your DTD and use the getAppendableElements method. Then you can check if an element is in the appendable elements,...

  • Help needed in index creation and its impact on insertion of records

    Hi All,
    I have a situation like this, and the process involves 4 tables.
    Among the 4 tables, 2 tables have around 30 columns each, and the other 2 has 15 columns each.
    This process contains validation and insert procedure.
    I have already created some 8 index for one table, and an average of around 3 index on other tables.
    Now the situation is like, i have a select statement in validation procedure, which involves select statement based on all the 4 tables.
    When i try to run that select statement, it takes around 30 secs, and when checked for plan, it takes around 21k memory.
    Now, i am in a situation to create new index for all the table for the purpose of this select statement.
    The no.of times this select statement executes, is like, for around 1000 times of insert into table, 200 times this select statement gets executed, and the record count of these tables would be around one crore.
    Will the no.of index created in a table impacts insert statement performace, or can we create as many index as we want in a table ? Which is the best practise ?
    Please guide me in this !!!
    Regards,
    Shivakumar A

    Hi,
    index creation will most definitely impact your DML performance because when inserting into the table you'll have to update index entries as well. Typically it's a small overhead that is acceptable in most situations, but the only way to say definitively whether or not it is acceptable to you is by testing. Set up some tests, measure performance of some typical selects, updates and inserts with and without an index, and you will have some data to base your decision on.
    Best regards,
    Nikolay

  • Error while insert

    INSERT INTO emp_hist(EMP_NO,FROM_date,TO_date,last_updated_date )
    VALUES ('IS871',1,'1/1/1900','12/31/9999',SYSDATE)
    I am getting the error
    ORA-01843: not a valid month

    > INSERT INTO
    emp_hist(EMP_NO,FROM_date,TO_date,last_updated_date
    VALUES ('IS871',1,'1/1/1900','12/31/9999',SYSDATE)
    I am getting the error
    ORA-01843: not a valid month
    You are inserting strings into date columns, so Oracle tries to convert these strings to its default format mask and it fails.
    It's better to not rely on implicit date conversion and supply date values.
    So use:
    date '1900-01-01'or
    to_date('1/1/1900','dd/mm/yyyy')By the way, you have four columns listed and you are supplying 5 column values ...
    Regards,
    Rob.

  • Update working, but insert is not working.

    Hi friends,
    Im creating a process for the manular tabular form, that im developing.
    Since for the update im giving the below query
    for i in 1..htmldb_application.g_f01.count
    loop
    if htmldb_application.g_f01(i) is not null then                 
        update gen_req_items
        set item_id = replace(htmldb_application.g_f03(i),'%'||'null%',NULL),
           item_uom_id= replace(htmldb_application.g_f04(i),'%'||'null%',null)
          where req_itm_id = htmldb_application.g_f01(i);
    end if;
    end loop;It is working fine, and i can able to update the rows in my tabular form.
    For insert im giving the following query.
    for i in 1..htmldb_application.g_f01.count
    loop
    if htmldb_application.g_f01(i) is not null then                 
        update gen_req_items
        set item_id = replace(htmldb_application.g_f03(i),'%'||'null%',NULL),
           item_uom_id= replace(htmldb_application.g_f04(i),'%'||'null%',null)
          where req_itm_id = htmldb_application.g_f01(i); 
    else if
    if htmldb_application.g_f01(i) is null
    insert into gen_req_items(barcode, item_id, item_uom_id)
    values(htmldb_application.g_f02(i),replace(htmldb_application.g_f03(i),'%'||'null%',NULL),replace(htmldb_application.g_f04(i),'%'||'null%',NULL));
    end if;
    end if;
    end loop;But the insert is not working, as i couldnt able to insert the values. I dont know what went wrong.
    The below is my region source coding of my tabular form.
    select x.req_itm_id,
    x.barcode,
    x.item_id,
    x.item_uom_id
    from (
    select htmldb_item.text(1,req_itm_id) req_itm_id,
    htmldb_item.select_list_from_query(2,barcode,'select distinct barcode, barcode from gen_req_items') barcode,
    htmldb_item.text(3,item_id,10) item_id,
    htmldb_item.text(4,item_uom_id,10) item_uom_id
    from gen_req_items
    union all
    select htmldb_item.hidden(1,null)  req_itm_id,
    htmldb_item.select_list_from_query(2,null,'select distinct barcode, barcode from gen_req_items') barcode,
    htmldb_item.text(3,null,10) item_id,
    htmldb_item.text(4,null,10) item_uom_id
    from dual) xIm developing a manular tabular form by referring the below link, FYR
    http://www.oracle.com/technetwork/developer-tools/apex/tabular-form-090805.html_
    what might be wrong with my insert statement.
    As i also created sequence and trigger for my primary key column req_itm_id in tabular form
    Brgds,
    Mini

    Mini wrote:
    But the insert is not working, as i couldnt able to insert the values. I dont know what went wrong.
    You've posted here often enough to know that this isn't really sufficient detail. Regarding the above statement, how did you reach that particular conclusion? It might sound like a stupid question, but it gives us a bit of insight into how you have attempted to diagnose the problem and can speed up its resolution.
    * Does the insert work "standalone" i.e. if you write it as a manual query in, for example, the SQL Window, using bind variables?
    * If it does, do you have any special constraints on one or more of the relevant fields (e.g. "not null" on the barcode field)?
    * If so, have you ensured that the relevant field(s) (e.g. F02) are actually populated with values and are valid for insertion?
    In addition, I'm not sure what the purpose of the nested "If" statement is
    if htmldb_application.g_f01(i) is null
    end if;Indeed, the else if won't work either... the correct syntax is elsif

  • Why does BR*Tools return with the error, No Valid SAP license?

    We are using BRTools 640 on HPUX and Oracle 9.2  Now we use BRTools on the other systems where Oracle resides, but when they got installed on this new system it creates the error:  Invalid SAP license.
    There is no SAP installed on any of the systems.  I am coming into the middle of this and have sratched my head over it until I am now balder than I was before. 
    The ora<SID> user is there and so is the <SID>adm.  The directories are ok with the correct rights and permissions.  So what am I missing?  I know it has to be something that I am missing.  Any help out there?
    Thanks,
    David

    Hi Ravinder,
    No this did not resolve the issue.  Here is what happen. 
    Implemented note 586618 and then completed the semophore part.  That worked as is it should.  Then tired a simple BRARCHIVE and this is what I got:
    BR0002I BRARCHIVE 6.40 (36)
    BR0006I Start of offline redo log processing: adsweyuy.svd 2006-06-19 14.30.40
    BR0925I Public synonym SAP_SDBAH created successfully for table SAPBIX.SDBAH
    BR0925I Public synonym SAP_SDBAD created successfully for table SAPBIX.SDBAD
    BR0925I Public synonym SAP_MLICHECK created successfully for table SAPBIX.MLICHECK
    BR0602E No valid SAP license found - please contact SAP
    BR0280I BRARCHIVE time stamp: 2006-06-19 14.30.41
    BR0301W SQL error -980 at location BraDbLogOpen-5
    ORA-00980: synonym translation is no longer valid
    BR0324W Insertion of database log header failed
    BR0007I End of offline redo log processing: adsweyuy.svd 2006-06-19 14.30.41
    BR0280I BRARCHIVE time stamp: 2006-06-19 14.30.41
    BR0005I BRARCHIVE terminated with errors
    This is somewhat irritating because as you I though and you probably did also, note 584418 should have fixed it.
    I have searched the OSS, but to no avail..so if you have any suggestions it would be appreciated.  The really weird thing is it works on other systems.  I think something is just missing and I am just too blind right now to see it.
    Regards,
    David E. Dick

  • Can I use Struts Validator Plugin's html:javascript tag?

    Hi:
    Is it possible to incorporate the client-side validation using Struts Validator
    Plugin's tag <html:javascript>?
    i.e.
    1) Insert the following tag to A.jsp and define a taglib:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <html:javascript formName="aForm" staticJavascript="true"/>
    2) Define validation.xml as follows:
    <form-validation>
    <formset>
    <form name="aForm">
    <field property="aField"
    depends="required">
    <msg name="required" key="FieldMissingError"/>
    </field>
    </form>
    </formset>
    </form-validation>
    3) Insert the onSubmit event in aForm:
    <netui:form action="SubmitAForm" style="border-width:1px;" onSubmit="validateAForm(this)">

    Instead of writing something like this -
    <p class="logos">Logo1<a href="...></a></p>
    <p class="logos">Logo2<a href="...></a></p>
    <p class="logos">Logo3<a href="...></a></p>
    <p class="logos">Logo4<a href="...></a></p>
    <p class="logos">Logo5<a href="...></a></p>
    <p class="logos">Logo6<a href="...></a></p>
    Why not have something like this -
    <div id="logodiv">
    <p>Logo1<a href="...></a></p>
    <p>Logo2<a href="...></a></p>
    <p>Logo3<a href="...></a></p>
    <p>Logo4<a href="...></a></p>
    <p>Logo5<a href="...></a></p>
    <p>Logo6<a href="...></a></p>
    </div>
    with CSS like this -
    #logodiv p { ... }

Maybe you are looking for