Oracle Spatial Query from SQLPLUS deteriorates in performance

Hi,
I am running an sql-procedure, which does spatial queries. When I run this procedure (from SQLPLUS) for the first time it takes around 45 sec to complete, but when I run the same procedure for the second time it takes 65 seconds and the performance keeps on decreasing. But if I open a new SQLPLUS session it takes 45 secs and it also starts deteriorating subsequently. This strange behaviour is only for spatial queries, if I don't have spatial queries in my procedure then its fine.
I found this behaviour for any type of spatial query.
Is there something which can be done for improving it ? I found a lot of information on improving performance of a query, but my problem is to maintain the same performance of the same query in the same session.
Thanks,
Rishi

Hi,
Could you provide version information?
Also, could you try monitoring memory as the procedure is running an see
if memory climbs more each time the procedure is run?
Thanks

Similar Messages

  • Why oracle spatial query execute so slow???

    hi all,
    I have two oracle spatial table CHI_2007r2 and CHI_2008r2, each table has it's own spatial index,and each table has 2000 row record, Now execute this query,I can get the result soon,
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    But I execute the query by geom only,it will take so long time! query(3 more hours):
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    I don't upderstand...
    thanks
    David

    Because in the first statement
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE'; you are joining the two tables while in the second statement
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';you are doing a cartesian merge first because there is no join between a and b other than te sdo_relate which will be calculated for every row combination you get.
    But I think you'd be better off posting in the {forum:id=76} forum.
    Best regards,
    PP
    Edited by: porzer on Jan 15, 2009 10:34 AM

  • Oracle spatial query with php

    Hello, I have this problem,
    I use php for read data from oracle table,
    all works right, I have any problem whith varchar number type data, but when I must read geometry data like
    (type MDSYS.SDO_GEOMETRY)
    I can't display it on the web page.
    esemple of spatial query that I use:
    select GEOMETRY_1
    from table_a
    where
    ID = 970;
    If I use sql plus I have this result
    SDO_GEOMETRY(3001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, -0, -
    0, 580094, 4998494, -1))
    but blank page when I use php sentence.
    I use PHP Version 4.4.0
    modules load are:
    extension=php_sdo.dll
    extension=php_oci8.dll
    But I don't know which other module I need and also which php function to use for read array of array. at the moment I use @OCIFetchInto.
    Someone can help me?
    My English is very bad please reply easy.
    Thanks for all!
    Angelo

    Thank you very much CJ.
    Now there isn't any problems: you and this link (Re: PHP and spatial data and Adamo Bozzetti helped me
    I have used SDO_UTIL.GETVERTICES
    my complete php script is:
    $conn = @OCILogon("xxxxxx", "xxxxx", "xxxxx") or die
    ( "Non riesco a connettermi al server $host ");
    $query = "select
    TABLE_A.tipo_via,
    TABLE_A.nome_via,
    c.codice_via,
    t.X,
    t.Y
    from TABLE B c, TABLE_A , TABLE(SDO_UTIL.GETVERTICES(c.geometry1)) t
    where c.codice_via = 830
    and c.codice_via = TABLE_A.id_via
    $istruzione = @OCIParse($conn, $query);
    @OCIExecute($istruzione);
    $nrows = @OCIFetchInto($istruzione, $results);
    $trovati = 0;
    while(@OCIFetchInto($istruzione, $results))
    $trovati++;
    ?>     
    <table border width="800" >
    <tr>     
    <td align="center" width="80" bgcolor ="#aaffee"><?echo trim($results[0]);?></td>
    <td align="center" width="150" bgcolor ="#eeffee"><?echo trim($results[1]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[2]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[3]);?></td>
    <td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[4]);?></td>
    </tr>
    </table>
    <?
    } //fine While
    @OCIFreeStatement($istruzione);
    @OCILogOff($conn);

  • Oracle spatial query SDO_LRS with php

    Hello, I have this problem,
    I use php for read data from oracle table.
    I know I can't show on web page the result of SDO_ORDINATE_ARRAY
    Christopher Jones has written that I must use SDO_UTIL.GETVERTICES like as
    select
    t.X,
    t.Y
    from table_a, TABLE(SDO_UTIL.GETVERTICES(table_a.GEOMETRY_1)) t
    where
    id_num = 970;
    But now I must read a projection point ordinate of a point with respect to a geometric segment
    and the same problem come back.
    esemple of spatial query that I use:
    SELECT
    SDO_LRS.PROJECT_PT(geometry,
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(580094.69, 4998493.68, NULL)) )
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970;
    If I use sql plus I have this result
    SDO_LRS.PROJECT_PT(GEOMETRY,SD(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
    580093,325, 4998497,57, 45,2254405))
    Which is exacly the query for extract these coordinates?
    Someone can help me?
    My English is very bad please reply easy.
    Thanks for all!
    Angelo

    Hello thanks for all to everyboby.
    I put the same question on Forum /Category/Database/Spatial and I have received this reply
    from Brian Camire, this query worked well.
    SELECT
    T.X,
    T.Y
    FROM
    TABLE
    SELECT
    SDO_UTIL.GETVERTICES
    SDO_LRS.PROJECT_PT
    GEOMETRY,
    SDO_GEOMETRY
    3301,
    NULL,
    NULL,
    SDO_ELEM_INFO_ARRAY(1, 1, 1),
    SDO_ORDINATE_ARRAY(580093.859, 4998493.5, NULL)
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970
    ) T;
    Best regards
    Angelo.

  • Very basic question Oracle spatial query

    Hi All,
    Iam a newbie to oracle spatial.
    How can i verify that oracle spatial is installed in my database.
    My database is version is 10.2.0.2.0
    Is there any special query i can execute to test oracle spatial is working properly / installed properly.
    All the finctionality oracle spatial is working properly
    Thanks in advance.
    baskar k

    Spatial     VALID     10.2.0.2.0
    I got this message on executing this query
    +++++++++++++++++++++++++++++++
    SELECT comp_name, status, substr(version,1,10) as version
    from dba_server_registry
    where comp_name = 'Spatial';
    ++++++++++++++++++++++++++++++++

  • Oracle SQL Query from EXCEL 2007 with prompt

    Hello,
    I have many excel reports where I am pulling information from our Oracle 9 db through Excel using the following method:
    http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/
    http://blog.mclaughlinsoftware.com/2009/11/30/sql-query-in-excel-2007/
    However, I am having trouble when I try the following query due to the prompt:
    SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '&ITEM';
    Does any one know how I can connect a prompt to an excel cell and then pass the query on to Oracle, or have a PL SQL prompt work from Excel?
    Thanks,
    Ben

    The 'prompt' as you call it is a sqlplus feature, so does not belong to the SQL language
    You would need to write a stored procedure returning a resultset.
    create or replace procedure foo(rc in out sys_refcursor, p_item) as
    begin
    open rc for
    'SELECT
    IM.ITEM_GROUP,
    IM.ITEM,
    IM.DESCRIPTION
    FROM
    LAWSON.ITEMMAST IM
    WHERE
    IM.ITEM = '||p_item;
    end;
    and call that using ODBC or asp.net
    Obviously this is profusely documented.
    Sybrand Bakker
    Senior Oracle DBA

  • Why Oracle Spatial Query So Slow???

    I have 90,000 lines in my database. When I did a query about
    finding all the lines within a certain distance of a point, it
    took me nearly 30 seconds. And when I query the intersection
    between the lines, it took me about 5 minutes!! God, I can't
    believe it!
    Do you guys met the problem before? Please share something with
    me, thank you so much!
    Xiong

    Hi,
    Are you using a spatial index for your within distance query? If
    so, what kind, and have you tuned it at all?
    As far as the intersection question goes, how many geometries are
    you testing? Are they big? Are you only comparing the ones
    returned by within distance?
    If they are big geometries, there are some very large performance
    gains in 9i when dealing with larger geometries.
    Dan

  • How to execute Oracle Spatial Query

    I'd like to return a set of SDO_GEOMETRY columns of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function by MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    Does anyone have experience doing this? Is there a better way to return an SDO_GEOMETRY column of MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    Assume I have a table "my_table" defined as
    STANUMBER VARCHAR2(5)
    STANAME VARCHAR2(18)
    TYPE NUMBER(2)
    LAYER NUMBER
    STAPROVINCE VARCHAR2(6)
    STACOUNTY VARCHAR2(23)
    STALATITUDE NUMBER
    STALONGITUDE NUMBER
    STANUMBER_2 VARCHAR2(5)
    STANAME_2 VARCHAR2(18)
    TYPE_2 NUMBER(2)
    LAYER_2 NUMBER
    STAPROVINCE_2 VARCHAR2(6)
    STACOUNTY_2 VARCHAR2(23)
    GEOLOC MDSYS.SDO_GEOMETRY
    --use the MDSYS.SDO_GEOM.SDO_BUFFER(geom, dim, distance) Spatial Function.
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345;
    --The right result as follwing:
    MDSYS.SDO_GEOM.SDO_BUFFER(GEOLOC,(SELECTDIMINFOFROMUSER_SDO_GEOM_METADATAMWHEREM
    SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1005, 6, 1, 2, 2, 5, 2, 1,
    7, 2, 2, 11, 2, 1, 13, 2, 2, 17, 2, 1), SDO_ORDINATE_ARRAY(83.171677, 57.508809
    4, 72.4970097, 48.2324159, 81.7734032, 37.5577486, 82.6298628, 37.4977234, 94.05
    59481, 34.5268537, 100.350233, 44.5150204, 100.130743, 47.6855154, 97.2287, 54.0
    629335, 90.853757, 56.9704094, 83.171677, 57.5088094))
    --use the MDSYS.SDO_WITHIN_DISTANCE(T.column,aGeom,params) Spatial Operator.
    select s.stanumber from sta_qzt1 s where
    MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,MDSYS.SDO_GEOMETRY(2003, 8192, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191,
    125.923454, 57.457314)),'distance = 0' )= 'TRUE';
    --The right result as follwing:
    STANU
    11110
    However, joint to use the above function to execute a buffer query(cannot work) at PL/SQL:
    select s.stanumber from sta_qzt1 s where
    (select mdsys.sdo_geom.sdo_buffer(geoloc,
    (select diminfo from user_sdo_geom_metadata m where m.table_name='STA_QZT1'
    and m.column_name='GEOLOC'),10)
    FROM STA_QZT1 a WHERE a.STANUMBER=12345),
    'distance = 0' )= 'TRUE';
    PL/SQL give out the error information as following:
    ERROR at line 5:
    ORA-00936: lack of expression
    null

    Jack,
    This should work:
    select MDSYS.SDO_GEOM.SDO_BUFFER(geoloc,
    (select diminfo from user_sdo_geom_metadata m where
    m.table_name='STA_QZT1' and m.column_name='GEOLOC'),10)
    from sta_qzt1 s where MDSYS.SDO_WITHIN_DISTANCE(s.geoloc,
    MDSYS.SDO_GEOMETRY(2003, 8192, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY(125.923454,
    57.457314, 121.5189, 51.845055, 126.989075, 48.506115, 133.38278, 55.04191, 125.923454, 57.457314)),
    'distance = 0' )= 'TRUE';

  • ORACLE COMPICATED QUERY FROM 3 TABLES

    i need to get a report from our oracle database 10g r2 have these info like this one:
        member_no, member_name, member_mobile_no, mb_membership_date, number of
        subscriptions for year 2009, total subscriptions months for the year 2009,
        number of subscriptions for year 2010, total subscriptions months for the year
        2010, number of subscriptions for year 2011, total subscriptions months for the
        year 2011, number of subscriptions for year 2012, total subscriptions months
        for the year 2012, number of subscriptions for year 2013, total subscriptions
        months for the year 2013, last subscription end date, last subscription payment
        type ,last subscription branch no
    guys i have 3 tables as described below:
    1-ft_subscriptions as :
        SU_SUB_NO NUMBER(12,0)
        SU_SUB_DATE DATE
        SU_BRANCH_NO VARCHAR2(10 BYTE)
        SU_MEMBER_NO VARCHAR2(12 BYTE)
        SU_SUB_STATUS CHAR(1 BYTE)
        SU_SUB_TYPE CHAR(1 BYTE)
        SU_SERVICE_NO NUMBER(5,0)
        SU_SERVICE_TYPE VARCHAR2(5 BYTE)
        SU_NO_OF_UNIT NUMBER(5,0)
        SU_START_DATE DATE
        SU_END_DATE DATE
        SU_PRICE_AMT NUMBER(13,2)
        SU_DISC_AMT NUMBER(13,2)
        SU_EXTRA_DISC NUMBER(13,2)
        SU_NET_AMT NUMBER(13,2)
        SU_GROUP_NO NUMBER(12,0)
        SU_PROM_OFFER_NO NUMBER(12,0)
        SU_UPGRADING_SUB_NO NUMBER(12,0)
        SU_SECOND_SUB_NO VARCHAR2(12 BYTE)
        SU_NOTES VARCHAR2(2000 BYTE)
        SU_COMMENTS1 VARCHAR2(2000 BYTE)
        SU_COMMENTS2 VARCHAR2(2000 BYTE)
        SU_CRE_DATE DATE
        SU_CRE_BY VARCHAR2(30 BYTE)
        SU_AVAIL_CPN NUMBER(4,0)
        SU_EXTRA_DISC_PCT NUMBER(6,3)
        SU_CREDIT_AMT NUMBER(13,2)
        SU_CUSTOMER_NO VARCHAR2(10 BYTE)
        SU_AUDITING_BY VARCHAR2(30 BYTE)
        SU_AUDITING_DATE DATE
        SU_AUDITING_NOTES VARCHAR2(2000 BYTE)
        SU_POSTED CHAR(1 BYTE)
        SU_ACTIVIATION_DATE DATE
        SU_NO_OF_MONTHS NUMBER(7,2)
        SU_ENTRYTIME_CODE NUMBER(5,0)
        SU_CATEGORY VARCHAR2(5 BYTE)
        SU_ACT_START_DATE DATE
        SU_ACT_END_DATE DATE
        SU_SECOND_BRANCH_NO VARCHAR2(3 BYTE)
        SU_ADMIN_DISC_EMP VARCHAR2(10 BYTE)
        SU_DISC_TYPE VARCHAR2(1 BYTE)
        SU_BRANCH_PRICE_FLAG VARCHAR2(1 BYTE)
        SU_MISSING_DATA_FLAG VARCHAR2(1 BYTE)
        SU_CREDIT_PCT NUMBER(6,3)
        SU_BONUS_DAYS NUMBER(5,0)
        SU_UNPS_TRANS_BRANCH VARCHAR2(3 BYTE)
        SU_UNPS_TRANS_SERIAL NUMBER(12,0)
        SU_UNPS_TRANS_DATE DATE
        SU_ALLOWED_TRANS VARCHAR2(1 BYTE)
        SU_PREVIOUS_BAL NUMBER(10,0)
        SU_CASHIER_BRANCH VARCHAR2(10 BYTE)
        SU_CASHIER_SERIAL NUMBER(12,0)
        SU_PAY_TYPE CHAR(1 BYTE)
        SU_OFFER_FREE_DAYS NUMBER(4,0)
        SU_DOCNO VARCHAR2(20 BYTE)
        SU_MSPNO VARCHAR2(20 BYTE)
        SU_DOCTYPE VARCHAR2(10 BYTE)
        SU_LOCNO VARCHAR2(10 BYTE)
        SU_DOC_PFX VARCHAR2(5 BYTE)
        SU_DOC_NO NUMBER(10,0)
        SU_MOD_BY VARCHAR2(30 BYTE)
        SU_MOD_DATE DATE
        SU_MEMBER_FRIEND VARCHAR2(12 BYTE)
        SU_OFFER_FREE_SERVICE NUMBER(5,0)
        SU_FRIEND_START_DATE DATE
    2-ft_members as :
        MB_BUS_UNIT VARCHAR2(5 BYTE)
        MB_MEMBER_NO VARCHAR2(12 BYTE)
        MB_MEMBER_NAME VARCHAR2(60 BYTE)
        MB_MEMBER_STATUS CHAR(1 BYTE)
        MB_MEMBERSHIP_DATE DATE
        MB_MEMBER_BRANCH VARCHAR2(10 BYTE)
        MB_MEMBER_TYPE CHAR(1 BYTE)
        MB_MEMBER_NAT VARCHAR2(5 BYTE)
        MB_ID_TYPE NUMBER(3,0)
        MB_ID_NO VARCHAR2(15 BYTE)
        MB_ID_DATE DATE
        MB_BIRTH_DATE DATE
        MB_PHONE_NO VARCHAR2(15 BYTE)
        MB_MOBILE_NO VARCHAR2(15 BYTE)
        MB_POBOX NUMBER(10,0)
        MB_POSTAL_CODE VARCHAR2(25 BYTE)
        MB_ADDRESS VARCHAR2(2000 BYTE)
        MB_EMAIL VARCHAR2(100 BYTE)
        MB_CUSTOMER_NO VARCHAR2(10 BYTE)
        MB_EMP_NO VARCHAR2(15 BYTE)
        MB_MARKETTING_WAY CHAR(2 BYTE)
        MB_IMG VARCHAR2(350 BYTE)
        MB_NOTES VARCHAR2(2000 BYTE)
        MB_ACTIVE_NOTE VARCHAR2(2000 BYTE)
        MB_INACTIVE_NOTE VARCHAR2(2000 BYTE)
        MB_CRE_BY VARCHAR2(30 BYTE)
        MB_CRE_DATE DATE
        MB_VIA_MEMBER VARCHAR2(12 BYTE)
        MB_VIA_BRANCH VARCHAR2(10 BYTE)
        MB_VIA_SUB NUMBER(12,0)
        MB_ID_EXPIRY_DATE DATE
        MB_ID_DATE_HJ DATE
        MB_BIRTH_DATE_HJ DATE
        MB_ID_EXPIRY_DATE_HJ DATE
        MB_LANG VARCHAR2(1 BYTE)
        MB_JOB_TYPE NUMBER(10,0)
        MB_JOB_CLASS NUMBER(10,0)
        MB_JOB_PLACE NUMBER(10,0)
        MB_EMP_ID_EXPIRY_DATE DATE
        MB_EMP_ID_EXPIRY_DATE_HJ DATE
        MB_MEDIA_TYPE VARCHAR2(5 BYTE)
        MB_RELATIVE_MEMBER VARCHAR2(12 BYTE)
        MB_RELATIVE_EMP VARCHAR2(10 BYTE)
        MB_ID_COPY NUMBER(2,0)
        MB_ACQUIST_DISC_PCT NUMBER(6,3)
        MB_ACQUIST_DISC_TYPE VARCHAR2(1 BYTE)
        MB_ADDED_BONUS_FLAG VARCHAR2(1 BYTE)
        MB_REVIEW_SUB_NO NUMBER(12,0)
        MB_REVIEW_BRH_NO VARCHAR2(10 BYTE)
        MB_RECEIVED_SMS VARCHAR2(1 BYTE)
        MB_CARD_NO VARCHAR2(8 BYTE)
        MB_MOD_BY VARCHAR2(30 BYTE)
        MB_MOD_DATE DATE
        MB_MEMBER_NO7 VARCHAR2(12 BYTE)
        3-ft_services as :
        SRV_BUS_UNIT VARCHAR2(5 BYTE)
        SRV_SERVICE_NO NUMBER(5,0)
        SRV_SERVICE_DESC1 VARCHAR2(50 BYTE)
        SRV_SERVICE_DESC2  VARCHAR2(50 BYTE)
        SRV_SERVICE_TYPE VARCHAR2(5 BYTE)
        SRV_SERVICE_STATUS CHAR(1 BYTE)
        SRV_SERVICE_PRICE NUMBER(12,5)
        SRV_NO_OF_UNIT NUMBER(5,0)
        SRV_START_TIME NUMBER(7,0)
        SRV_END_TIME NUMBER(7,0)
        SRV_DURATION NUMBER(7,0)
        SRV_POINTS NUMBER(7,0)
        SRV_NOTES VARCHAR2(2000 BYTE)
        SRV_CRE_BY VARCHAR2(30 BYTE)
        SRV_CRE_DATE DATE
        SRV_MIN_PEND_DAYS NUMBER(3,0)
        SRV_MAX_PEND_DAYS NUMBER(3,0)
        SRV_MIN_EXT_DAYS NUMBER(3,0)
        SRV_MAX_EXT_DAYS NUMBER(3,0)
        SRV_BONUS_DAYS NUMBER(3,0)
        SRV_MAX_PEND_COUNT NUMBER(3,0)
        SRV_MAX_EXT_COUNT NUMBER(3,0)
        SRV_CATEGORY VARCHAR2(5 BYTE)
        SRV_EXTEND_DAYS NUMBER(3,0)
        SRV_NO_OF_MONTHS NUMBER(7,2)
        SRV_ENTRYTIME_CODE NUMBER(5,0)
        SRV_ALLOW_PERIOD NUMBER(5,0)
        SRV_RELATIVE_EMP_PCT NUMBER(6,3)
        SRV_RELATIVE_MBR_PCT NUMBER(6,3)
        SRV_DAYS_BEFORE_END NUMBER(3,0)
        SRV_DAYS_AFTER_END NUMBER(3,0)
        SRV_ALLOWED_WAIVE VARCHAR2(1 BYTE)
        SRV_ALLOWED_SUB_TRANS VARCHAR2(1 BYTE)
        SRV_UPGRADE_LIMIT NUMBER(4,0)
        SRV_MIN_AEG_ALLOWED NUMBER(5,2)
        SRV_MAX_AEG_ALLOWED NUMBER(5,2)
        SRV_WAIVE_LIMIT NUMBER(4,0)
        SRV_ALLOW_ACQUIRED_DISC VARCHAR2(1 BYTE)
    i need to get a report  have these info like this one:
        member_no, member_name, member_mobile_no, mb_membership_date, number of
        subscriptions for year 2009, total subscriptions months for the year 2009,
        number of subscriptions for year 2010, total subscriptions months for the year
        2010, number of subscriptions for year 2011, total subscriptions months for the
        year 2011, number of subscriptions for year 2012, total subscriptions months
        for the year 2012, number of subscriptions for year 2013, total subscriptions
        months for the year 2013, last subscription end date, last subscription payment
        type ,last subscription branch no
    guys this is very urgent for my company needs,thnx in advance

    i need to get a report from our oracle database 10g r2 have these info like this one:
        member_no, member_name, member_mobile_no, mb_membership_date, number of
        subscriptions for year 2009, total subscriptions months for the year 2009,
        number of subscriptions for year 2010, total subscriptions months for the year
        2010, number of subscriptions for year 2011, total subscriptions months for the
        year 2011, number of subscriptions for year 2012, total subscriptions months
        for the year 2012, number of subscriptions for year 2013, total subscriptions
        months for the year 2013, last subscription end date, last subscription payment
        type ,last subscription branch no
    guys i have 3 tables as described below:
    1-ft_subscriptions as :
        SU_SUB_NO NUMBER(12,0)
        SU_SUB_DATE DATE
        SU_BRANCH_NO VARCHAR2(10 BYTE)
        SU_MEMBER_NO VARCHAR2(12 BYTE)
        SU_SUB_STATUS CHAR(1 BYTE)
        SU_SUB_TYPE CHAR(1 BYTE)
        SU_SERVICE_NO NUMBER(5,0)
        SU_SERVICE_TYPE VARCHAR2(5 BYTE)
        SU_NO_OF_UNIT NUMBER(5,0)
        SU_START_DATE DATE
        SU_END_DATE DATE
        SU_PRICE_AMT NUMBER(13,2)
        SU_DISC_AMT NUMBER(13,2)
        SU_EXTRA_DISC NUMBER(13,2)
        SU_NET_AMT NUMBER(13,2)
        SU_GROUP_NO NUMBER(12,0)
        SU_PROM_OFFER_NO NUMBER(12,0)
        SU_UPGRADING_SUB_NO NUMBER(12,0)
        SU_SECOND_SUB_NO VARCHAR2(12 BYTE)
        SU_NOTES VARCHAR2(2000 BYTE)
        SU_COMMENTS1 VARCHAR2(2000 BYTE)
        SU_COMMENTS2 VARCHAR2(2000 BYTE)
        SU_CRE_DATE DATE
        SU_CRE_BY VARCHAR2(30 BYTE)
        SU_AVAIL_CPN NUMBER(4,0)
        SU_EXTRA_DISC_PCT NUMBER(6,3)
        SU_CREDIT_AMT NUMBER(13,2)
        SU_CUSTOMER_NO VARCHAR2(10 BYTE)
        SU_AUDITING_BY VARCHAR2(30 BYTE)
        SU_AUDITING_DATE DATE
        SU_AUDITING_NOTES VARCHAR2(2000 BYTE)
        SU_POSTED CHAR(1 BYTE)
        SU_ACTIVIATION_DATE DATE
        SU_NO_OF_MONTHS NUMBER(7,2)
        SU_ENTRYTIME_CODE NUMBER(5,0)
        SU_CATEGORY VARCHAR2(5 BYTE)
        SU_ACT_START_DATE DATE
        SU_ACT_END_DATE DATE
        SU_SECOND_BRANCH_NO VARCHAR2(3 BYTE)
        SU_ADMIN_DISC_EMP VARCHAR2(10 BYTE)
        SU_DISC_TYPE VARCHAR2(1 BYTE)
        SU_BRANCH_PRICE_FLAG VARCHAR2(1 BYTE)
        SU_MISSING_DATA_FLAG VARCHAR2(1 BYTE)
        SU_CREDIT_PCT NUMBER(6,3)
        SU_BONUS_DAYS NUMBER(5,0)
        SU_UNPS_TRANS_BRANCH VARCHAR2(3 BYTE)
        SU_UNPS_TRANS_SERIAL NUMBER(12,0)
        SU_UNPS_TRANS_DATE DATE
        SU_ALLOWED_TRANS VARCHAR2(1 BYTE)
        SU_PREVIOUS_BAL NUMBER(10,0)
        SU_CASHIER_BRANCH VARCHAR2(10 BYTE)
        SU_CASHIER_SERIAL NUMBER(12,0)
        SU_PAY_TYPE CHAR(1 BYTE)
        SU_OFFER_FREE_DAYS NUMBER(4,0)
        SU_DOCNO VARCHAR2(20 BYTE)
        SU_MSPNO VARCHAR2(20 BYTE)
        SU_DOCTYPE VARCHAR2(10 BYTE)
        SU_LOCNO VARCHAR2(10 BYTE)
        SU_DOC_PFX VARCHAR2(5 BYTE)
        SU_DOC_NO NUMBER(10,0)
        SU_MOD_BY VARCHAR2(30 BYTE)
        SU_MOD_DATE DATE
        SU_MEMBER_FRIEND VARCHAR2(12 BYTE)
        SU_OFFER_FREE_SERVICE NUMBER(5,0)
        SU_FRIEND_START_DATE DATE
    2-ft_members as :
        MB_BUS_UNIT VARCHAR2(5 BYTE)
        MB_MEMBER_NO VARCHAR2(12 BYTE)
        MB_MEMBER_NAME VARCHAR2(60 BYTE)
        MB_MEMBER_STATUS CHAR(1 BYTE)
        MB_MEMBERSHIP_DATE DATE
        MB_MEMBER_BRANCH VARCHAR2(10 BYTE)
        MB_MEMBER_TYPE CHAR(1 BYTE)
        MB_MEMBER_NAT VARCHAR2(5 BYTE)
        MB_ID_TYPE NUMBER(3,0)
        MB_ID_NO VARCHAR2(15 BYTE)
        MB_ID_DATE DATE
        MB_BIRTH_DATE DATE
        MB_PHONE_NO VARCHAR2(15 BYTE)
        MB_MOBILE_NO VARCHAR2(15 BYTE)
        MB_POBOX NUMBER(10,0)
        MB_POSTAL_CODE VARCHAR2(25 BYTE)
        MB_ADDRESS VARCHAR2(2000 BYTE)
        MB_EMAIL VARCHAR2(100 BYTE)
        MB_CUSTOMER_NO VARCHAR2(10 BYTE)
        MB_EMP_NO VARCHAR2(15 BYTE)
        MB_MARKETTING_WAY CHAR(2 BYTE)
        MB_IMG VARCHAR2(350 BYTE)
        MB_NOTES VARCHAR2(2000 BYTE)
        MB_ACTIVE_NOTE VARCHAR2(2000 BYTE)
        MB_INACTIVE_NOTE VARCHAR2(2000 BYTE)
        MB_CRE_BY VARCHAR2(30 BYTE)
        MB_CRE_DATE DATE
        MB_VIA_MEMBER VARCHAR2(12 BYTE)
        MB_VIA_BRANCH VARCHAR2(10 BYTE)
        MB_VIA_SUB NUMBER(12,0)
        MB_ID_EXPIRY_DATE DATE
        MB_ID_DATE_HJ DATE
        MB_BIRTH_DATE_HJ DATE
        MB_ID_EXPIRY_DATE_HJ DATE
        MB_LANG VARCHAR2(1 BYTE)
        MB_JOB_TYPE NUMBER(10,0)
        MB_JOB_CLASS NUMBER(10,0)
        MB_JOB_PLACE NUMBER(10,0)
        MB_EMP_ID_EXPIRY_DATE DATE
        MB_EMP_ID_EXPIRY_DATE_HJ DATE
        MB_MEDIA_TYPE VARCHAR2(5 BYTE)
        MB_RELATIVE_MEMBER VARCHAR2(12 BYTE)
        MB_RELATIVE_EMP VARCHAR2(10 BYTE)
        MB_ID_COPY NUMBER(2,0)
        MB_ACQUIST_DISC_PCT NUMBER(6,3)
        MB_ACQUIST_DISC_TYPE VARCHAR2(1 BYTE)
        MB_ADDED_BONUS_FLAG VARCHAR2(1 BYTE)
        MB_REVIEW_SUB_NO NUMBER(12,0)
        MB_REVIEW_BRH_NO VARCHAR2(10 BYTE)
        MB_RECEIVED_SMS VARCHAR2(1 BYTE)
        MB_CARD_NO VARCHAR2(8 BYTE)
        MB_MOD_BY VARCHAR2(30 BYTE)
        MB_MOD_DATE DATE
        MB_MEMBER_NO7 VARCHAR2(12 BYTE)
        3-ft_services as :
        SRV_BUS_UNIT VARCHAR2(5 BYTE)
        SRV_SERVICE_NO NUMBER(5,0)
        SRV_SERVICE_DESC1 VARCHAR2(50 BYTE)
        SRV_SERVICE_DESC2  VARCHAR2(50 BYTE)
        SRV_SERVICE_TYPE VARCHAR2(5 BYTE)
        SRV_SERVICE_STATUS CHAR(1 BYTE)
        SRV_SERVICE_PRICE NUMBER(12,5)
        SRV_NO_OF_UNIT NUMBER(5,0)
        SRV_START_TIME NUMBER(7,0)
        SRV_END_TIME NUMBER(7,0)
        SRV_DURATION NUMBER(7,0)
        SRV_POINTS NUMBER(7,0)
        SRV_NOTES VARCHAR2(2000 BYTE)
        SRV_CRE_BY VARCHAR2(30 BYTE)
        SRV_CRE_DATE DATE
        SRV_MIN_PEND_DAYS NUMBER(3,0)
        SRV_MAX_PEND_DAYS NUMBER(3,0)
        SRV_MIN_EXT_DAYS NUMBER(3,0)
        SRV_MAX_EXT_DAYS NUMBER(3,0)
        SRV_BONUS_DAYS NUMBER(3,0)
        SRV_MAX_PEND_COUNT NUMBER(3,0)
        SRV_MAX_EXT_COUNT NUMBER(3,0)
        SRV_CATEGORY VARCHAR2(5 BYTE)
        SRV_EXTEND_DAYS NUMBER(3,0)
        SRV_NO_OF_MONTHS NUMBER(7,2)
        SRV_ENTRYTIME_CODE NUMBER(5,0)
        SRV_ALLOW_PERIOD NUMBER(5,0)
        SRV_RELATIVE_EMP_PCT NUMBER(6,3)
        SRV_RELATIVE_MBR_PCT NUMBER(6,3)
        SRV_DAYS_BEFORE_END NUMBER(3,0)
        SRV_DAYS_AFTER_END NUMBER(3,0)
        SRV_ALLOWED_WAIVE VARCHAR2(1 BYTE)
        SRV_ALLOWED_SUB_TRANS VARCHAR2(1 BYTE)
        SRV_UPGRADE_LIMIT NUMBER(4,0)
        SRV_MIN_AEG_ALLOWED NUMBER(5,2)
        SRV_MAX_AEG_ALLOWED NUMBER(5,2)
        SRV_WAIVE_LIMIT NUMBER(4,0)
        SRV_ALLOW_ACQUIRED_DISC VARCHAR2(1 BYTE)
    i need to get a report  have these info like this one:
        member_no, member_name, member_mobile_no, mb_membership_date, number of
        subscriptions for year 2009, total subscriptions months for the year 2009,
        number of subscriptions for year 2010, total subscriptions months for the year
        2010, number of subscriptions for year 2011, total subscriptions months for the
        year 2011, number of subscriptions for year 2012, total subscriptions months
        for the year 2012, number of subscriptions for year 2013, total subscriptions
        months for the year 2013, last subscription end date, last subscription payment
        type ,last subscription branch no
    guys this is very urgent for my company needs,thnx in advance

  • Oracle Spatial Query

    I have created two tables the first called pai_equal created from the query below
    create table pai_equal as
    (select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=EQUAL querytype=WINDOW')='TRUE');
    This returns 4 rows which is correct
    This query selects the terrier polygons that are made up of one topo_area polygon only (and no more and align exactly)
    The second table is called inside_coveredby created as follows
    create table inside_coveredby as
    select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=INSIDE+COVEREDBY querytype=WINDOW')='TRUE'
    order by l.mi_prinx;
    Returns 1142 undistinct rows, 475(distinct)
    This query selects terrier polygons that are
    (a) made up or two or more topo area polygons and where the boundaries align exactly
    (b) made up of one or more topo area polygons and where the boundaries do not align exactly
    What I want to do next is select all the terriers that are not included in either of the above 2 queries. Totals should now add up to 754 (4 +475+ ?)as the original terrier table contains 754 features
    I think I need to select from sub_lt where mi_prinx is not in inside+coveredby or the equal table?
    Has anyone any ideas on how to write this?
    Your help as usual is much appreciated

    You can use SQL difference operator to do this:
    select toid from sub_lt
    MINUS
    select /*+ ORDERED */ l.*, t.toid
    from sub_lt l, sub_topoarea t
    where mdsys.sdo_relate(t.geoloc, l.geoloc,
    'mask=INSIDE+COVEREDBY querytype=WINDOW')='TRUE'
    order by l.mi_prinx;
    This should give you everything other than inside+coveredby.
    If you want to include the equal also,
    change the mask to inside+coveredby+equal.

  • Data Retrieval Speed in Oracle Spatial vs. ESRI ArcSDE

    I would appreciate any opinions regarding data retrieval
    performance between Oracle Spatial and ESRI ArcSDE. Would an end-
    user (using ESRI software) experience significant differences in
    data retrieval speed depending on how the data were stored in
    Oracle (MDSYS.SDO_GEOMETRY verses ESRI Binary/Blob formats).
    Knowing that the ESRI binary formats are tailored to their
    software front-end apps (ArcGIS, ArcMap, ArcCatalog, and
    ArcInfo), wouldn't this be a "non-issue" until the spatial
    dataset gets "large", and even then, wouldn't performance be
    (almost) equal if the spatial indexes were created properly?
    Thanks for your inputs,
    Bruce

    John,
    You can't do that type of query in sql from sql*plus using
    SDEBINARY. HOwever, you can perform spatial queries in ArcMap
    if you are using SDEBINARY.
    You can use the query builder to perform point-in-polygon type
    queries.
    Hope that helps.
    For my two cents, I think SDO_GEOMETRY gives you a more robust
    database to work with, because you have the added power of
    Oracle Spatial functions. If you are using SDEBINARY you are
    limited to only what you can do thru ArcGIS.
    If you are concerned more about performance than accessibility,
    especially with a large number of users, then SDEBINARY might
    be the better choice.
    I love Oracle Spatial and am hoping that the performance issue
    will not be a serious one when we start putting ArcIMS developed
    apps into production.
    Dave

  • SDO_NN with Oracle Spatial

    Hello,
    although the description of my problem is a bit long, I hope you could help me.
    I would like to compute the nearest neighbor of a point being located on the surface of the unit sphere.
    For that query, I would like to take advantage of the features provided by Oracle Spatial (10g).
    Table spatial_test contains the columns point_name, x, y, z, ra, dec where:
    point_name is the primary key
    x, y, z are the coordinates of the points on the unit sphere (so x^2+y^2+z^2=1)
    ra, dec are the the concerning spherical coordinates where the following conditions hold: x=cos(dec)*cos(ra) , y=cos(dec)*sin(ra), z=sin(dec).
    For computing the nearest neighbor of a point with point_name='point1' the query without using Oracle Spatial is:
    select * from(
    select
    acos(t1.x*t2.x+t1.y*t2.y+t1.z*t2.z) as distance, t1.*
    from spatial_test t1,
    spatial_test t2
    where t2.point_name='point1'
    and t1.name != t2.name
    order by dist
    where rownum<2;
    For taking advantage of Oracle Spatial, I have to prepare my data doing the following five steps:
    1. add a column to of type SDO_GEOMETRY to table spatial_test
    2. insert values to that table
    3. update table user_sdo_geom_metadata
    4. create the spatial index
    5. execute the following query on the amended table spatial_test:
    SELECT t1.point_name name1, t2.point_name name2 FROM spatial_test t1, spatial_test t2
    WHERE SDO_NN(t2.geom, t1.geom, 'sdo_num_res=2') = 'TRUE'
    and t1.point_name = 'point1'
    and t1.point_NAME != t2.point_name
    As mentioned in the User Guide for Oracle Spatial, only two dimensional objects are supported.
    So, if I insert tuples in the following form to my table:
    insert into spatial_test (point_name, x, y, z, geom) values (..., ..., ..., ...,
    SDO_GEOMETRY(3001,
    NULL, --SDO_SRID is null, so no coordinate system is associated with the geometry
    SDO_POINT_TYPE(x_value, y_value, z_value),
    NULL,
    NULL));
    I won't get the correct results. I assume that the z_value is just ignored. Am I right with that assumption?
    For using Oracle Spatial, I have to use the equivalent just using two dimensions. Since ra, dec is another representation for x, y, z, I tried to do the same, just using ra and dec. But here, my results also differ from the ones computed with my own computation of the nearest neighbor.
    Here an minimal example which shows my problem:
    CREATE TABLE spatial_test(
    point_name varchar(20) PRIMARY KEY,
    x float,
    y float,
    z float,
    ra float,
    dec float,
    geom SDO_GEOMETRY);
    -- INSERT POINTS --
    insert into spatial_test(point_name, x, y, z, ra, dec, geom) values ('point1', -0.00472924, 0.110927216, 0.99381728, 92.44125, 83.62542,
    SDO_GEOMETRY(2001, -- 2 dimensions, last dimension is the measure, geometry type 01 = point
    NULL, --SDO_SRID is null, so no coordinate system is associated with the geometry
    SDO_POINT_TYPE(92.44125, 83.62542, null),
    NULL,
    NULL));
    insert into spatial_test(point_name, x, y, z, ra, dec, geom) values ('point2', -0.00239923, 0.112814014, 0.993613226, 91.21833, 83.52097,
    SDO_GEOMETRY(2001, -- 2 dimensions, last dimension is the measure, geometry type 01 = point
    NULL, --SDO_SRID is null, so no coordinate system is associated with the geometry
    SDO_POINT_TYPE(91.21833, 83.52097, null),
    NULL,
    NULL));
    insert into spatial_test(point_name, x, y, z, ra, dec, geom) values ('point3', -0.00701052, 0.122780703, 0.992409065, 93.26792, 82.93584,
    SDO_GEOMETRY(2001, -- 2 dimensions, last dimension is the measure, geometry type 01 = point
    NULL, --SDO_SRID is null, so no coordinate system is associated with the geometry
    SDO_POINT_TYPE(93.26792, 82.93584, null),
    NULL,
    NULL));
    -- UPDATA user_sdo_geom_metadata --
    INSERT INTO user_sdo_geom_metadata
    (TABLE_NAME,
    COLUMN_NAME,
    DIMINFO,
    SRID)
    VALUES (
    'spatial_test',
    'geom',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('ra', 0.0, 360.0, 0.0000000000001),
    MDSYS.SDO_DIM_ELEMENT('dec', -90.0, 90.0, 0.0000000000001)
    NULL -- no specific coordinate system should be associated with the geometries.
    -- CREATE THE SPATIAL INDEX --
    CREATE INDEX spatial_test_idx
    ON spatial_test(geom)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    Now I could execute the following queries which should both compute the nearest neighbor of 'point1'.
    This is the statement computing the nearest neighbor without Oracle Spatial:
    select * from(
    select
    acos(t1.x*t2.x+t1.y*t2.y+t1.z*t2.z) as distance, t2.point_name p1, t1.point_name p2
    from spatial_test t1,
    spatial_test t2
    where t2.point_name='point1'
    and t1.point_name != t2.point_name
    order by distance
    where rownum<2;
    RESULT:
    DISTANCE P1 P2
    ,003005107 point1 point2
    With the following statement, I compute the nearest neighbor of 'point1' using Oracle Spatial:
    SELECT t1.point_name name1, t2.point_name name2 FROM spatial_test t1, spatial_test t2
    WHERE SDO_NN(t2.geom, t1.geom, 'sdo_num_res=2') = 'TRUE'
    and t1.point_name = 'point1'
    and t1.point_NAME != t2.point_name;
    RESULT:
    NAME1 NAME2
    point1 point3
    As you see, unfortunately, the two results differ.
    Could you please tell me, what I understood wrong in using Oracle Spatial?
    In addition, what kind of coordinate system is assumed if it isn't specified in my SDO_GEOMETRY? Which kind of distance is computed using sdo_nn (euclidean distance, ...)?
    Would be glad, if you could tell how to reach the same results for my nearest neighbors using Oracle Spatial.
    Regards,
    Ina

    I would like to compute the nearest neighbor of a
    point being located on the surface of the unit
    sphere.That would be a spherical 3D computation. Currently, OS does not work well with 3D such as spheres, sorry. I know R2 was supposed to improve on this for cubes and pyramids, but to be honest; I haven’t had time to go back and test the simple cube operations. With 10gR1, for most of the operators and functions 2,2,3 and 2,2,5 are same point. I know this is something that is being worked on, possibly Dan can comment further.
    See for more info:
    Re: 3D Polygon
    For now, if you have your own routines, I’d use them as a package instead. If you need help there, let us know and we’ll try to point you in the right direction or help you to translate the code to PL/SQL.
    Bryan

  • Database monitoring from sqlplus prompt?

    How can one monitor database from sqlplus prompt? I want to know about the connected users,queries fire by users,deadlock and explain plan of the query from sqlplus.
    Is there any direct query for the same.
    Thanks
    Vipin

    connected users,queries fire by users,deadlockYou can use v$ views example v$session, v$lock
    explain plan of the query from sqlplusYou can use
    SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    Additionaly I would advise you visit and search more about it
    http://www.oracle.com/technology/documentation/index.html
    Adith

  • Oracle Spatial Training Documentation

    I have to give some Oracle Spatial formation and i need some material to build this course.
    Where could i find this kind of document?
    ....thanks for your help

    Thanks for the advice but i already did that kind of research. I found some documentation but nothing from Oracle.
    Im working for a company that is a "Certified Advantage Partner" (OPN PIN: 147582435711). Can i have acces to some Training Documentation on Oracle Spatial or to some Oracle spatial training from Oracle University?
    Im sure that Oracle has some PPT files on Oracle Spatial.
    .....thanks for your help

  • JDBC overview to support ORACLE spatial databases

    Hello, where can I get some examples to access ORACLE SPATIAL objects from JAVA using JDBC?Does anybody now the link where can I read this.Thakx.
    Tomas Kloucek

    I have the same problem, i have been trawling through the internet trying to find
    out how to solve this problem but to know avail.

Maybe you are looking for

  • Url not showing

    Hi all: I added a url link to a page. It shows up in Edit Mode and I have verified the link works. However when I go to view page the url does not show up. It is not set to hidden. Please help.

  • Unable to find known Solaris bug (1084772)?

    Hi all, I'm currently facing an issue with my connectivity between SunOS 5.8 with Oracle. However I've stumbled upon sites (referenced below) that quoted this "known" Solaris Bug which ties in strongly with the problem I am having. <Solaris only> Pro

  • MacBook Pro won't start after changing access rights

    I did something very wrong. Unfortunately I changed the access rights of Macintosh HD for "everyone" to none. Result, my MacBook Pro won't start anymore. Already tried the installation disk, reset password for root and users. No result. Help program

  • 10.6.5 Update causes minor graphic corruption?

    On my Macbook, I notice the following when I open a program: as the icon bounces in the dock, the edges of the icon become jagged or pixelated and appear to "crawl" a little. This is especially noticeable when opening word or excel since the icons ha

  • EWM Implementation project in SCM5.0

    Hello All, Is any one working on Extended Warehouse Management (EWM) implementation project in SCM5.0. If yes what is the Scope of the functionality of EWM? Regards, Anjali