SDO_RELATE to return rows where point is in polygon

Is it possible to return rows from a table where an input point geometry falls within the polygon sdo_geometry column stored in the row? I don't just want to return the geometry, but all columns in the row where the geometry "intersects".
I'm trying this, but run into an error:
SELECT * FROM COUNTY_PARCEL R where SDO_RELATE(R.SHAPE, MDSYS.SDO_GEOMETRY(2001,2868,MDSYS.SDO_POINT_TYPE(656849.49,883088.84,NULL),NULL,NULL), 'mask=anyinteract') = 'TRUE'
ORA-29902: error in executing ODCIIndexStart() routine
ORA-13282: failure on initialization of coordinate transformation
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 286
Any help is much appreciated.
Edited by: user12167574 on Feb 25, 2010 3:10 PM

Guddie
YOUR SQL as such should do what you have described, however, the error message "ORA-13282: failure on initialization of coordinate transformation" is indicating an issue with coord transformation.
from the user manual:
"If geometry1 and geometry2 are based on different coordinate systems, geometry2 is temporarily transformed to the coordinate system of geometry1 for the operation to be performed, as described in Section 6.10.1."
could it be that the COUNTY_PARCEL table geometries have a different SRID then 2868 (from your input point geometry)?
might it even be so, that the COUNTY_PARCEL have no srid set?
Can you check that and let us know?
tx
Luc

Similar Messages

  • Return rows where date between sysdate +- 2 years

    Hi,
    Please let me know how to select rows from table where date = sysdate +- 2 years
    if sysdate is 27/07/2012 then select rows where date between 27/07/2010 to 27/07/2014

    you need all date ? or only specific date ?
    Specific date Purvesh already provided solution
    All
    SELECT * FROM ( SELECT SYSDATE+LEVEL AFTER,SYSDATE-LEVEL befor FROM dual connect BY LEVEL<=365*2 )Or specific
    SELECT Max(AFTER),Min(befor) FROM
    ( SELECT SYSDATE+LEVEL AFTER,SYSDATE-LEVEL befor FROM dual connect BY LEVEL<=365*2 )

  • How to return rows where count = 0

    Hi, I have the below query that returns the quarters along with the number of issues:
    select MQTR as Quarter, count(MQTR)
    from tbl1, tbl2
    where Fdate=Cdate
    and cycle_missed = 'Yes'
    group by MQTR
    order by 1
    output:
    2006-Q2      1
    2006-Q3      1
    2007-Q2      2
    I know that 2007-Q1 has 0 issues but I can't get the query to return the row with count 0. So my question is how I can get this output:
    2006-Q2      1
    2006-Q3      1
    2007-Q1      0
    2007-Q2      2

    SQL> create table tbl1
      2  as
      3  select date '2006-04-10' cdate, '2006-Q3' mqtr from dual union all
      4  select date '2006-08-11', '2006-Q4' from dual union all
      5  select date '2006-10-12', '2007-Q1' from dual union all
      6  select date '2007-02-13', '2007-Q2' from dual
      7  /
    Tabel is aangemaakt.
    SQL> create table tbl2
      2  as
      3  select date '2006-04-10' run_date, 'Yes' interventions from dual union all
      4  select date '2006-04-15', 'Yes' from dual union all
      5  select date '2006-08-19', 'No' from dual union all
      6  select date '2006-10-20', 'Yes' from dual union all
      7  select date '2006-12-20', 'No' from dual union all
      8  select date '2007-02-20', 'No' from dual
      9  /
    Tabel is aangemaakt.
    SQL> select tbl1.mqtr
      2       , count(tbl2.run_date) "Count"
      3    from tbl1
      4       , tbl2
      5   where tbl1.mqtr = to_char(add_months(tbl2.run_date (+),3),'yyyy-"Q"q')
      6     and tbl2.interventions (+) = 'Yes'
      7   group by mqtr
      8   order by mqtr
      9  /
    MQTR         Count
    2006-Q3          2
    2006-Q4          0
    2007-Q1          1
    2007-Q2          0
    4 rijen zijn geselecteerd.Regards,
    Rob.

  • No rows returned with where number_value

    Hi all,
    Im using Oracle 10.2.0.1 on Windows 2000.
    I got something strange here.
    I have a table like:
    TABLE_NAME                     COLUMN_NAME                    DATA_TYPE        DATA_LENGTH DATA_PRECISION DATA_SCALE
    TEST                           COL1                           NUMBER                    22           1     0when I try to perform a query like:
    select * from test where col = 0this returns 0 rows.
    when I do:
    select * from test;
          COL1
             1
             1
             1
             1
             0
             0
             2but when a use to_number, it returns rows for zero value:
    select * from test where to_number(col) = 0;
          COL1
             0
             0somebody knows about this strange problem?
    thank you very much!!!!
    []´s

    Hi,
    >>I´m trying to understand this.
    Me too ;-)
    SQL> create table test (col1 number);
    Table created.
    SQL> alter table test add constraint ck_test check (col1 in ('0','1'));
    Table altered.
    SQL> insert into test values (0);
    1 row created.
    SQL> select * from test where col1=0;
    no rows selected
    SQL> explain plan for select * from test where col1=0;
    Explained.
    SQL> set linesize 130
    SQL> set pagesize 0
    SQL> select * from table(dbms_xplan.display);
    Plan hash value: 766971379
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |    13 |     0   (0)|          |
    |*  1 |  FILTER            |      |       |       |            |          |
    |*  2 |   TABLE ACCESS FULL| TEST |     1 |    13 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(NULL IS NOT NULL)
       2 - filter("COL1"=0)
    Note
       - dynamic sampling used for this statement
    19 rows selected.
    SQL> select * from test where to_char(col1)=0;
          COL1
             0
    SQL> explain plan for select * from test where to_char(col1)=0;
    Explained.
    SQL> set linesize 130
    SQL> set pagesize 0
    SQL> select * from table(dbms_xplan.display);
    Plan hash value: 1357081020
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |    13 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| TEST |     1 |    13 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(TO_NUMBER(TO_CHAR("COL1"))=0)
    Note
       - dynamic sampling used for this statement
    17 rows selected.Cheers
    Legatti

  • Thread-safe and performant way to return rows and then delete them

    Hi all
    I have a table containing rows to be processed by Java. These rows need to be returned to Java, then they willl be processed and sent to a JMS queue, then if that JMS operation is successful they need to be deleted from the Oracle table..
    The current method is:
    Java calls Oracle SP with 'numrows' parameter.
    Oracle SP updates that number of rows in the table with a batch ID from a sequence, and commits.
    Oracle SP returns the Batch_ID to Java.
    Java then selects * from table where batch_id = XXXX;
    Java sends messages to JMS. If JMS transaction is OK, Java deletes from table where batch_Id =xxxx and commits;
    Clearly this isn't very efficient. What I would like to do is this:
    Java calls Oracle SP with 'numrows' parameter
    Oracle SP returns that many rows in a cursor and deletes them from the table simultaneously. Oracle SP does not open a new transaction - transaction is controlled from JAva.
    Java writes to JMS. If JMS is OK, Java commits its DB transaction and thus the rows are deleted.
    Therefore there's only a single DML operation - a DELETE.
    The trouble is, this is not threadsafe - if I have two Java threads calling the Oracle SP, then thread #2 may return rows that thread #1 already got - because thread#1 has not yet committed its delete, and thread#2 can select those rows. Thread#2 will then lock waiting to delete them until thread#1 has finished its delete, then thread#2 will get "0 rows deleted". But Java will stlil have been sent those rows.
    How can I engineer this method to be as efficient as possible while still being threadsafe? The key problem I'm having is that the DELETE operation doesn't prevent the rows being SELECTed by other threads - if there was a way to DELETE without committing but also immediately make those rows unavailable to other threads, that would work I think.
    Any help much appreciated
    Tom

    Hi Tom,
    You forgot to "mention" your version.
    I'm not sure, but I believe [SKIP LOCKED|http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702] is safe to use. At least in 11.1. (I have used in both 9i and 10g where it was unsupported/undocumented)
    There is of course always the boring way: A single thread.
    Regards
    Peter

  • How to find if cursor returned rows

    If i have a procedure like
    create procedure test as
    cursor cur_test is
    select col
    from table;
    begin
         delete from tab1 a;
         for var_cur_test in cur_test
         loop
              insert into temp
              values(var_cur_test.col);
         end loop;
         commit;
    end;
    How do I check if the cursor has returned any rows?
    I dont want to delete from tab1 if cursor 'cur_test' does not return any rows and I want to exit out of the proc.
    If the cursor returns rows > 0 then I want to delete and do the insert.
    Thanks for the help.

    The scenario is like this.
    There is a schema A which has to run a process and populate its tables and at the end of the process(java program) run the procedure which is in schema B to pull data from schema A and populate the tables in schema B. If there is a case where Schema A's process fails( then Schema A's tables end up with no data), the process is still running the procedure in schema B and deleting the data in tables with no data being inserted.
    So, I have to check in the procedure if the tables in Schema A have any data before the process can run the proc.
    I tried the solution you provided but it returns no data
    CREATE OR REPLACE PROCEDURE MMA_TEST
    VAR_CONTRACT_ID VARCHAR2
    AS
    CURSOR CUR_TEST IS
    SELECT CMS_CONTRACT_ID,CMS_PLAN_ID
    FROM MMA_PLANS
    WHERE CMS_CONTRACT_ID = VAR_CONTRACT_ID;
    BEGIN
         for var_cur_test in cur_test
         loop
              if (cur_test%rowcount = 1) then
              delete from temp ;
              end if ;
              insert into temp
              values(var_cur_test.cms_contract_id,var_cur_test.cms_plan_id);
         end loop;
    end;

  • Select query does not return rows

    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    the query is not giving result for this particular request sid.75006271 is present in table.

    833560 wrote:
    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    Hi,
    Its very difficult to analyse the query without any data being provided. So I suggest you to debug the above query by keeping basic join condition intact and comment out all the other where conditions for initial run.
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    --AND pr.org_unit_sid = ou.org_unit_sid
    --AND pr.oprtnl_flag = 'A'
    --AND ptr.oprtnl_flag = 'A'
    --AND ou.oprtnl_flag = 'A'
    --AND pr.pa_mode_type_lkpcd = 'BT'
    --AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    --AND pr.pa_rqst_sid = 75006271If if you have given join conditions proper and if data exists ,you can see set of rows displayed.
    Next step is to keep on uncommenting each of the where condition
    AND pr.oprtnl_flag = 'A'Like this you 'll come to the condition which does not match your requirement
    Hope this helps
    Regards,
    Achyut

  • Oracle 8i vs Oracle 9/10: Group by and order of returned rows

    Hello people,
    I've searched the forum for threads on this topic: the order of returned rows in queries which have a GROUP BY clause, and found out that Oracle states that GROUP BY clause does not guarantee that the order of returned rows will be the same every time nor the rows will be ordered someway. I've confirmed this information in the Oracle documentation for the GROUP BY clause for Oracle 9 and 10. But I couldn't find the same in the Oracle 8 documentation (SQL Reference), in which the GROUP BY clause section does not mention anything about the order of returned rows in queries which have a GROUP BY (except for something about using a GROUP BY and a HAVING clause together, which is not helpful in this situation).
    Besides, I have an Oracle training book: "Introduction to Oracle: SQL and PL/SQL" for Oracle 8, where the GROUP BY clause is said to perform a default ordering, here is the text:
    "By default, rows are sorted by ascending order of the columns included in the GROUP BY list. You can override this by using the ORDER BY clause".
    So, I need to find out if Oracle 8 GROUP BY clause did some kind of sorting over the returned rows as it is said in the training book and if this behavior changed in Oracle 9. And more important: where to look for to find documentation about this change.
    Thank you, guys, I really hope someone could help me with this.
    Fer.

    And this statement from Tom (taken from the link above) says more about why the sort (even when done because of group by) should not be relied upon:
    <quote from="asktom link above">
    and even when it does sort as a by product of its processing, the sort is a
    BINARY SORT, not your sort (with your language and character set)
    </quote>

  • Sharepoint Export API - Returning rows with a starting row beyond 5000

    Until this last week I have been using looping REST connector logic to extract all of our customers Sharepoint data through the Export API. I was doing this by incrementing the starting row for each call by 500 with a row limit of 500 for each call. I kept
    doing this until the greatest returned row was equal to the total rows with duplicates. This ran in a deployed/automated fashion for the last two weeks. At the start of this week our customer noticed that we were only receiving roughly the number of unique
    customers (~4.9k) rather than the entire dataset (~27k). When I attempt to manually pull data from any point beyond a row count of 5000 I receive zero rows back. 
    Has something changed with the API recently that would cause this to happen? If not with the API, could a change in permission levels/setting cause this?
    Thank you for your time,
    Bryan

    Hi Martin,
    Sorry for the late...very late reply, no I didn´t solved it and now we really need to get this issue sorted out. Since last time I have installed a new DPM 2012 R2 server for the customer, and the exact same error still occurs :(
    So my question in return, have you solved it yet ?
    If so, it would be great if you can reply with the solution.
    If not, MS please advise A.S.A.P
    Thx /Tony

  • Is the order in which a UNION ALL query returns rows guaranteed?

    Guys
    I'm doing a kind of query where I want to return matching rows in a priority order and take the first one. THink of it as getting the most specific error message for a particular context.
    SELECT * FROM (
    SELECT msg FROM errormessages WHERE device = 'x'
    UNION ALL
    SELECT msg FROM errormessages WHERE client = 'y'
    UNION ALL
    SELECT msg FROM (SELECT msg from errormessages WHERE class LIKE 'generic_' ORDER BY class)
    UNION ALL
    SELECT 'missing error message' FROM dual
    WHERE ROWNUM =1
    If UNION ALL is guaranteed to return rows in this order, great. If not, would it be better to have:
    SELECT * FROM ( SELECT * FROM(
    SELECT 1 as ord, msg FROM errormessages WHERE device = 'x'
    UNION ALL
    SELECT 2, msg FROM errormessages WHERE client = 'y'
    UNION ALL
    SELECT 4+SUBSTR(class, 7, 1), msg FROM errormessages WHERE class LIKE 'generic_'
    UNION ALL
    SELECT 9999, 'missing error message' FROM dual
    ) ORDER BY ord )
    WHERE ROWNUM =1Or, another option:
    SELECT msg FROM(
    SELECT
      CASE
        WHEN device = 'x' THEN 1
        WHEN client = 'y' THEN 2
        WHEN class LIKE 'generic_' THEN 4+SUBSTR(class, 7, 1)
      END as ord, msg
    FROM (
      SELECT * FROM errormessages WHERE device = 'x' OR  client = 'y' OR class LIKE 'generic_'
      UNION ALL
      SELECT 999, 'missing error' FROM dual
    ) ORDER BY ord
    )WHERE ROWNUM =1As you can see there is a complication in the generic; devices may advertise that they accept 1,2,3 or 4 lines of info, so I want to use the advertised capabiltiy to pick the most relevant message from the generic set if no specifics exist for the device or the client
    Which was would you go?
    Cheers
    Edited by: charred on Feb 11, 2009 4:56 AM - code tags

    charred wrote:
    So tell me guys, do I go for:
    4 queries unioned together
    or
    1 query with 4 ORs in the where clause and a case when to determine priority?It will depend on your conditions, but if you look at your explain plans you should get an idea for which is the better one; typically I would expect this to be the OR method...
    SQL> select * from emp where deptno = 20
      2  union all
      3  select * from emp where job = 'CLERK'
      4  union all
      5  select * from emp where sal > 2500;
    Execution Plan
    Plan hash value: 3153085224
    | Id  | Operation                    | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |          |    14 |   546 |     8  (75)| 00:00:01 |
    |   1 |  UNION-ALL                   |          |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| EMP      |     5 |   195 |     2   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | DEPT_IDX |     5 |       |     1   (0)| 00:00:01 |
    |*  4 |   TABLE ACCESS FULL          | EMP      |     4 |   156 |     3   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS FULL          | EMP      |     5 |   195 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("DEPTNO"=20)
       4 - filter("JOB"='CLERK')
       5 - filter("SAL">2500)
    Statistics
              1  recursive calls
              0  db block gets
             18  consistent gets
              1  physical reads
              0  redo size
           1328  bytes sent via SQL*Net to client
            396  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             14  rows processed
    SQL> select * from emp
      2  where deptno = 20 or job = 'CLERK' or sal > 2500;
    Execution Plan
    Plan hash value: 3956160932
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |    10 |   390 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |    10 |   390 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DEPTNO"=20 OR "SAL">2500 OR "JOB"='CLERK')
    Statistics
              1  recursive calls
              0  db block gets
              8  consistent gets
              0  physical reads
              0  redo size
           1146  bytes sent via SQL*Net to client
            396  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              9  rows processed
    SQL>

  • Auto Counting Number of Rows Where Data is Entered

    I am trying to automatically count the number of rows where data is entered.  For example, I have a table with six open rows to enter information.  If only three of those rows (A2-A4) had names entered in them, and the next three rows were left blank, can I get each name to equal the value "1" so that I can get a total tally of how many names have been entered? So the final tally in this example would be "3." I appreciate your help!
    file:///Users/josephdlugo/Desktop/Screen%20Shot%202014-04-30%20at%2011.58.28%20A M.png

    there is a function, COUNTA(), that will count the number of items that are not empty:
    C1=COUNTA(B)
    this is shorthand for select cell C1, then type, or copy and paste the formula:
    =COUNTA(B)
    The COUNTA function returns the number of its arguments that are not empty.
    COUNTA(value, value…)
    value: Any value or a collectioncontaining any values.
    value…: Optionally include one or more additional values or collections.

  • HT1689 How do I return to where I left off in my contact list when texting multiple people on 5S?

    How do I return to where I left off in my contact list when texting multiple people on 5S?

    If you 6 menu buttons are pointing to Tracks then select the Track and in the property inpector you can set the Menu Remote Control options. Set Menu to the button on the menu you want to jump to.
    You can set this option individually for chapters in a Track also so,
    HTH,
    -Jake

  • Query not returning rows (nvl)

    Hi all, I was wondering if anyone could help
    I have a query :
    select a, b, c, d, e from table_t
    where a=nvl(:para, a)
    and b=nvl(:parb,b)
    and c=nvl(:parc,c)
    the problem is is one the rows contain a null, then that row is not returned. I would like to return all rows along with the null values.
    for example:
    row 1 has b= null then row 1 is not displayed but only the rest of the rows where b is not null are displayed
    DB version 11.1.0.6.0 g
    All help will be appreciated.
    Kind regards,
    Cleopatra

    Hi, Cleo,
    Cleopatra wrote:
    Hi Frank ,
    thanks for the reply
    I get all the rows displayed now, but the filters do not seem to work for para, parb and parc.
    Any ideas how I could get that?Before moving on to other ideas, let's try the ideas I already mentioned:
    Frank Kulash wrote:
    ... post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data. Make sure the data shows special situations you care about, for example, if a is NULL, but :para is not NULL.
    Explain, using specific examples, how you get those results from that data.
    In problems like this, it often helps to know if there are impossible values for any of the columns. For example, if a is a DATE, it could be helpful to know if all dates stored in the table are after the year 1000, or, if b is a NUMBER, that it is always in the range -100 to +100.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}If the problem includes parameters (such as :para and :parb), then post a few sets of parameters and the results you want from the same sample data for each set.
    Simplify the problem if you can. For example, instead of comparing 3 columns to 3 paramaeters, could you illustrate the problem just as well with 2 columns and 2 parameters, or even 1 column and 1 parameter?

  • Select query for rows where condition 1

    Say I have a table, tb1, that has the following entries:
    FName LName
    Code
    John Doe
    xxx
    Jane Doe
    xxx
    Steve Harper
    x
    Barrak Obama
    x
    George Bush
    xxxx
    Bill Clinton
    xx
    I'd like to write a select query that only lists the rows where the count for Code is > 1, i.e not display the last two rows from the above entry. How would I go about writing that select query.
    Thanks.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> Say I have a table, tb1, that has the following entries: <<
    Are you this rude or really ignorant and too lazy to read the Netiquette at the start to this forum? Why do you think you do not need a key? No DDL? No constraints? And , why, why do you think that “tb1” is a precise, ISO-11179 conforming table name? 
    Let's make this a table of rude posters rated on a 4-star scale. 
    CREATE TABLE Rude_Posters
    (first_name VARCHAR(15) NOT NULL, 
     last_name VARCHAR(15) NOT NULL, 
     PRIMARY KEY (first_name, last_name), 
     rudeness_code VARCHAR (4) NOT NULL
       CHECK (rudeness_code IN ('x', 'xx', 'xxx', 'xxxx'));
    INSERT INTO Rude_Posters
    VALUES
    ('John', 'Doe', 'xxx'), 
    ('Jane', 'Doe', 'xxx'), 
    ('Steve', 'Harper', 'x'), 
    ('Barrack', 'Obama', 'x'), 
    ('George', 'Bush', 'xxxx'), 
    ('Bill', 'Clinton', 'xx');
    >> I'd like to write a SELECT query that only lists the rows where the count for rudeness_code is > 1, i.e not display the last two rows from the above entry. << 
    The rudeness scale is based on stars, so to ask for an integer value is like saying “on a scale from 1 to 10, what is the color of your favorite letter of the alphabet?”
    Next, the number of stars and your narrative do not match. Did you want to say WHERE rudeness_code IN ('xx' 'xxx', 'xxxx')? 
    Please stop programming SQL until you have gotten more education. At this point, you do not know enough to ask a question. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to get rows where a varchar column contain pure numeric value

    hi,
    i have to make a query from a table that return only the rows where the occurrences of a string column contain a pure numeric value
    for example my table MYTABLE have the column COL1 varchar2(100)
    with values
    row 1 : '100'
    row 2 : '101 dalmatiens'
    row 3 : '102'
    row 4 : 'anything'
    i want to get only the rows 1 and 3 which are pure integer so i can sort and compare them like number.
    thanks

    SQL> with rt as   
      2  (select '100' str from dual union all 
      3  select '101 dalmatiens' from dual union all 
      4  select '102' from dual union all
      5  select '103 #$&''() 456' from dual union all
      6  select 'anything' from dual)
      7  /* End of sample data (rt) */
      8  select str
      9         ,trim(translate(str,'1234567890'||str,'1234567890')) num
    10  from rt
    11  where trim(translate(str,'1234567890'||str,'1234567890')) is not null;
    STR            NUM
    100            100
    101 dalmatiens 101
    102            102
    103 #$&'() 456 103456
    -- Oooooops, I misread and now have corrected it
    SQL> with rt as   
      2  (select '100' str from dual union all 
      3  select '101 dalmatiens' from dual union all 
      4  select '102' from dual union all
      5  select '103 #$&''() 456' from dual union all
      6  select 'anything' from dual)
      7  /* End of sample data (rt) */
      8  select str
      9         ,trim(translate(str,'1234567890'||str,'1234567890')) num
    10  from rt
    11  where trim(translate(str,'1234567890'||str,'1234567890')) = str;
    STR            NUM
    100            100
    102            102Message was edited by:
    ushitaki

Maybe you are looking for