Wrong results in SDO_RELATE function using optimized rectangle

Hi there,
I'm using a query like this to catch points thet are inside a users bounding box:
<em>select * from data where sdo_relate(GPS_POSITION,</em>
<em>mdsys.sdo_geometry(2003,8307,null, mdsys.sdo_elem_info_array(1,1003,3),</em>
<em>mdsys.sdo_ordinate_array(-100 ,-80, 100, 80 )),'mask=INSIDE querytype=window layer_gtype=point') = 'TRUE'</em>
This works fine for small rectangles, but if I choose a large rectangle (like above), I get completely wrong data.
Are there any restrictions on the size of the rectangle?
And if, how to overcome this?
Thanks in advance and best regards,
Florian
Edited by: user649907 on 29.10.2008 09:00

Guys, thanks so far!
So I could split up my query to some smaller rectangles to solve the problem.
Right now I realized my problem seems to be a bit larger.
Queries even don't work on smaller rectangles.
When I roughly cover Australia, I get some data in Australia, but also lots of data between Australia and South America.
Query looks like this:
select * from data where
sdo_relate(GPS_POSITION,
mdsys.sdo_geometry(2003,8307,null, mdsys.sdo_elem_info_array(1,1003,3),
mdsys.sdo_ordinate_array(115,-39, 155, -13)),
'mask=ANYINTERACT querytype=window layer_gtype=point') = 'TRUE'
I get points like this back:
-164, -54
-160, -64
and lots more.
We use Oracle 10g2.
Any idea?
Florian

Similar Messages

  • Question about sdo_relate function

    My application has to check if a point geometry is inside (MASK='ANYINTERACT') a polygon geometry. I am trying to figure out if sdo_relate function works with rectangle only or if it works with polygon. I have wrote a few sql test and it seems to work with polygons, but I dont know how it works.
    My question is, if the geometry is not a rectangle, why dont I have to use projection to project both geometry into a plane first?
    For example if I have a polygon (-140, 35, -139, 36, -139, 35, -140, 34, -140, 35) and a point(-139.3, 35.6) how does sdo_relate finds out if the point is within the polygon without projecting them?
    Thanks.

    how does oracle connects the points in a polygon that's not on the same latitude or longitude?Your question is a little ambiguous. What do you mean by 'not on the same latitude..'? Are you talking about different coordinate systems? Or do you just mean how does Oracle know whether your point is inside the polygon or not?
    If its the former then read:
    http://download-uk.oracle.com/docs/html/B14255_01/sdo_cs_concepts.htm#i882173
    If the latter, then suffice to say that Oracle Spatial knows how to work these things out in order to return the correct result.
    Have a read of the spatial concepts documentation:
    http://download-uk.oracle.com/docs/html/B14255_01/sdo_intro.htm

  • Simple query with like return wrong result

    Hi,
    I run simple query with like.
    If I use parameter I get wrong results.
    If I use query without parameter results are ok.
    My script:
    ALTER SESSION SET NLS_SORT=BINARY_CI;
    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    -- drop table abcd;
    create table abcd (col1 varchar2(10));
    INSERT INTO ABCD VALUES ('122222');
    insert into abcd values ('111222');
    SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
    COL1
    122222
    *111222*
    select * from abcd where col1 like '12%'; -- result ok
    COL1
    122222
    I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    and query run in Oracle SQL Developer 3.1.07.

    Hi,
    welcome to the forum.
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    You should specify exactly how you run your code.
    If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
    Session altered.
    SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    Session altered.
    SQL>
    SQL> -- drop table abcd;
    SQL> create table abcd (col1 varchar2(10));
    Table created.
    SQL>
    SQL> INSERT INTO ABCD VALUES ('122222');
    1 row created.
    SQL> insert into abcd values ('111222');
    1 row created.
    SQL>
    SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
    SP2-0552: Bind variable "1" not declared.
    SQL>
    I got this error. So I wonder how you set value 12%
    Please specify exactly how you run your test as we cannot reproduce your problem.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • [HELP] AGO function return wrong result

    Hi, i try to implement ago function in OBIEE, but the result is not as expected. Please help me to configure Time Dimension to get this work.
    My case:
    - I have a time dimension with this configuration:
    [http://i264.photobucket.com/albums/ii176/necrombi/NEO/1-1.png]
    Time Hierarchy: Total > Year > Quarter > Month > Day
    Year:
    Primary key: Calendar_year_cal_year_code
    Chronological key: Does not define
    Quarter:
    Primary key: Calendar_quarter_description
    Chronological key: Does not define
    Month:
    Primary key: Calendar_month_description
    Chronological key: Calendar_month_description
    Day:
    Primary key: Dimension_key
    Chronological key: Day_day_code
    My ago function: AGO(expression, mywh.D_qn_thoigianDim."month", 1)
    I do not understand why i get this wrong results:
    [http://i264.photobucket.com/albums/ii176/necrombi/NEO/2.png]
    Does anyone know how to solve this?
    Edited by: 864451 on Jun 8, 2011 5:11 AM

    Hi, thanks for your reply.
    I implemented Time dimension with your recommend, and have time dimension like this:
    Time Hierarchy: Total > Year > Quarter > Month > Day
    Year:
    Primary key: Calendar_year_start_date
    Chronological key: Calendar_year_start_date
    Quarter:
    Primary key: Calendar_quarter_start_date
    Chronological key: Calendar_quarter_start_date
    Month:
    Primary key: Calendar_month_start_date
    Chronological key: Calendar_month_start_date
    Day:
    Primary key: Day
    Chronological key: Dimension_key
    And Ago function works fine with month level: AGO(expression, mywh.D_qn_thoigianDim."month", n)
    But return sum result of 12 month with: AGO(expression, mywh.D_qn_thoigianDim."year", 1)
    In my case, i just use AGO(expression, mywh.D_qn_thoigianDim."month", 12) to get year ago value. But i still don't understand clearly about OBIEE Time Serries functions.
    Thanks,
    Dung Nguyen

  • Function used in SQL query not showing the desired results

    I have created a function that gives me the client id but when i am using the function in the query its not giving me any result i.e. 0 rows but if I execute the function sepreatly and put the result of that function in the qurey it is giving me the desired result please have a look on the following and please reply with you expert opinion:
    FUNCTION CODE:
    create or replace function j2
    (usid in varchar2)
    return varchar2
    is
    cidn_in varchar2(4000) := '';
    ls_sep varchar2(1) := ',';
    cursor predicate_cidn
    is
    select
    logical_schema_id
    from
    CLIENT_REGISTRY cr,
    MEMBER_ROLE_CLIENT_ASSIGNMENT mrca,
    MEMBER m
    where
    mrca.base_client_id = cr.base_client_id and
    mrca.member_id = m.member_id and
    cr.schema_in_use_in = '1' and
    m.active_status_id = 'A' and
    upper(mrca.member_id) = upper(usid);
    BEGIN
    for GET_CIDN in predicate_cidn
    loop
    cidn_in := cidn_in || ls_sep || '''' || GET_CIDN.logical_schema_id || '''';
    end loop;
    cidn_in := substr(cidn_in, 2);
    cidn_in := '('||cidn_in||')';
    --dbms_output.put_line(cidn_in);
    return cidn_in;
    END ;
    SQL> select j2('qaa@adp') from dual;
    J2('QAA@ADP')
    ('BASE18','SDK1TEST','SEETHA1CONFIG','BASE09','KAREN2','SIVACONFIG','BASE19','SD
    K1CTEST','VASU1','KAREN5','EVENTS1CTEST','SDK1','ADA1CONFIG','BASE10','VRB1CONFI
    G','CRU2CONFIG','BASE20','SIVATEST','PCOMCONFIG','KP1CONFIG','KAREN4CONFIG','EVE
    NTS1TEST','SUZ3CONFIG','DONG2CONFIG','ED2CONFIG','SIVACTEST','APDCONFIG','EVENTS
    1CONFIG','ESSCONFIG','SIVA','SDK2CONFIG','ED3CONFIG','RAJ4CONFIG','CBRCONFIG','N
    AMRATA2CONFIG','EMIL1','NAMRATA1CONFIG','SDK2CTEST','BVT2CONFIG','MURUGAN1CONFIG
    ','COB1CONFIG','GABY1TEST','CHR1CONFIG','ED4CONFIG','USE1CONFIG','SDK2TEST','DEM
    O1CONFIG','BERNIE1CONFIG','XA1','CAR2TEST','SDK2','ED5CONFIG','PAY1TEST','PAYXCO
    NFIG','KP1TEST','SEAN1CONFIG','CAR2CTEST','VASU1CONFIG','SEAN2CONFIG','KP1CTEST'
    ,'MAU1CONFIG','CONWCONFIG','PAN1CONFIG','MERAJ2','PRA3CONFIG','SEAN5CONFIG','KP1
    ','PRA4CONFIG','CAR2CONFIG','PRA2CONFIG','SEAN6CONFIG','PRA3TEST','RPT','GABY1CT
    EST','SDK3CONFIG','PRA2TEST','SEAN9CONFIG','CAR2','LV1CONFIG','PRA3CTEST','DONG1
    CONFIG','TE1CONFIG','MERAJ2CONFIG','VIV1CONFIG','GABY1','SEAN2','PRA2CTEST','PRA
    3','RPTCONFIG','PRA4CTEST','SEAN3','MITA1CONFIG','PRA2','RPTCTEST','PCOM1CONFIG'
    ,'SS2CONFIG','PAY1CONFIG','SEAN7','ANNCONFIG','BASE11','BASE02','LV2CONFIG','RPT
    TEST','IMPECONFIG','SUR1CONFIG','SREEK2CONFIG','BASE03','SRINU3CONFIG','BDCONFIG
    ','JAY1CONFIG','AMMAN1','PRA1TEST','WPGCONFIG','BASE12','MP5CONFIG','MERAJ1','SR
    INU2CONFIG','XA1CONFIG','RAJ1CONFIG','WPGCTEST','BASE04','CHRIS','RAJSCONFIG','P
    ANKAJ','BASE13','WPGTEST','RAJ3CONFIG','WPG','BASE14','VASU2CONFIG','SRINU1CONFI
    G','BASE05','PRA4TEST','VASU1TEST','PRA5CONFIG','NISH1CONFIG','CHRISCONFIG','SDK
    3TEST','RAJ3TEST','KP2CONFIG','BASE06','DEFPCONFIG','NISH2CONFIG','CHRISCTEST','
    WPSCONFIG','VASU2TEST','BASE15','GABY1CONFIG','PRA5TEST','MITA2CONFIG','BASE07',
    'VASU1CTEST','KP2TEST','VASU2CTEST','LAURA3CONFIG','BASE16','CHRISTEST','WPSTEST
    ','VASU2','KP2CTEST','EVENTS1','BASE17','RAJ2CONFIG','WPSCTEST','BASE08','SREEK1
    CONFIG','ADVE','PRA4','SDK1CONFIG','KP2','KAREN1','CRU1CONFIG','WPS')
    Now if i put the results (cut and paste )in the query it gives me the results
    SQL> select count(*) from baseclient.address_detail where cidn in ('BASE18','SDK1TEST','SEETHA1CONFIG','BASE09','KAREN2','SIVACONFIG','BASE19','SD
    2 K1CTEST','VASU1','KAREN5','EVENTS1CTEST','SDK1','ADA1CONFIG','BASE10','VRB1CONFI
    3 G','CRU2CONFIG','BASE20','SIVATEST','PCOMCONFIG','KP1CONFIG','KAREN4CONFIG','EVE
    4 NTS1TEST','SUZ3CONFIG','DONG2CONFIG','ED2CONFIG','SIVACTEST','APDCONFIG','EVENTS
    5 1CONFIG','ESSCONFIG','SIVA','SDK2CONFIG','ED3CONFIG','RAJ4CONFIG','CBRCONFIG','N
    6 AMRATA2CONFIG','EMIL1','NAMRATA1CONFIG','SDK2CTEST','BVT2CONFIG','MURUGAN1CONFIG
    7 ','COB1CONFIG','GABY1TEST','CHR1CONFIG','ED4CONFIG','USE1CONFIG','SDK2TEST','DEM
    O1CONFIG','BERNIE1CONFIG','XA1','CAR2TEST','SDK2','ED5CONFIG','PAY1TEST','PAYXCO
    8 9 NFIG','KP1TEST','SEAN1CONFIG','CAR2CTEST','VASU1CONFIG','SEAN2CONFIG','KP1CTEST'
    10 ,'MAU1CONFIG','CONWCONFIG','PAN1CONFIG','MERAJ2','PRA3CONFIG','SEAN5CONFIG','KP1
    11 ','PRA4CONFIG','CAR2CONFIG','PRA2CONFIG','SEAN6CONFIG','PRA3TEST','RPT','GABY1CT
    12 EST','SDK3CONFIG','PRA2TEST','SEAN9CONFIG','CAR2','LV1CONFIG','PRA3CTEST','DONG1
    13 CONFIG','TE1CONFIG','MERAJ2CONFIG','VIV1CONFIG','GABY1','SEAN2','PRA2CTEST','PRA
    14 3','RPTCONFIG','PRA4CTEST','SEAN3','MITA1CONFIG','PRA2','RPTCTEST','PCOM1CONFIG'
    15 ,'SS2CONFIG','PAY1CONFIG','SEAN7','ANNCONFIG','BASE11','BASE02','LV2CONFIG','RPT
    16 TEST','IMPECONFIG','SUR1CONFIG','SREEK2CONFIG','BASE03','SRINU3CONFIG','BDCONFIG
    17 ','JAY1CONFIG','AMMAN1','PRA1TEST','WPGCONFIG','BASE12','MP5CONFIG','MERAJ1','SR
    18 INU2CONFIG','XA1CONFIG','RAJ1CONFIG','WPGCTEST','BASE04','CHRIS','RAJSCONFIG','P
    19 ANKAJ','BASE13','WPGTEST','RAJ3CONFIG','WPG','BASE14','VASU2CONFIG','SRINU1CONFI
    20 G','BASE05','PRA4TEST','VASU1TEST','PRA5CONFIG','NISH1CONFIG','CHRISCONFIG','SDK
    21 3TEST','RAJ3TEST','KP2CONFIG','BASE06','DEFPCONFIG','NISH2CONFIG','CHRISCTEST','
    22 WPSCONFIG','VASU2TEST','BASE15','GABY1CONFIG','PRA5TEST','MITA2CONFIG','BASE07',
    23 'VASU1CTEST','KP2TEST','VASU2CTEST','LAURA3CONFIG','BASE16','CHRISTEST','WPSTEST
    24 ','VASU2','KP2CTEST','EVENTS1','BASE17','RAJ2CONFIG','WPSCTEST','BASE08','SREEK1
    25 CONFIG','ADVE','PRA4','SDK1CONFIG','KP2','KAREN1','CRU1CONFIG','WPS');
    COUNT(*)
    228
    BUT if I user the function it gives me no results
    0 rows selected and its taking a loon time to reurn

    This appears to be a duplicate of the question in this thread
    Re: VPD issue Need Assistance ASAP
    where I wrote
    "Your function returns a single string that happens to have a bunch of commas and quotes in it. An IN list generally requires a list of strings, which your function doesn't return.
    You could rewrite the function to be a pipelined table function and then do
    select count(*)
    from baseclient.address_detail
    where cidn in (SELECT cidn
    FROM TABLE(<<your pipelined table function>>))
    However, I would expect it to be easier not to wrap all this into a function and just have your IN clause be the logic in your predicate_cidn cursor.
    Justin
    "

  • Using the result of a function, inside a subselect

    Hi!
    I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
    select * from t_node where node_pk in (get_node_parents_pk(22345));
    The function get_node_parents_pk stands in for the following SELECT-statment:
    select node_pk from t_node_child where parent_node_pk = 12345
    The statement above would return something like this: 12435,23423,23453,23452
    These values represent the node_pk value for the parent nodes.
    I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
    Any clue? =)

    I created a collection type in the database:
    CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
    The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (get_node_parents_pk (22345)));
    ORA-22905: cannot access rows from a non-nested table item
    However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
    So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
    Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
    SELECT *
    FROM t_node
    WHERE node_pk IN (get_node_parents_pk (22345));
    Your reply is much appreciated!
    Kind regards
    Robert

  • Executing stored function using Native SQL

    In SAP documentation, I can see how to execute an Oracle stored procedure in an external database using:
    EXEC SQL.
      EXECUTE PROCEDURE procname
    ENDEXEC.
    I want to execute a stored FUNCTION within a package.  I have tried executing it using the syntax for PROCEDURE above and get a "ORA-06550 wrong type or number of arguments" error.  Since the function has one argument in and one argument out, I think I am counting the number of arguments correctly.  Has anyone executed from within ABAP an Oracle function stored in an external database?
    Thanks
    Janice Ishee

    Janice - from help.sap.com:
    Stored Procedures
    The command EXECUTE PROCEDURE proc allows you to call a procedure stored in the database. When you call it, you can pass a list of host variables as parameters. When yuo call a procedure, you must specify for each parameter whether it is an input parameter ( IN), output parameter (OUT) or changing parameter (INOUT).
    Example
    Calling a Procedure:
    DATA Y TYPE I VALUE 300.
    DATA Z TYPE I.
    EXEC SQL.
    INSERT INTO AVERI_CLNT (CLIENT, ARG1, ARG2, ARG3)
    VALUES ('000', 9, 2, 47)
    ENDEXEC.
    EXEC SQL.
    CREATE OR REPLACE PROCEDURE PROC1 (X IN NUMBER) IS
    BEGIN
    UPDATE AVERI_CLNT SET ARG3 = ARG3 + X;
    END;
    ENDEXEC.
    EXEC SQL.
    CREATE OR REPLACE PROCEDURE PROC2 (X IN NUMBER, Y OUT NUMBER) IS
    BEGIN
    SELECT ARG3 INTO Y
    FROM AVERI_CLNT
    WHERE CLIENT = '000' AND ARG1 = 9 AND ARG2 = 2;
    UPDATE AVERI_CLNT SET ARG3 = ARG3 - X;
    END;
    ENDEXEC.
    EXEC SQL.
    EXECUTE PROCEDURE PROC1 ( IN :Y )
    ENDEXEC.
    EXEC SQL.
    EXECUTE PROCEDURE PROC2 ( IN :Y, OUT :Z )
    ENDEXEC.
    IF SY-SUBRC <> 0 OR Z <> 347.
    WRITE: / 'Wrong result for EXECUTE PROCEDURE:', Z.
    ENDIF.
    EXEC SQL.
    DROP PROCEDURE PROC1
    ENDEXEC.
    EXEC SQL.
    DROP PROCEDURE PROC2
    ENDEXEC.
    Rob

  • Pathfinder produces very wrong results. Long time Illy user. **URGENT**

    Running Mac 10.10.1 (newest Yosemite)
    Adobe CC
    PROBLEM #1
    Recently when performing a simple "minus front" with two objects, I get very wrong results. See image below. I created icons that are knocking out the BG behind it. Had no problems with the others until I got to the fork. I created the fork using rectangles, and the new direct select to create round corners feature. I can work around this problem by creating an opacity mask on the BG and pasting in the icon at full black. However, when I import that into inDesign, the fork still shows as it's original color. Ok fine. I can export from AI as a .png and avoid it. But that's a pain, and CC has already been pushing my buttons this week. And I'd rather just figure out the why.
    I also rasterized the fork icon in AI, then performed an image trace to vectorize it again - in hopes that this would be a magical fix. It was not. It ended up being a worse result than before, after using minus front.
    PROBLEM #2
    I found that if I alt-drag these elements, and then perform the minus front, I get very close to what is expected. However, this is where it gets really weird. Once I drag the newly created shape around my artboard, the area that had the minus front performed on it, begins to change. See the pictures below picture one for reference. What the eff. This is really confusing.
    Any help would be great. I am putting together a branding guidelines tonight for my client and this happens to be one of those little snags.
    Thanks
    Problem 1 picture - left side is after minus front
    Problem 2 pictures - after minus front, and moved around a few times

    You've got the Align-to-Pixel Grid turned on and are not using whole pixels for your objects.

  • Wrong results after upgrading 10g database to 11.2.0.2.6

    Hi,
    Do anyone know, why the following query results are different?
    Not Working query:
    sql1:
    select col1 from tab1
    where col1 = (select '123' from dual)
    Working query:
    sql2:
    select col1 from tab1
    where col1 = '123';
    Both the sql1 and sql2 are returning same reseults in 10g database , but not in 11g.

    Pl post OS details along with sample outputs and explain plans from the the sql1 statement from the two databases. These MOS Docs may help also
    Things to Consider Before Upgrading to 11.2.0.2 to Avoid Poor Performance or Wrong Results [ID 1320966.1]
    Wrong Results on 11.2.0.2 with Function-Based Index and OR Expansion [ID 1264550.1]
    Wrong Results/No Rows for Sql Involving Functions in 11.2.0.2. [ID 1380679.1]
    HTH
    Srini

  • Create a BLOB in a function used in AQ Transformation

    Hi all
    This is driving me crazy ...
    I have an AQ transformation where I have to create an XML and store it into a BLOB (Yes, why??? Because the 3rd party app. Dimension demands it - so I cant just deliver into an XMLTYPE). I have problems making the transformation work, and I supect it has to do with lob, lob locator - and not having a temp LOB.
    The input is a JMS Text message - the output it userdefined:
    (Code)
    CREATE OR REPLACE TYPE MSGTYPE2 AS OBJECT(Label VARCHAR2(128), Payload blob)
    create or replace function fra_jms_til_dimension (input_msg SYS.AQ$_JMS_TEXT_MESSAGE)
    return msgtype2 is
    output_msg msgtype2;
    serviceid varchar2(50);
    correlationId varchar2(50);
    isRequest boolean;
    isError boolean;
    c_isRequest varchar2(10);
    c_isError varchar2(10);
    errorDescription varchar2(50);
    beskeden clob;
    input_kopi SYS.AQ$_JMS_TEXT_MESSAGE;
    charid number := nls_charset_id('UTF8');
    BEGIN
    -- Hent diverse settings fra JMS
    serviceid := input_msg.get_string_property('serviceId');
    correlationId := input_msg.get_string_property('correlationId');
    isRequest := input_msg.get_boolean_property('isRequest');
    isError := input_msg.get_boolean_property('isError');
    errorDescription := input_msg.get_string_property('errorDescription');
    -- kopier hele besked, da get_text ikke kan bruges p&aring; IN parametre
    input_kopi := input_msg;
    input_kopi.get_text(beskeden);
    input_kopi := null;
    -- lav booleans om til VARCHARS
    c_isrequest := bool2char(isrequest);
    c_iserror := bool2char(iserror);
    -- lav ny XMLTYPE til Dimension
    output_msg := MSGTYPE2(null,null);
    select xmlelement("DimensionMessage",
    xmlelement("header",xmlelement("serviceId",serviceid),
    xmlelement("correlationId",correlationId),
    xmlelement("isRequest",c_isrequest),
    xmlelement("isError",c_iserror),
    xmlelement("errorDescription",errorDescription)
    xmlelement("data",beskeden)
    ).getblobval(charid)
    into output_msg.payload from dual;
    output_msg.label := 'Data fra PFA';
    plog.info('Message converted:' || beskeden);
    return output_msg;
    END;
    (/Code)
    Sorry - I couldnt make the Code tag work ! Tried multiple versions of brackets without success.
    ANyways: I think I might need to make a temporary lob here in order to get the payload from xmltype to a real blob used further down the line.
    Can anyone give me a hint?
    The AQ transformations fails with an ORA-01426 Numeric Overflow - and hangs up after gaving done the plog.info stuff.

    No idea on how to set.
    But in our case, we have a requirement for calculation of GOSI for our Bahrani Employees. Hence did the same using by creating a FUNCTION ZGOSI.
    We have not given any input or output parameters.
    Used a Z program for payroll driver RPCALCX0 -- ZSH_GOSI_CALC and the calculations are taken from this program and output is displayed in the RT table- Wage types.
    For more information, check with functions of infotype like P0014, P0015, you will get some idea on the same.
    Before giving the above, need to mention the parameter list for control.
    Mostly the input parameters are given as Objects like in our Payroll Process, there is WPBP table and output parameters the results to be displayed using object RT.
    Analyze more on the same and you will come to know.
    Good luck.
    Regards
    Team Member.

  • Problem with SDO_relate when using polygons with holes.

    I'm having a problem with sdo_relate. I'm trying to extract all elements from a point table (bdtq_batim_p) that are inside a specific polygon from another table (SDA_MUNIC_SS). The spatial index for both table have been rebuilt and the data from both table is valid.
    When I do a count on the query, I know the answer should be 1422 elements (Counted in ArcGIS). However, sdo_relate gives a smaller number of elements in the result set.
    The query :
    SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and sdo_relate( t.SHAPE,s.SHAPE,'mask=anyinteract querytype=window') = 'TRUE'
    returns 282 elements. The query with mask=inside, SDO_Anyinteract() and SDO_inside() all give the same result.
    I did a test with the following query and the result is 1422 (which is the good result).
    SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE';
    It's important to note that the polygone (from SDA_MUNIC_SS) that is used for this query have holes in it. I have the same problem with all the polygons from the SDA_MUNIC_SS table that have holes in it. For the polygon without holes, the results are the same for the 2 queries.
    My question are :
    Why are the result from the two queries different? A query with a buffer of 0 should always return the same result as a query with Anyinteract.
    Is there a known problem with SDO_RELATE when using a polygon with holes in it?
    Do you have any idea how to solve my problem.

    Since i don't have much control on the version of Oracle and Patches that we use in the system, we used a workaround that detects the polygons with holes and uses the SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE' operator in those case. We saw a slight decline in performance but it now returns the right results. When the system will be patched, we'll come back to the original version and see if the problem is solved.

  • Repost Function using Variable is not working

    Hello experts!  I am on BW-BPS 3.5.  I have set up a repost function using variables to change a characteristic value for Business Unit.
    1. I created 2 variables as Bus.Unit From and Bus.Unit To in the Planning Area. I am not using the variables in my planning level.
    2. I entered the variables in the parameter group New Values area for the From and To Values.
    3. My goal is when the user executes the Repost Function for a Variable Prompt should appear and have the user select the From Business Unit and To Business Unit.
    The Variables are set up as USERVALUE User-Defined Values, Restriction of Values required by user and I have tried with/without option of Input Allowed by User. 
    Can you tell me what I am doing wrong, I expected a variable prompt when executing the Repost Function but it does not work.
    Thank you,
    Teri

    Ravi, Thank you for your reply however I contiue to have errors or the execution does not repost (change any value) as noted below.
    1. I have 2 Variables in Planning area var1 (from) var2 (to) for the same charateristic which is Business Unit
    2. Business Unit is in the level,  on the selection tab to add the variable I can only add 1 variable, So I added var1 (from) to the level. 
    3. Parameter group for old and new values - I have Var1 (from), var2 (to)
    4. Report Function - are you referring to Reporting variables in BPS? I have set this up as suggested in the "How to Use Reporting Variable in BW-BPS" document.
    5. Enter plan data: I receive prompt for VAR1, mandatory. At this point there is no value in Var2.
    6. Execute Repost function - I receive an error to "Restrict Var2"
    7. If I set variable values and add a value for Var2 I receive an error "The generated data is not contained in the selection condition".
    Next I removed VAR1 from my planning level and turned on the option 'Selection in package' for Business Unit. This seems to work well.
    What do you recommend?
    Thank you,
    Teri

  • NOT IN operator giving the wrong results

    DB version:10gR2
    Why is NOT IN giving the wrong results. Isn't NOT EXISTS operator a flawless alternative to NOT IN?
    create table my_table1 (col1 number);
    insert into my_table1 values (1);
    insert into my_table1 values (2);
    commit;
    create table my_table2 ( col1 number);
    insert into my_table2 values (1);
    commit;
    select * from my_Table1;
           COL1
              1
              2
    select * from my_table2;
           COL2
              1
      --correct result
      SELECT * FROM my_table1 t1 WHERE NOT EXISTS
    (SELECT * FROM my_table2 t2 WHERE t1.col1 = t2.col1)
           COL1
              2
    ---correct result using IN
    SELECT * FROM my_table1 t1 where col1 not in (select col1 FROM my_table2 t2);
           COL1
              2
    Inserting a NULL to my_Table2
    Now the query using NOT IN is returning wrong results.
    insert into my_table2 values (null);
    commit;
    SELECT * FROM my_table1 t1 where col1 not in (select col1 FROM my_table2 t2);
    no rows selected
    Query using NOT EXISTS is still giving the right results.
    SELECT * FROM my_table1 t1 WHERE NOT EXISTS
       (SELECT * FROM my_table2 t2 WHERE t1.col1 = t2.col1);
           COL1
              2

    ScottsTiger wrote:
    can i use NOT EXISTS(with a proper Co-related subquery) as a safe alternative to NOT IN?Depends on your data and what you need to achieve.
    Personally I avoid using NOT EXISTS or NOT IN if I can really help it.
    My preferred method is to outer join the tables together and then remove any resultant rows where a value exists and I didn't want one. ;)

  • Sdo_util.to_gmlgeometry on an optimized rectangle with a hole

    11.2.0.2 on Linux
    This is a bit of an obscure one - I've worked around it, but thought I'd put it up here anyway...
    I've got a polygon geometry that is an optimized rectangle outer ring with an optimized rectangle inner ring - I know, very odd and not really a good idea, but it does pass validation:
    SQL> select sdo_geom.validate_geometry_with_context(
      2    sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 3, 5, 2003, 3), sdo_ordinate_array(0, 0, 10, 10, 0.5, 0.5, 9.5, 9.5)),
      3    0.005) as valid
      4  from dual;
    VALID
    TRUE
    sdo_util.to_gmlgeometry produces a sensible result:
    SQL> select sdo_util.to_gmlgeometry(
      2    sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 3, 5, 2003, 3), sdo_ordinate_array(0, 0, 10, 10, 0.5, 0.5, 9.5, 9.5))) as gml
      3  from dual;
    GML
    <gml:Polygon srsName="SDO:" xmlns:gml="http://www.opengis.net/gml">
      <gml:outerBoundaryIs>
      <gml:LinearRing>
      <gml:coordinates decimal="." cs="," ts=" ">0.0,0.0 10.0,0.0 10.0,10.0 0.0,10.0 0.0,0.0 </gml:coordinates>
      </gml:LinearRing>
      </gml:outerBoundaryIs>
      <gml:innerBoundaryIs>
      <gml:LinearRing>
      <gml:coordinates decimal="." cs="," ts=" ">0.5,0.5 0.5,9.5 9.5,9.5 9.5,0.5 0.5,0.5 </gml:coordinates>
      </gml:LinearRing>
      </gml:innerBoundaryIs>
    </gml:Polygon>
    But sdo_util.to_wktgeometry makes a dogs dinner of it:
    SQL> select sdo_util.to_wktgeometry(
      2    sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 3, 5, 2003, 3), sdo_ordinate_array(0, 0, 10, 10, 0.5, 0.5, 9.5, 9.5))) as wkt
      3  from dual;
    WKT
    POLYGON ((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))
    Looks like a bug in sdo_util.to_wktgeometry?
    We'll get around it by writing these geometries out in the long format, but I'd expect sdo_util.to_wktgeometry to handle it nonetheless.
    John

    Same on 12.1.1.0 too.
    PDB1@ORCL> select banner from v$version;
    BANNER
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    PL/SQL Release 12.1.0.1.0 - Production
    CORE 12.1.0.1.0 Production
    TNS for Linux: Version 12.1.0.1.0 - Production
    NLSRTL Version 12.1.0.1.0 - Production
    PDB1@ORCL> select sdo_util.to_wktgeometry(
      sdo_geometry(2003, null, null, sdo_elem_info_array(1, 1003, 3, 5, 2003, 3),
      sdo_ordinate_array(0, 0, 10, 10, 0.5, 0.5, 9.5, 9.5))) as wkt
    from dual;  2    3    4 
    WKT
    POLYGON ((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))

  • Wrong results for context search on empty element tags

    I'm using Oracle DBMS 11.1 and 11.2 and created a context index on an XML column (section group: PATH_SECTION_GROUP).
    When entering a query like
    SELECT count(*) FROM my_table t WHERE contains (t.co_xml,'hasPath(/tag1/tag2)') > 0
    I get wrong results if tag2 is an empty element tag (<tag2/>) that appears somewhere within the
    XML instance, but NOT directly under tag1.
    E.g., the following XML instance is found (but shouldn't!):
    <a>
    <tag1>bla<tag3>bla</tag3></tag1>
    <tag4>bla<tag2/></tag4>
    </a>
    This seems to happen only for empty element tags. Is this a known bug and does anybody know a workaround?
    Thanks in advance for your help!
    Roman

    I am unable to reproduce the problem. Can you provide a copy and paste of an actual run, including create table, insert data, create index, and select, as I have done below?
    SCOTT@orcl_11g> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE     11.1.0.6.0     Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SCOTT@orcl_11g> create table my_table
      2    (co_xml     xmltype)
      3  /
    Table created.
    SCOTT@orcl_11g> insert into my_table values (
      2  xmltype ('<?xml version="1.0"?>
      3  <tag5>
      4    <tag1>bla<tag3>bla</tag3></tag1>
      5    <tag4>bla<tag2/></tag4>
      6  </tag5>'))
      7  /
    1 row created.
    SCOTT@orcl_11g> create index my_idx
      2  on my_table (co_xml)
      3  indextype is ctxsys.context
      4  parameters ('section group ctxsys.path_section_group')
      5  /
    Index created.
    SCOTT@orcl_11g> SELECT count(*)
      2  FROM   my_table t
      3  WHERE  contains (t.co_xml, 'hasPath (//tag1/tag2)') > 0
      4  /
      COUNT(*)
             0
    SCOTT@orcl_11g> SELECT count(*)
      2  FROM   my_table t
      3  WHERE  contains (t.co_xml, 'hasPath (//tag1/tag3)') > 0
      4  /
      COUNT(*)
             1
    SCOTT@orcl_11g>

Maybe you are looking for