query to select data valid

Hi all

IAM trying to extract data from a table that has 3 columns I need to select data, of the same c1, c2 values the c3 must be unique. If the value of c3 is different, so I need to reject these data.

For example:

Table
C1 c2 c3
123 21 July 12 4
123 21 July 12 4
125 23 July 12 6
126 24 July 12 7
126 24 July 12 7
126 24 July 12 7
126 24 July 12 10
126 27 July 12 13
126 27 July 12 13
127 25 July 12 12
127 25 July 12 12
127 25 July 12 12


Result:

C1 c2 c3
123 21 July 12 4
125 23 July 12 6
127 25 July 12 12
126 27 July 12 13

And the oracle 8i installation version.

Please help me to write a query that takes less time to retrieve the data...


Thanks in advance!


-Kel

Hi, Kel,

Here's one way:

SELECT       c1, c2
,       MIN (c3)     AS c3     -- see note
FROM       table_x
GROUP BY  c1, c2
HAVING       COUNT (DISTINCT c3) = 1
;

Note: because the selected groups will only have 1 value of separate c3, it does not matter if you display the MIN or MAX. they will always be the same.

This assumes that c3 is not NULL. If c3 can be NULL, then the solution is a bit more complicated, but only a little.

Tags: Database

Similar Questions

  • Build the query to select date with status

    Hi guys,.

    Grateful if you can advise me on how to build the query on below scenario:

    Table A

    Date

    11.44.39.000000000 12-OCT-14 AM ASIA/SINGAPORE

    11.44.35.000000000 16-SEP-14 AM ASIA/SINGAPORE

    11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE

    The result of the query:

    Date                                                                                            Status

    11.44.39.000000000 12-OCT-14 AM ASIA / SINGAPORE inactive

    11.44.35.000000000 16-SEP-14 active AM ASIA/SINGAPORE

    11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE inactive

    Basically, the logic, I wanted is

    Active principles: today date or max (date) < sysdate

    Otherwise will be inactive

    And there is 1 active date in time.

    Thanks in advance

    Hello

    2753165 wrote:

    Hi guys,.

    Grateful if you can advise me on how to build the query on below scenario:

    Table A

    Date

    11.44.39.000000000 12-OCT-14 AM ASIA/SINGAPORE

    11.44.35.000000000 16-SEP-14 AM ASIA/SINGAPORE

    11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE

    The result of the query:

    Date                                                                                            Status

    11.44.39.000000000 12-OCT-14 AM ASIA / SINGAPORE inactive

    11.44.35.000000000 16-SEP-14 active AM ASIA/SINGAPORE

    11.44.42.000000000 22-SEP-14 AM ASIA/SINGAPORE inactive

    Basically, the logic, I wanted is

    Active principles: today date or max (date)<>

    Otherwise will be inactive

    And there is 1 active date in time.

    Thanks in advance

    Sorry, we don't know what you want.

    Are you saying that 1 row (maximum) can be assigned status = 'Active' and if 2 or more lines are eligible, the last of them will be called 'Active'?

    If so:

    CASE

    WHEN tmstmp<=>

    OR ROW_NUMBER () OVER (PARTITION BY CASE

    WHEN tmstmp<=>

    THEN "could be."

    ANOTHER 'No Way'

    END

    ORDER BY tmstmp DESC

    )  = 1

    THEN "active."

    ELSE 'inactive '.

    END

    If you would care to post CREATE TABLE and instructions INSERT for some samples, so I could test it.

    DATE is not a very good name for a column, especially if the column is a TIMESTAMP, not a DATE.  I called the TMSTMP instead of the DATE column.

  • How to export select data from table in the file?

    Hello..

    Here's my query to select data in 2 tables and I join help call_id column: -.

    Select n.nbr_calling, n.nbr_called, c.tec, n.conversation_duration
    of albn_ngnsm_280110 n, albc_ngnsm_280110 c
    where c.call_id = n.call_id
    and c.route_to_arbor = 1;

    The problem is what is the query to export all the output in text files?


    Thank you
    Balleur

    Hello

    set echo off
    set heading off
    set pagesize 0
    set linesize 150
    
    spool D:\file.csv
    SELECT Query
    spool off
    

    Thank you
    Ankur

  • How to use a parameter query to select and display the data in the table of the façade

    Hiiiiii

    I am using Access 2007 database
    I want to select the specific data in the database using control of the chain as 'select product, size, weight of ProductInfo where barcode (chain control) =?'  and also display the same table of façade.

    I use the connected database toolkit.
    I saw the example of the parameterized insert, but it did not help to use parameterized select query, as well as to display data of parameterized select query.

    I looked for example on parameterized select query, but I don't have any.
    So pls guide me how to do this. I would like to know the other method (if any) that the use of parameter query to perform the same thing.
    If possble pls share a vi reference.
    Thank you!!!

    HII szewczak
    Thanks for the reply
    but I did not getsolution in one of your shared links
    My problem is solved. There is no need to use the parameter query to select control values
    In my case I want to display data from database where bar code is even entered by the user
    I use the data function DB TOOL CHOOSE and create the condition of chain based on concatenation of strings

  • Using the Dynamic Range name in the Data Validation

    Maybe it's the time of day but I'm being a little dimwit here!

    I use = OFFSET(Data!$G$5,0,0,Vlastrow,1) for the range name Tbl_Names.  When I select F5 to check that the range is highlighted it seems everything is in order.

    On a leaf, I have a Data Validation that uses a list where the Source is = Indirect ($G$ 7).  G7 is the text "Tbl_Names".  The table of Validation and the content of the G7 is on the same sheet.

    Where am I going wrong please?

    Thank you

    John

    John

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • Select data to Analytics statement grouping

    Select * from version of v$.

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    PL/SQL Release 12.1.0.2.0 - Production

    CORE Production 12.1.0.2.0

    AMT for Linux: Version 12.1.0.2.0 - Production

    NLSRTL Version 12.1.0.2.0 - Production

    DROP TABLE t1;

    CREATE TABLE t1

    (

    domain VARCHAR2 (20).

    gasday DATE,

    factor_type VARCHAR2 (20).

    factor_value INTEGER

    );

    INSERT INTO t1

    VALUES (field 'A',

    SYSDATE,

    ' FACTOR_TYPE 1',

    (1);

    INSERT INTO t1

    VALUES (field 'A',

    SYSDATE + 2,

    ' FACTOR_TYPE 1',

    (1);

    INSERT INTO t1

    VALUES (field 'A',

    SYSDATE + 4,

    ' FACTOR_TYPE 1',

    (3);

    INSERT INTO t1

    VALUES ('field of B',

    SYSDATE,

    ' FACTOR_TYPE 2',

    (1);

    INSERT INTO t1

    VALUES ('field of B',

    SYSDATE + 2,

    ' FACTOR_TYPE 1',

    (2);

    INSERT INTO t1

    VALUES ('field of B',

    SYSDATE + 4,

    ' FACTOR_TYPE 2',

    (1);

    SELECT * FROM t1;

    SELECT the field,

    factor_type,

    factor_value,

    gasday,

    (Gasday, 1) ahead OF (PARTITION BY factor_type ORDER BY gasday field) - 1 valid_to

    FROM t1;

    FIELDFACTOR_TYPEFACTOR_VALUEGASDAYVALID_TO
    To fieldFACTOR_TYPE 1114.05.201515.05.2015
    To fieldFACTOR_TYPE 1116.05.201517.05.2015
    To fieldFACTOR_TYPE 1318.05.2015
    Field BFACTOR_TYPE 1216.05.2015
    Field BFACTOR_TYPE 2114.05.201517.05.2015
    Field BFACTOR_TYPE 2118.05.2015

    Issues related to the:

    I would like a group/merge the first two rows will be grouped as follows:

    FIELDFACTOR_TYPEFACTOR_VALUEGASDAYVALID_TO
    To fieldFACTOR_TYPE 1114.05.201517.05.2015

    I wish I had the last two lines in the result above to be "concatinated" / merged, as follows:

    FIELDFACTOR_TYPEFACTOR_VALUEGASDAYVALID_TO
    Field BFACTOR_TYPE 2114.05.2015

    Therefore, my final result of my query should resemble the following:

    FIELDFACTOR_TYPEFACTOR_VALUEGASDAYVALID_TO
    To fieldFACTOR_TYPE 1114.05.201517.05.2015
    To fieldFACTOR_TYPE 1318.05.2015
    Field BFACTOR_TYPE 1216.05.2015
    Field BFACTOR_TYPE 2114.05.2015

    How do I get there?

    The rule is:

    If the domain group, factor_type, and factor_value values and last place in the Group has an open end (IE valid_to is NULL), then the merged line should also have an open end. Or, if the last row has a value for VALID_TO, this value should be used for VALUE_TO in the line of fusion / grouped.

    I wrapped your SQL in an aggregate like this query:

    Select field, factor_type, factor_value, min (gasday), max (valid_to) keep (dense_rank last nulls valid_to service modified)

    de)

    SELECT the field,

    factor_type,

    factor_value,

    gasday,

    (Gasday, 1) ahead OF (PARTITION BY factor_type ORDER BY gasday field) - 1 valid_to

    FROM t1

    )

    Domain group, factor_type, factor_value

    order by 1,2,3;

    It seeks to achieve what you want, even if I'm not following the logic behind your needs

  • Export to spreadsheet does not show the formatting data Validation rules

    Currently in Hyperion Planning 11.1.2.3, have basic color formatting based on Data Validation rules. However, when you use the option export to a worksheet, the Formatting disappears.

    Understand the connection to Hyperion planning is kept only on Smart View, if she will not apply export on the worksheet?

    Thank you

    Mauricette

    I think that the formatting will be lost during the selection of the option export spreadsheet because it is about a raw format, if you want to format would be preferable to use the Smart View method.

    See you soon

    John

    http://John-Goodwin.blogspot.com/

  • Oracle query to generate date and calculate fees

    Hi, please help me to create a query to get the end result of both tables as below

     CREATE TABLE detention_charge_slot
       (slot_no NUMBER(5),
      from_days NUMBER(10),
      to_days NUMBER(10),
      charge_amount NUMBER(10,2));
    
     INSERT INTO detention_charge_slot  VALUES (1,1,4,0);
     INSERT INTO detention_charge_slot  VALUES (2,5,9,10);
     INSERT INTO detention_charge_slot  VALUES (3,10,14,20);
     INSERT INTO detention_charge_slot  VALUES (4,15,999,25);
    
       CREATE TABLE detention_invoice
       (invoice_no NUMBER(10),
      invoice_dt DATE,
      delivery_dt DATE);
    
       INSERT INTO detention_invoice VALUES(1,'10-JAN-2015','25-JAN-2015');
    

    Where expected result 1 = Invoice_no:

    Start_date End_date Days Charge_Amount
    JANUARY 10, 2015JANUARY 13, 201540
    JANUARY 14, 201518 JANUARY 2015510
    19 JANUARY 2015JANUARY 23, 2015520
    JANUARY 24, 201525 JANUARY 2015225

    If you expect more than one line in DETENTION_INVOICE, use the following query

    WITH DATES

    AS

    (SELECT DI. INVOICE_DT + FROM_DAYS - 1 START_DATE,

    LEAST (DI. INVOICE_DT + TO_DAYS - 1, DELIVERY_DT) END_DATE.

    CHARGE_AMOUNT

    OF DCS, DETENTION_INVOICE DI DETENTION_CHARGE_SLOT

    where di.invoice_no = 1)

    SELECT start_date, end_date - + 1 days START_DATE, end_date, charge_amount

    OF DATES

  • query to display data in table with several detail table

    Hi all

    I have a few cases with a table header that have more than 3 table of detail, and I have to generate the query to show all the data horizontally.

    tblHdr have column A (PK)

    tblDtl1 have column A (FK), B (PK)

    tblDtl2 have column A (FK), C (PK)

    tblDtl3 have column A (FK), D (PK)

    and I need a query to display data like this:

    AB1C3D1
    AB2C4D2
    AC5D3
    AC6

    all the Details of the table should display data based on the relationship of tblHdr (A).

    tblDtl1 have only 2 rows of data for the FK A

    tblDtl2 just for FK 4 lines of data

    tblDtl3 only 3 lines of data for the FK A

    Another example:

    AB1C1D1
    AB2C2
    A

    B3

    tblDtl1 only 3 lines of data for the FK A

    tblDtl2 have only 2 rows of data for the FK A

    tblDtl3 have only 1 rows of data for the FK A

    Please shed some light. for the record, I'll use this query in ADF, so I'll put using PLSQL in second priority.  I prefer to do it in the SQL query.

    Thank you

    Here are 3 ways. First test of data:

    drop table ta purge;
    create table ta as
    SELECT 'A' AS A FROM dual
    union all
    select 'B' from dual;
    
    drop table tb purge;
    create table tb as
    SELECT 'A' AS A, 'B1' AS B FROM dual
    UNION ALL
    SELECT 'A', 'B2' FROM dual ;
    
    drop table tc purge;
    create table tc as
    SELECT 'A' AS A, 'C1' AS C FROM dual
    UNION ALL
    SELECT 'A', 'C2' FROM dual
    UNION ALL
    SELECT 'A', 'C3' FROM dual
    UNION ALL
    SELECT 'A', 'C4' FROM dual ;
    
    drop table td purge;
    create table td as
    SELECT 'A' AS A, 'D1' AS D FROM dual
    UNION ALL
    SELECT 'A', 'D2' FROM dual
    UNION ALL
    SELECT 'A', 'D3' FROM dual;
    

    Now 3 solutions: full join, group by and pivot:

    with b as (
      select a, b,
      row_number() over(partition by a order by b) rn
      from tb
    )
    , c as (
      select a, c,
      row_number() over(partition by a order by c) rn
      from tc
    )
    , d as (
      select a, d,
      row_number() over(partition by a order by d) rn
      from td
    )
    select a, b, c, d
    from ta left join b using(a)
    full join c using(a, rn)
    full join d using(a, rn)
    order by a, rn;
    
    select a, max(b) b, max(c) c, max(d) d
    from (
      select a, null b, null c, null d, 1 rn
      from ta
      union all
      select a, b, null, null,
      row_number() over(partition by a order by b) rn
      from tb
      union all
      select a, null, c, null,
      row_number() over(partition by a order by c) rn
      from tc
      union all
      select a, null, null, d,
      row_number() over(partition by a order by d) rn
      from td
    )
    group by a, rn
    order by a, rn;
    
    select A,B,C,D from (
      select 'A' tab, a, null val, 1 rn from ta
      union all
      select 'B' tab, a, b,
      row_number() over(partition by a order by b) rn
      from tb
      union all
      select 'C' tab, a, c,
      row_number() over(partition by a order by c) rn
      from tc
      union all
      select 'D' tab, a, d,
      row_number() over(partition by a order by d) rn
      from td
    )
    pivot(max(val) for tab in('B' B, 'C' C, 'D' D))
    order by a, rn;
    
    A B C D
    A B1 C1 D1
    A B2 C2 D2
    A C3 D3
    A C4
    B

    Personally, I would prefer to view the data by using a 'join the union', in order to avoid the impression that the different detail records are related somehow.

    select ta.a, b, c, d
    from tb full join tc on 1=0
    full join td on 1=0
    right join ta on ta.a in (tb.a, tc.a, td.a);
    
    A B C D
    A B1
    A B2
    A C1
    A C2
    A C3
    A C4
    A D1
    A D2
    A D3
    B
  • Select data from request date filter

    Here is the example of table with data

    CREATE TABLE test_date (DATE of "CREATED_DATE", "UPDATED_DATE" DATE, NUMBER of 'YEAR'); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('12-JAN-14','DD-MON-RR'),to_date('12-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('13-JAN-14','DD-MON-RR'),to_date('13-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('14-JAN-14','DD-MON-RR'),to_date('14-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('15-JAN-14','DD-MON-RR'),to_date('15-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('16-JAN-14','DD-MON-RR'),to_date('16-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('17-JAN-14','DD-MON-RR'),to_date('17-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('18-JAN-14','DD-MON-RR'),to_date('18-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('19-JAN-14','DD-MON-RR'),to_date('19-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('20-JAN-14','DD-MON-RR'),to_date('20-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('21-JAN-14','DD-MON-RR'),to_date('21-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('22-JAN-14','DD-MON-RR'),to_date('22-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('23-JAN-14','DD-MON-RR'),to_date('23-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('24-JAN-14','DD-MON-RR'),to_date('24-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('25-JAN-14','DD-MON-RR'),to_date('25-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('26-JAN-14','DD-MON-RR'),to_date('26-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('27-JAN-14','DD-MON-RR'),to_date('27-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('28-JAN-14','DD-MON-RR'),to_date('28-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('29-JAN-14','DD-MON-RR'),to_date('29-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('30-JAN-14','DD-MON-RR'),to_date('30-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('31-JAN-14','DD-MON-RR'),to_date('12-MAR-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('01-FEB-14','DD-MON-RR'),to_date('01-FEB-14','DD-MON-RR'),2011);

    This query returns no data

    Select * from test_date where created_date < 31 January 14 ' and updated_date > 31 January 14 ';


    desired result

    above the query should return before last row as well as below

    31 JANUARY 14 MARCH 12, 142010

    I am surprised why above query is not any line? !!!

    Select * from test_date where created_date < '31-jan-14'="" and="" updated_date=""> 31 January 14 ';


    desired result

    above the query should return before last row as well as below

    31 JANUARY 14 MARCH 12, 14 2010

    I am surprised why above query is not any line? !!!

    You do not get the expected results because '<' (less="" than)="" operator="" does="" not="" include="" the="" results="" that="" are="" equal="" to="" the="" right="" hand="" side="" value.="" in="" order="" to="" get="" the="" desired="" result="" change="" the="" comparison="" operator="" to=""><=>

  • Query - error converting data type varchar to float.

    All pop up error message is

    java.sql.SQLException: [Macromedia] [SQLServer JDBC Driver] [SQL Server] error...

    I use CF10 Report Builder. Here's my query:

    SELECT name.first_name, name.last_name, name.soc_sec, name.name_le1, name.camp_cod, term AS LEFT(MMTemp.term_int, 6), MMTemp.st_addr, MMTemp.add_addr, MMTemp.city, MMTemp.state, MMTemp.zip, transact.sch_yr AS SchYr, transact.ref_id AS AwardDesc, transact.offered AS AwdAmt, nmact.act_memo, MMTemp.Operator, rpt_schy.token, nmbudget.nmbudget_tuition AS tuition, nmbudget_RM_BRD AS RoomBoard,

    CASE

    WHEN finaideurekaawdcat.finaidawdcat_cod like '% E' GOLD finaideurekaawdcat.finaidawdcat_cod as "OT" and THEN "Gift aid & schlorships.

    WHEN finaideurekaawdcat.finaidawdcat_cod = 'FG' THEN 'need based aid.

    WHEN finaideurekaawdcat.finaidawdcat_cod = "FL" AND "federal ready direct.

    ELSE 'work study' END as CatType

    / * CASE WHEN name.camp_cod = "AdultLearn" THEN '17911' ELSE '20510' END HAVE tuition.

    CASE WHEN name.name_le1 = 0 THEN '8835' ELSE '0' END AS RoomBoard * /.

    Name, MMTemp, nmact, transact, finaideurekaawd, finaideurekaawdcat, rpt_schy, nmbudget

    WHERE (MMTemp.Operator = rpt_schy.token or MMTemp.Operator = Right(MMTemp.Operator,8))

    AND MMTemp.soc_sec = name.soc_sec

    AND MMTemp.soc_sec = nmact.soc_sec

    AND MMTemp.activity_cod = nmact.activity_cod

    AND MMTemp.soc_sec = transact.soc_sec

    AND MMTemp.activity_cod = 'AM'

    AND MMTemp.soc_sec = nmbudget.soc_sec

    AND transact.tcodes = 'AW'

    AND transact.accept <>'v '.

    AND transact.sch_yr = rpt_schy.sch_yr

    AND rpt_schy.token = ' #session.token # '.

    AND transact.awd_id = finaideurekaawd.finaidawddesc_cod

    AND finaideurekaawd.finaidawdcat_cod = finaideurekaawdcat.finaidawdcat_cod

    UNION

    SELECT finaideurekaawddesc.finaideurekaawddesc AS AwardDesc, finaideurekaawd.finaideurekaawdtot AS AwdAmt, name.first_name, name.last_name, name.soc_sec, name.name_le1, name.camp_cod, LEFT (MMTemp.term_int, 6) AS a term, MMTemp.st_addr, MMTemp.add_addr, MMTemp.city, MMTemp.state, MMTemp.zip, MMTemp.activity_cod, MMTemp.Operator, finaideurekaawd. Sch_years AS SchYr, nmact.act_memo, nmbudget.nmbudget_tuition AS tuition, nmbudget_RM_BRD AS RoomBoard,

    CASE

    WHEN finaideurekaawdcat.finaidawdcat_cod like '% E' GOLD finaideurekaawdcat.finaidawdcat_cod as "OT" and THEN "Gift aid & schlorships.

    WHEN finaideurekaawdcat.finaidawdcat_cod = 'FG' THEN 'need based aid.

    WHEN finaideurekaawdcat.finaidawdcat_cod = "FL" AND "federal ready direct.

    ELSE 'work study' END as CatType

    / * CASE WHEN name.camp_cod = "AdultLearn" THEN '17911' ELSE '20510' END HAVE tuition.

    CASE WHEN name.name_le1 = 0 THEN '8835' ELSE '0' END AS RoomBoard * /.

    OF MMTemp, nmact, finaideurekaawd, finaideureka, finaideurekaawddesc, finaideurekaawdcat, rpt_schy, nmbudget

    WHERE (MMTemp.Operator = rpt_schy.token or MMTemp.Operator = Right(MMTemp.Operator,8))

    AND MMTemp.activity_cod = 'AM'

    AND MMTemp.activity_cod = nmact.activity_cod

    AND finaideurekaawd.sch_years = rpt_schy.sch_yr

    AND rpt_schy.token = ' #session.token # '.

    AND MMTemp.soc_sec = name.soc_sec

    AND MMTemp.soc_sec = nmbudget.soc_sec

    AND name.soc_sec = nmact.soc_sec

    AND name.soc_sec = finaideurekaawd.soc_sec

    AND name.soc_sec = finaideureka.soc_sec

    AND finaideurekaawd.finaidawddesc_cod = finaideurekaawddesc.finaidawddesc_cod

    AND finaideurekaawd.finaidawdcat_cod = finaideurekaawdcat.finaidawdcat_cod

    ORDER BY name.soc_sec

    I don't see anywhere that I convert varchar to float.

    Which data fields are defined as floating point?

  • Help with the query to select only one record from the result set in double

    Hello

    Please help with the query. Version of Oracle database we use is 10g R2.

    I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec

    ID
    Org
    DF
    Sec Sub-Sec

    (163)CQCPDMCPDMHD(163)PCENGENGENG(163)CQASICASICIS8888TSTACTACTAC(163)TSHEHESW6789CQINFOINFOFOS6789PCSECSYSSECSYSINFO16789TSSECSYSSECSYSINFO29009PCBMSBMSBMS1

    My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.

    ID
    DSB

    DF
    SEC
    Sub-Sec
    (163)CQCPDMCPDMHD8888TSTACTACTAC6789CQINFOINFOFOS9009PCBMSBMSBMS1


    Thank you

    Orton

    Hello

    This sounds like a job for ROW_NUMBER:

    WITH got_r_num AS

    (

    SELECT id, DSB, df, s, sub_sec org

    ROW_NUMBER () OVER (PARTITION BY ID.

    ORDER BY org

    ) AS r_num

    OF view_x

    )

    SELECT id, DSB, df, sub_sec s,

    OF got_r_num

    WHERE r_num = 1

    ;

    He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data.  (I know that you said that you were a view selection.  Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.  (I didn't quite understand the explanation above.  I don't know why you want to

    ID ORG DF DRY SUB_SEC

    --      ---     --      ---     -------

    1234 CQ DPRK DPRK HD

    and is not

    1234 IS CQ ASIC, ASIC

    or

    TS 1234 IT IT SW

    or

    1234 CQ ASIC ASIC HD

    )
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Get blocking detected when waiting for resource query error select...

    Hi all

    I get an error below each time that the execution of the select query below...

    a few times, it will show lock detected while you wait resource and finished...

    a few times, it runs and give the result...

    but all the time, he writes a journal to alert to the alert

    Plesae suggest how to solve the problem...

    Thanks in advance

    .

    Env: Linux / Oracle 11.2.0.3.3

    .

    .

    Alerts log error:

    Errors in the /u01/oracle/oracle/diag/rdbms/bdrdb/bdrdb/trace/bdrdb_p017_6076.trc file:

    ORA-00060: Deadlock detected while you wait resource

    ORA-10387: interruption of server a (normal) parallel query

    Trace file... information bdrdb_p017_6076.trc:

    Trace file /U01/Oracle/Oracle/diag/RDBMS/bdrdb/bdrdb/trace/bdrdb_p017_6076.TRC

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/dbhome_1

    Name of the system: Linux

    Name of the node: bdrdb.cteplindia.com

    News Release: 2.6.18 - 308.el5PAE

    Version: #1 SMP kills Jan 27 17:40:09 EST 2012

    Machine: i686

    Instance name: bdrdb

    Redo thread mounted by this instance: 1

    Oracle process number: 92

    Unix process pid: 6076, image: [email protected] (P017)

    2013-11-04 23:18:57.915

    SESSION ID: (423.59970) 2013-11-04 23:18:57.915

    CUSTOMER ID :() 23:18:57.915 2013-11-04

    SERVICE NAME: (bdrdb) 2013-11-04 23:18:57.915

    MODULE NAME :() 23:18:57.915 2013-11-04

    ACTION NAME :() 23:18:57.915 2013-11-04

    .

    .

    2013-11-04 23:18:57.915

    DEADLOCK DETECTED (ORA-00060)

    .

    [Transaction blocking]

    Deadlock graph event:

    -Blockers - Waiter (s).

    Resource name process session held process session expected holds expected

    PS-00000001-00000011 92 423 S 33 128 S X

    BF-2ed08c01-00000000 33 128 S 92 423 S X

    session 423: C 005-0001-00081126 session 128: DONE 01/21/67 D 23

    session 128: MADE 21/01/67 D session 23 423: have you 0001-005 C-00081126

    DEADLOCK DETECTED (ORA-00060)

    [Transaction blocking]

    Deadlock graph event:

    -Blockers - Waiter (s).

    Resource name process session held process session expected holds expected

    PS-00000001-00000011 92 423 S 33 128 S X

    BF-2ed08c01-00000000 33 128 S 92 423 S X

    session 423: C 005-0001-00081126 session 128: DONE 01/21/67 D 23

    session 128: MADE 21/01/67 D session 23 423: have you 0001-005 C-00081126

    Expected number of lines:

    Session 423: no line

    Session 128: obj - rowid = 00021DC1 - AAAh3BAAVAAAQL/AAA

    (dictionary objn - 138689, file - 21, block - 66303, machine slot - 0)

    -Information for OTHER waiting sessions-

    Session 128:

    SID: 128 ser: 46176 audsid: 1836857 user: 102/DBLOCAL

    indicators: (0 x 8000041) USR /-flags_idl: (0 x 1) BSY /-/ - /-/ - / -.

    Flags2: (0 x 40009) - /-/ INC.

    PID: 33 info o/s: user: oracle, duration: UNKNOWN, ospid: 31611

    image: [email protected]

    Customer details:

    Info of the o/s: user: hidden, term: hidden, ospid: 5924:568

    machine: hidden program: Toad.exe

    application name: TOAD background query session, the hash value = 526966934

    SQL courses

    application name: TOAD background query session, the hash value = 526966934

    SQL courses

    SELECT DISTINCT B_FP_TEST. TEST_ID

    OF B_FP_TEST.

    B_USER_INFO,

    J_FP_INVESTIGATOR,

    L_TEST_STATUS,

    L_ATMS_TEST_TYPE,

    j_op_test_anml

    WHERE B_FP_TEST. TEST_ID = J_FP_INVESTIGATOR. TEST_ID

    AND B_FP_TEST. TEST_TYPE_ID = L_ATMS_TEST_TYPE. ATMS_TEST_TYPE_ID

    AND B_USER_INFO. B_USER_INFO_ID = J_FP_INVESTIGATOR. INVESTIGATOR_ID

    AND B_FP_TEST. BATCH = L_TEST_STATUS. BATCH

    AND B_FP_TEST.IS_DELETED =: "SYS_B_00."

    AND B_FP_TEST. TEST_NUM NOT IN (: 'SYS_B_01,': 'SYS_B_02': 'SYS_B_03')

    AND L_ATMS_TEST_TYPE.IS_DELETED =: "SYS_B_04."

    AND J_FP_INVESTIGATOR.is_pi =: "SYS_B_05."

    AND L_TEST_STATUS. STATUS (: 'SYS_B_06': 'SYS_B_07': 'SYS_B_08')

    AND j_op_test_anml.test_id = B_FP_TEST. TEST_ID

    .

    .

    -End of information for OTHER waiting sessions-

    .

    .

    2013-11-04 23:18:57.916

    dbkedDefDump(): from a dump of diagnosis non-event (flags = 0 x 0, level = 3, mask = 0 x 0)

    -Error stack dump-

    ORA-00060: Deadlock detected while you wait resource

    ORA-10387: interruption of server a (normal) parallel query

    -SQL statement (none).

    Run SQL information not available - no cursor.

    -Call trace stack memory-

    call call entered the argument values in hex

    location point type (? means dubious value)

    More...

    .

    .

    .

    .

    Query:

    SELECT DISTINCT B_FP_TEST. TEST_ID

    OF B_FP_TEST.

    B_USER_INFO,

    J_FP_INVESTIGATOR,

    L_TEST_STATUS,

    L_ATMS_TEST_TYPE,

    j_op_test_anml

    WHERE B_FP_TEST. TEST_ID = J_FP_INVESTIGATOR. TEST_ID

    AND B_FP_TEST. TEST_TYPE_ID = L_ATMS_TEST_TYPE. ATMS_TEST_TYPE_ID

    AND B_USER_INFO. B_USER_INFO_ID = J_FP_INVESTIGATOR. INVESTIGATOR_ID

    AND B_FP_TEST. BATCH = L_TEST_STATUS. BATCH

    AND B_FP_TEST.IS_DELETED = 0

    AND B_FP_TEST. TEST_NUM NOT IN (1, 2, 99)

    AND L_ATMS_TEST_TYPE.IS_DELETED = 0

    AND J_FP_INVESTIGATOR.is_pi = 1

    AND L_TEST_STATUS. STATUS ('regular', 'In progress', 'completed')

    AND j_op_test_anml.test_id = B_FP_TEST. TEST_ID

    AND ((j_op_test_anml.end_date ENTRE TO_DATE (28 octobre 2013 ") - 1))

    AND TO_DATE (4 November 2013 ') + 1).

    OR (j_op_test_anml.start_date BETWEEN TO_DATE (28 October 2013 "") - 1).

    AND TO_DATE (4 November 2013 ') + 1).

    OR (TO_DATE (28 October 2013') BETWEEN j_op_test_anml.start_date)

    AND j_op_test_anml.end_date)

    OR (TO_DATE (4 November 2013") BETWEEN j_op_test_anml.start_date)

    (AND j_op_test_anml.end_date))

    AND L_ATMS_TEST_TYPE.IS_DELETED = 0

    AND B_FP_TEST. DATASOURCE_ID = 9

    .

    .

    .

    Exp query plan:

    Hash value of plan: 3398228788

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation                                          | Name                | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |    TQ | IN-OUT | PQ Distrib.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                     |  1501 |   102K |  1929 (1) | 00:00:24 |       |       |        |      |            |

    |   1.  HASH UNIQUE                                       |                     |  1501 |   102K |  1929 (1) | 00:00:24 |       |       |        |      |            |

    |   2.   CONCATENATION.                     |       |       |            |          |       |       |        |      |            |

    |   3.    COORDINATOR OF PX |                     |       |       |            |          |       |       |        |      |            |

    |   4.     PX SEND QC (RANDOM). : TQ30005 |   241. 16870 |   800 (1) | 00:00:10 |       |       |  Q3, 05 | P > S | QC (RAND) |

    |*  5 |      HASH JOIN                                     |                     |   241. 16870 |   800 (1) | 00:00:10 |       |       |  Q3, 05 | SVCP |            |

    |   8 2       PX RECEIVE                                   |                     |   246. 15990.   797 (1) | 00:00:10 |       |       |  Q3, 05 | SVCP |            |

    |   7.        PX SEND HASH | : TQ30004 |   246. 15990.   797 (1) | 00:00:10 |       |       |  Q3, 04 | P > P | HASH |

    |*  8 |         HASH JOIN                                  |                     |   246. 15990.   797 (1) | 00:00:10 |       |       |  Q3, 04 | SVCP |            |

    |   9.          RECEIVE PX |                     |   573. 29223 |   793 (1) | 00:00:10 |       |       |  Q3, 04 | SVCP |            |

    |  10.           PX SEND HASH | : TQ30003 |   573. 29223 |   793 (1) | 00:00:10 |       |       |  Q3, 03 | P > P | HASH |

    | * 11 |            HASH JOIN                               |                     |   573. 29223 |   793 (1) | 00:00:10 |       |       |  Q3, 03 | SVCP |            |

    |  12.             KIND OF BUFFER.                     |       |       |            |          |       |       |  Q3, 03 | ISSUE |            |

    |  13.              RECEIVE PX |                     |       |       |            |          |       |       |  Q3, 03 | SVCP |            |

    |  14.               PX SEND BROADCAST | : TQ30000 |       |       |            |          |       |       |        | S > P | BROADCAST |

    |  15.                NESTED LOOPS |                     |       |       |            |          |       |       |        |      |            |

    |  16.                 NESTED LOOPS |                     |   485. 20855 |   781 (0) | 00:00:10 |       |       |        |      |            |

    |  17.                  TABLE ACCESS BY INDEX ROWID | J_OP_TEST_ANML |   485. 10185 |   296 (0) | 00:00:04 | ROWID | ROWID |        |      |            |

    | * 18.                   INDEX RANGE SCAN | IDX$ $_2D190001 |   485.       |     4 (0) | 00:00:01 |       |       |        |      |            |

    | * 19.                  INDEX UNIQUE SCAN | FT_TEST_ID_PK |     1.       |     0 (0) | 00:00:01 |       |       |        |      |            |

    | * 20.                 TABLE ACCESS BY INDEX ROWID | B_FP_TEST |     1.    22.     1 (0) | 00:00:01 | ROWID | ROWID |        |      |            |

    |  21.             ITERATOR BLOCK PX |                     | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q3, 03 | ISSUE |            |

    | * 22.              TABLE ACCESS FULL | J_FP_INVESTIGATOR | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q3, 03 | SVCP |            |

    |  23.          KIND OF BUFFER.                     |       |       |            |          |       |       |  Q3, 04 | ISSUE |            |

    |  24.           RECEIVE PX |                     |     3.    42.     3 (0) | 00:00:01 |       |       |  Q3, 04 | SVCP |            |

    |  25.            PX SEND HASH | : TQ30001 |     3.    42.     3 (0) | 00:00:01 |       |       |        | S > P | HASH |

    | * 26.             TABLE ACCESS FULL | L_TEST_STATUS |     3.    42.     3 (0) | 00:00:01 |       |       |        |      |            |

    |  27.       KIND OF BUFFER.                     |       |       |            |          |       |       |  Q3, 05 | ISSUE |            |

    |  28.        PX RECEIVE                                  |                     |    30.   150.     3 (0) | 00:00:01 |       |       |  Q3, 05 | SVCP |            |

    |  29.         PX SEND HASH | : TQ30002 |    30.   150.     3 (0) | 00:00:01 |       |       |        | S > P | HASH |

    | * 30 |          TABLE ACCESS FULL | L_ATMS_TEST_TYPE |    30.   150.     3 (0) | 00:00:01 |       |       |        |      |            |

    |  31.    NESTED LOOPS |                     |       |       |            |          |       |       |        |      |            |

    |  32.     NESTED LOOPS |                     |     3.   210 |   329 (1) | 00:00:04 |       |       |        |      |            |

    |  33.      NESTED LOOPS |                     |     3.   195.   329 (1) | 00:00:04 |       |       |        |      |            |

    | * 34 |       HASH JOIN                                    |                     |     2.   114.   325 (1) | 00:00:04 |       |       |        |      |            |

    |  35.        NESTED LOOPS |                     |       |       |            |          |       |       |        |      |            |

    |  36.         NESTED LOOPS |                     |     6.   258.   322 (1) | 00:00:04 |       |       |        |      |            |

    |  37.          RANGE OF SINGLE PARTITION |                     |     6.   126.   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 38 |           TABLE ACCESS FULL | J_OP_TEST_ANML |     6.   126.   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 39 |          INDEX UNIQUE SCAN | FT_TEST_ID_PK |     1.       |     0 (0) | 00:00:01 |       |       |        |      |            |

    | * 40 |         TABLE ACCESS BY INDEX ROWID | B_FP_TEST |     1.    22.     1 (0) | 00:00:01 | ROWID | ROWID |        |      |            |

    | * 41.        TABLE ACCESS FULL | L_TEST_STATUS |     3.    42.     3 (0) | 00:00:01 |       |       |        |      |            |

    | * 42 |       TABLE ACCESS BY INDEX ROWID | J_FP_INVESTIGATOR |     1.     8.     2 (0) | 00:00:01 |       |       |        |      |            |

    | * 43.        INDEX RANGE SCAN | FI_TEST_ID_PK |     1.       |     1 (0) | 00:00:01 |       |       |        |      |            |

    | * 44 |      INDEX UNIQUE SCAN | L_ATMS_TEST_TYPE_PK |     1.       |     0 (0) | 00:00:01 |       |       |        |      |            |

    | * 45 |     TABLE ACCESS BY INDEX ROWID | L_ATMS_TEST_TYPE |     1.     5.     1 (0) | 00:00:01 |       |       |        |      |            |

    |  46.    COORDINATOR OF PX |                     |       |       |            |          |       |       |        |      |            |

    |  47.     PX SEND QC (RANDOM). : TQ20003 |       |       |            |          |       |       |  Q2, 03 | P > S | QC (RAND) |

    |  48.      NESTED LOOPS |                     |       |       |            |          |       |       |  Q2, 03 | SVCP |            |

    |  49.       NESTED LOOPS |                     |    33.  2310 |   399 (2) | 00:00:05 |       |       |  Q2, 03 | SVCP |            |

    | * 50 |        HASH JOIN                                   |                     |    33.  2145.   397 (2) | 00:00:05 |       |       |  Q2, 03 | SVCP |            |

    |  51.         RECEIVE PX |                     |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q2, 03 | SVCP |            |

    |  52.          PX SEND HASH | : TQ20002 |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q2, 02 | P > P | HASH |

    | * 53 |           HASH JOIN                                |                     |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q2, 02 | SVCP |            |

    |  54.            KIND OF BUFFER.                     |       |       |            |          |       |       |  Q2, 02 | ISSUE |            |

    |  55.             RECEIVE PX |                     |       |       |            |          |       |       |  Q2, 02 | SVCP |            |

    |  86 M |              PX SEND BROADCAST | : TQ20000 |       |       |            |          |       |       |        | S > P | BROADCAST |

    |  57.               NESTED LOOPS |                     |       |       |            |          |       |       |        |      |            |

    |  58.                NESTED LOOPS |                     |    66.  2838 |   382 (1) | 00:00:05 |       |       |        |      |            |

    |  59.                 RANGE OF SINGLE PARTITION |                     |    66.  1386 |   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 60 |                  TABLE ACCESS FULL | J_OP_TEST_ANML |    66.  1386 |   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 61.                 INDEX UNIQUE SCAN | FT_TEST_ID_PK |     1.       |     0 (0) | 00:00:01 |       |       |        |      |            |

    | * 62 |                TABLE ACCESS BY INDEX ROWID | B_FP_TEST |     1.    22.     1 (0) | 00:00:01 | ROWID | ROWID |        |      |            |

    |  63.            ITERATOR BLOCK PX |                     | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q2, 02 | ISSUE |            |

    | * 64 |             TABLE ACCESS FULL | J_FP_INVESTIGATOR | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q2, 02 | SVCP |            |

    |  65.         KIND OF BUFFER.                     |       |       |            |          |       |       |  Q2, 03 | ISSUE |            |

    |  66.          RECEIVE PX |                     |     3.    42.     3 (0) | 00:00:01 |       |       |  Q2, 03 | SVCP |            |

    |  67.           PX SEND HASH | : TQ20001 |     3.    42.     3 (0) | 00:00:01 |       |       |        | S > P | HASH |

    | * 68 |            TABLE ACCESS FULL | L_TEST_STATUS |     3.    42.     3 (0) | 00:00:01 |       |       |        |      |            |

    | * 69 |        INDEX UNIQUE SCAN | L_ATMS_TEST_TYPE_PK |     1.       |     0 (0) | 00:00:01 |       |       |  Q2, 03 | SVCP |            |

    | * 70 |       TABLE ACCESS BY INDEX ROWID | L_ATMS_TEST_TYPE |     1.     5.     1 (0) | 00:00:01 |       |       |  Q2, 03 | SVCP |            |

    |  71.    COORDINATOR OF PX |                     |       |       |            |          |       |       |        |      |            |

    |  72.     PX SEND QC (RANDOM). : TQ10003 |       |       |            |          |       |       |  Q1, 03 | P > S | QC (RAND) |

    |  73.      NESTED LOOPS |                     |       |       |            |          |       |       |  Q1, 03 | SVCP |            |

    |  74.       NESTED LOOPS |                     |    33.  2310 |   399 (2) | 00:00:05 |       |       |  Q1, 03 | SVCP |            |

    | * 75 |        HASH JOIN                                   |                     |    34.  2210 |   397 (2) | 00:00:05 |       |       |  Q1, 03 | SVCP |            |

    |  76.         RECEIVE PX |                     |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q1, 03 | SVCP |            |

    |  77.          PX SEND HASH | : TQ10002 |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q1, 02 | P > P | HASH |

    | * 78 |           HASH JOIN                                |                     |    78.  3978 |   393 (1) | 00:00:05 |       |       |  Q1, 02 | SVCP |            |

    |  79.            KIND OF BUFFER.                     |       |       |            |          |       |       |  Q1, 02 | ISSUE |            |

    |  80.             RECEIVE PX |                     |       |       |            |          |       |       |  Q1, 02 | SVCP |            |

    |  81.              PX SEND BROADCAST | : TQ10000 |       |       |            |          |       |       |        | S > P | BROADCAST |

    |  82.               NESTED LOOPS |                     |       |       |            |          |       |       |        |      |            |

    |  83.                NESTED LOOPS |                     |    66.  2838 |   382 (1) | 00:00:05 |       |       |        |      |            |

    |  84.                 RANGE OF SINGLE PARTITION |                     |    66.  1386 |   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 85 |                  TABLE ACCESS FULL | J_OP_TEST_ANML |    66.  1386 |   316 (1) | 00:00:04 |     7.     7.        |      |            |

    | * 86 |                 INDEX UNIQUE SCAN | FT_TEST_ID_PK |     1.       |     0 (0) | 00:00:01 |       |       |        |      |            |

    | * 87.                TABLE ACCESS BY INDEX ROWID | B_FP_TEST |     1.    22.     1 (0) | 00:00:01 | ROWID | ROWID |        |      |            |

    |  88.            ITERATOR BLOCK PX |                     | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q1, 02 | ISSUE |            |

    | * 89 |             TABLE ACCESS FULL | J_FP_INVESTIGATOR | 70382 |   549KO |    11 (0) | 00:00:01 |       |       |  Q1, 02 | SVCP |            |

    |  90.         KIND OF BUFFER.                     |       |       |            |          |       |       |  Q1, 03 | ISSUE |            |

    |  91.          RECEIVE PX |                     |     5:    42.     3 (0) | 00:00:01 |       |       |  Q1, 03 | SVCP |            |

    |  92.           PX SEND HASH | : TQ10001 |     5:    42.     3 (0) | 00:00:01 |       |       |        | S > P | HASH |

    | * 93 |            TABLE ACCESS FULL | L_TEST_STATUS |     5:    42.     3 (0) | 00:00:01 |       |       |        |      |            |

    | * 94 |        INDEX UNIQUE SCAN | L_ATMS_TEST_TYPE_PK |     1.       |     0 (0) | 00:00:01 |       |       |  Q1, 03 | SVCP |            |

    | * 95 |       TABLE ACCESS BY INDEX ROWID | L_ATMS_TEST_TYPE |     1.     3:     1 (0) | 00:00:01 |       |       |  Q1, 03 | SVCP |            |

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    5 - access("B_FP_TEST".") TEST_TYPE_ID "=" L_ATMS_TEST_TYPE. " ("' ATMS_TEST_TYPE_ID")

    8 - access("B_FP_TEST".") BATCH "=" L_TEST_STATUS. " ("' BATCH ')

    11 - access("B_FP_TEST".") TEST_ID "=" J_FP_INVESTIGATOR. " ("' TEST_ID")

    18 - access("J_OP_TEST_ANML".") Start_date"> = TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND"J_OP_TEST_ANML. " "" Start_date "< = TO_DATE (' 2013-11-05)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss"))

    19 - access("J_OP_TEST_ANML".") TEST_ID "=" B_FP_TEST. " ("' TEST_ID")

    20 - filter("B_FP_TEST".") DATASOURCE_ID '= 9 AND 'B_FP_TEST'." ' IS_DELETED '= 0 AND 'B_FP_TEST'.' <>TEST_NUM ' 1 AND 'B_FP_TEST '. "" TEST_NUM "<>2 AND

    'B_FP_TEST '. ("' TEST_NUM" <>99)

    22 - filter("J_FP_INVESTIGATOR".") IS_PI "= 1)

    26 - filter("L_TEST_STATUS".") STATUS "="Finished"OR"L_TEST_STATUS"". "" STATUS '= 'In progress' OR 'L_TEST_STATUS'." STATUS "="Regular")"

    30 - filter("L_ATMS_TEST_TYPE".") IS_DELETED "= 0)

    34 - access("B_FP_TEST".") BATCH "=" L_TEST_STATUS. " ("' BATCH ')

    38 - filter("J_OP_TEST_ANML".") End_date"> = TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND"J_OP_TEST_ANML. " "' End_date ' < = TO_DATE (' 2013-11-05)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss") AND (LNNVL ("J_OP_TEST_ANML". "Start_date" > = TO_DATE (' 2013-10-27 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')) OR) "

    LNNVL ("J_OP_TEST_ANML". "Start_date" < = TO_DATE (' 2013-11-05 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')))) "

    39 - access("J_OP_TEST_ANML".") TEST_ID "=" B_FP_TEST. " ("' TEST_ID")

    40 - filter("B_FP_TEST".") DATASOURCE_ID '= 9 AND 'B_FP_TEST'." ' IS_DELETED '= 0 AND 'B_FP_TEST'.' <>TEST_NUM ' 1 AND 'B_FP_TEST '. "" TEST_NUM "<>2 AND

    'B_FP_TEST '. ("' TEST_NUM" <>99)

    41 - filter("L_TEST_STATUS".") STATUS "="Finished"OR"L_TEST_STATUS"". "" STATUS '= 'In progress' OR 'L_TEST_STATUS'." STATUS "="Regular")"

    42 - filter("J_FP_INVESTIGATOR".") IS_PI "= 1)

    43 - access("B_FP_TEST".") TEST_ID "=" J_FP_INVESTIGATOR. " ("' TEST_ID")

    44 - access("B_FP_TEST".") TEST_TYPE_ID "=" L_ATMS_TEST_TYPE. " ("' ATMS_TEST_TYPE_ID")

    45 - filter("L_ATMS_TEST_TYPE".") IS_DELETED "= 0)

    50 - access("B_FP_TEST".") BATCH "=" L_TEST_STATUS. " ("' BATCH ')

    53 - access("B_FP_TEST".") TEST_ID "=" J_FP_INVESTIGATOR. " ("' TEST_ID")

    60 - filter("J_OP_TEST_ANML".") End_date"> = TO_DATE(' 2013-11-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND"J_OP_TEST_ANML. " "" Start_date "< = TO_DATE (' 2013-11-04)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss") AND (LNNVL ("J_OP_TEST_ANML". "End_date" > = TO_DATE (' 2013-10-27 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')) OR) "

    LNNVL ("J_OP_TEST_ANML". "End_date" < = TO_DATE (' 2013-11-05 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))) AND (LNNVL ("J_OP_TEST_ANML".) " Start_date"> = TO_DATE (' 2013-10-27)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss")) or LNNVL("J_OP_TEST_ANML".") Start_date"< = TO_DATE (' 2013-11-05 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))))

    61 - access("J_OP_TEST_ANML".") TEST_ID "=" B_FP_TEST. " ("' TEST_ID")

    62 - filter("B_FP_TEST".") DATASOURCE_ID '= 9 AND 'B_FP_TEST'." ' IS_DELETED '= 0 AND 'B_FP_TEST'.' <>TEST_NUM ' 1 AND 'B_FP_TEST '. "" TEST_NUM "<>2 AND

    'B_FP_TEST '. ("' TEST_NUM" <>99)

    64 - filter("J_FP_INVESTIGATOR".") IS_PI "= 1)

    68 - filter("L_TEST_STATUS".") STATUS "="Finished"OR"L_TEST_STATUS"". "" STATUS '= 'In progress' OR 'L_TEST_STATUS'." STATUS "="Regular")"

    69 - access("B_FP_TEST".") TEST_TYPE_ID "=" L_ATMS_TEST_TYPE. " ("' ATMS_TEST_TYPE_ID")

    70 - filter("L_ATMS_TEST_TYPE".") IS_DELETED "= 0)

    75 - access("B_FP_TEST".") BATCH "=" L_TEST_STATUS. " ("' BATCH ')

    78 - access("B_FP_TEST".") TEST_ID "=" J_FP_INVESTIGATOR. " ("' TEST_ID")

    85 - filter("J_OP_TEST_ANML".") End_date"> = TO_DATE(' 2013-10-28 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND"J_OP_TEST_ANML. " "" Start_date "< = TO_DATE (' 2013-10-28)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss") AND (LNNVL ("J_OP_TEST_ANML". "End_date" > = TO_DATE (' 2013-11-04 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')) OR) "

    LNNVL ("J_OP_TEST_ANML". "Start_date" < = TO_DATE (' 2013-11-04 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))) AND (LNNVL ("J_OP_TEST_ANML".) " End_date"> = TO_DATE (' 2013-10-27)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss")) or LNNVL("J_OP_TEST_ANML".") End_date"< = TO_DATE (' 2013-11-05 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))) AND)

    (LNNVL ("J_OP_TEST_ANML". "Start_date" > = TO_DATE (' 2013-10-27 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')) or LNNVL ("J_OP_TEST_ANML".) " Start_date"< = TO_DATE (' 2013-11-05)

    00:00:00 ', "syyyy-mm-dd hh24:mi:ss")))

    86 - access("J_OP_TEST_ANML".") TEST_ID "=" B_FP_TEST. " ("' TEST_ID")

    87 - filter("B_FP_TEST".") DATASOURCE_ID '= 9 AND 'B_FP_TEST'." ' IS_DELETED '= 0 AND 'B_FP_TEST'.' <>TEST_NUM ' 1 AND 'B_FP_TEST '. "" TEST_NUM "<>2 AND

    'B_FP_TEST '. ("' TEST_NUM" <>99)

    89 - filter("J_FP_INVESTIGATOR".") IS_PI "= 1)

    93 - filter("L_TEST_STATUS".") STATUS "="Finished"OR"L_TEST_STATUS"". "" STATUS '= 'In progress' OR 'L_TEST_STATUS'." STATUS "="Regular")"

    94 - access("B_FP_TEST".") TEST_TYPE_ID "=" L_ATMS_TEST_TYPE. " ("' ATMS_TEST_TYPE_ID")

    95 - filter("L_ATMS_TEST_TYPE".") IS_DELETED "= 0)

    aanto wrote:

    Thanks for the update... but if we perform also using Toad... showing the same error...

    Thanks for this update, but it does not change the reality.

    If it hurts when you push you in the eyes, the only way to stop the pain should stop poking you in the eye.

    Oracle is not related ORA-00060 just to make life more difficult.

    ORA-000600 is thrown when a deadlock between two session is detected. PERIOD!

    The order in which the DML is run needs to change.

  • Problem with query to find data offset

    Hello PL/SQL gurus and Experts.

    I am not able to extract the data with the following table structure-
    drop table T2;
    create table T2(Stream, Trade, Fees) as select
    'MECHNICAL', 'Primary', '5534500' from dual union all select
    'ELECTRICAL', 'Secondary', '5285500' from DUAL union all select
    'MECHNICAL', 'Secondary', '2364535' from dual union all select
    'ELECTRICAL', 'Primary', '1734540' from DUAL union all select
    'MBE', 'Secondary', '3424500' from dual union all select
    'ELECTRONICS', 'Primary', '5004567' from DUAL union all select
    'ELECTRONICS', 'Secondary', '4543200' from DUAL union all select
    'COMPUTERS', 'Secondary', '5534500' from DUAL union all select
    'CIVIL', 'Primary', '2345500' from DUAL union all select
    'CIVIL', 'Secondary', '4456500' from DUAL union all select
    'COMPUTERS', 'Primary', '9542500' from DUAL;
    I want to extract the data in the following format-
    Stream          Trade          Fees
    MECHNICAL     Primary          5534500
              Secondary          2364535
    ELECTRICAL     Primary          1734540
              Secondary       5285500
    ELECTRONICS     Primary          5004567
              Secondary        4543200
    CIVIL          Primary          2345500
              Secondary         4456500
    MBE          Primary     
              Secondary       3424500
    Total                    34693342
    Now if I use the following query-
    SELECT CASE WHEN LAG(Stream||Trade) OVER (ORDER BY Stream, Trade, Fees) = Stream||Trade THEN NULL ELSE Stream END Stream
         , CASE WHEN LAG(Stream||Trade) OVER (ORDER BY Stream, Trade, Fees) = Stream||Trade THEN NULL ELSE Trade END Trade
         , CASE WHEN LAG(Fees) OVER (partition by Stream||Trade ORDER BY Stream, Trade, Fees) = Fees THEN NULL ELSE Fees END Fees
    FROM (     select distinct Stream, Trade, Fees from T2 ORDER BY Stream, Trade, Fees);
    SELECT  NVL2(LAG(Trade) OVER (PARTITION BY Stream, Trade ORDER BY Stream, Trade, Fees),Null,Trade) Trade,
         NVL2(LAG(Stream) OVER (PARTITION BY Stream, Trade ORDER BY Stream, Trade, Fees),Null,Stream) Stream,
         Fees
    from (select distinct Stream, Trade, Fees from T2)
    Kindly help me...
    Thank you all for your time and effort in advance.

    use the below. There would be better ways to achieve, I find it easier.

    with filtered as
    (
      select case row_number() over(partition by stream order by trade)
              when 1 then stream
              else null end stream2,trade,fees
      from t2
      order by stream,trade
    )
    select stream2 stream, trade, to_number(fees)
      from filtered
    union all
    select 'Total', null, sum(fees)
      from t2;
    
    STREAM      TRADE     TO_NUMBER(FEES)
    ----------- --------- ----------------------
    CIVIL       Primary   2345500
                Secondary 4456500
    COMPUTERS   Primary   9542500
                Secondary 5534500
    ELECTRICAL  Primary   1734540
                Secondary 5285500
    ELECTRONICS Primary   5004567
                Secondary 4543200
    MBE         Secondary 3424500
    MECHNICAL   Primary   5534500
                Secondary 2364535
    Total                 49770342     
    

    I hope that it meets your needs. If this isn't the case, then please don't forget to provide the expected results, because we have to guess, if you still want to exit expected Original or there is a diversion in it.

  • Select data PHP while loop mysql

    Hello

    So im trying to take a while loop that pulls infro from my database and displays each line of data in my table.

    This is so what I

    $query = mysql_query("SELECT * FROM personal");
    
    
              while($rows = mysql_fetch_array($query)) {
    
    
    $first_name = $rows['first_name'];
    $surname = $rows['surname'];
    $dob = $rows['dob'];
    
    $content = "<div class=\"clients\"><span class=\"sort font first\">$first_name</span><span class=\"sort font\">$surname</span><span class=\"sort font\">$dob</span></div>";
      
              }
    
    

    and my html page where I want to, that is

    <? PHP echo $content? >

    This method works well show the last line of the table, but its not then by displaying all the lines.

    When I use the below all print OK when you view the page of php script.

     while($rows = mysql_fetch_array($query)) {
    
    
    $first_name = $rows['first_name'];
    $surname = $rows['surname'];
    $dob = $rows['dob'];
    
         echo "$first_name";
              echo "<BR>";
      
              }
    
    
    

    any help thanks

    If actually, I set the while loop in the post between the div I want it to work well. but is there a way I can keep it in the script file or is it not necessary?

Maybe you are looking for