Selection of data based on 2 columns

Hello

I have a table like this,
Version: 

Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
PL/SQL Release 9.2.0.5.0 - Production
CORE     9.2.0.6.0     Production
TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
NLSRTL Version 9.2.0.5.0 - Production
CREATE TABLE EMPSELECT( EMP NUMBER , CAR1 CHAR(2),CAR2 CHAR(2) );

INSERT INTO EMPSELECT VALUES( 100 ,   'XX',    'YY');
INSERT INTO EMPSELECT VALUES( 100 ,   'CC',    'YY');
INSERT INTO EMPSELECT VALUES( 100 ,   'CS',    'XX');
INSERT INTO EMPSELECT VALUES( 101 ,   'XX',    'YY');
INSERT INTO EMPSELECT VALUES( 102 ,   '2X',    'YY');
INSERT INTO EMPSELECT VALUES( 102 ,   'SS',    'Y2');
INSERT INTO EMPSELECT VALUES( 103 ,   'RR',    'XX');
INSERT INTO EMPSELECT VALUES( 103 ,   'RC',    'XX');
INSERT INTO EMPSELECT VALUES( 103 ,   'CC',    'CS');
INSERT INTO EMPSELECT VALUES( 101 ,   'TC',    'XX');
INSERT INTO EMPSELECT VALUES( 109 ,   'TC',    'FF');
I want select records from Emp where XX is not present in the two columns CAR1, CAR2 if find 1 line containing XX

OUTPUT:
EMP
102
109

Thank you
Ananda

Published by: Ananda on June 4, 2010 16:19

Published by: Ananda on June 4, 2010 16:20

Something like that?

SELECT *
  FROM empselect
 WHERE emp NOT IN (SELECT DISTINCT emp
                              FROM empselect
                             WHERE car1 = 'XX' OR car2 = 'XX');

* 009 *.

Tags: Database

Similar Questions

  • Simple select for data based on a date

    Hi all

    I wrote data to a table and having problems try doing a select and obtain these data based on the query.

    I want to filter on a column called: TIMESTAMP based provided that the data has been written to the DB on the following date:

    OCTOBER 1 09 10.47.35.597914000

    I thought that would be enough:

    Select * from tableX
    where current_value = 999
    and TIMESTAMP = 1 October 2009"

    I know that the 999 exists because if I take the last line I get the data I want.

    A basic question I know, but any help much appreciated.

    Give the correct points then ;)

    No, I don't know how dangerous it is. The format is specified, the output should be straight (?) and he does not have the building fire the many times I've used it so far.

    Mike

  • Best way to select distinct values, based on another column?

    I have a table with three columns: id (NUMBER), data_dt (DATE) and data_value (NUMBER).
    There is a primary key id and data_dt.

    I want to choose the folder with the last data_dt for each unique identification number.

    What is the best way to do it?
    I have three different methods, but there may be something that I am missing.

    First of all:
    SELECT *
    FROM
    (
      SELECT id, data_dt, data_value,
             FIRST_VALUE(data_dt)
             OVER (PARTITION BY id ORDER BY data_dt DESC) AS last_data_dt
      FROM the_table
    )
    WHERE data_dt = last_data_dt;
    (I use ORDER BY... DESC, instead of just ORDER BY I don't need the clause BETWEEN the LINES)


    Second:
    SELECT t1.*
    FROM the_table t1
    JOIN
    (
      SELECT id, MAX(data_dt) AS last_data_dt
      FROM the_table
      GROUP BY id
    ) t2 ON (t2.id = t1.id AND t2.data_dt = t1.data_dt);
    Third:
    SELECT t1.*
    FROM the_table t1
    WHERE t1.data_dt =
    (
      SELECT MAX(t2.data_dt)
      FROM the_table t2
      WHERE t2.id = t1.id
    );
    -Don

    As mentioned in hoek, you will need to test all scenarios.

    However, in my opinion the more faster will be those who accesses the table that only ONCE instead of TWICE as some scenarios require.

    HTH!

  • Removal of a huge amount of data based on the column Amount

    Hello

    We have a table with more 300 million documents. The table is partitioned on the MRKT_CD and Sub partitioned on AGGREGATE_TYPE_CD. There is a column called SLS_AMT in this table.

    To delete all records where the SLS_AMT is null. What would be the best way to do this? There are more than 9 index into this table, and if I use the approach of the ETG, creating index and collect statistics only run for a very long time.

    Please advise.

    Have you had time to sleep in your database or your database is 24/7?  I mean, do yu have of all time what database not live? for example in SUNDAY?

    If there is, you can RUN remove stmt with parallelism in part, part, for example

    for example

    delete

    Since the partition of mytable (p1)

    where SLS_AMT is null.

    delete

    Since the partition of mytable (p2)

    where SLS_AMT is null.

    and etc.

    and I don't think that there will be no problem.

    ----

    Ramin Hashimzade

  • Problem when sorting the data based on the date

    I am trying to sort the following data based on the column of date of receipt of Transaction, couldn't do it usi g the following syntax:

    <? sort: TRANSACTION_RECEIPT_DATE; ' ascending '; type_donnees = 'date '? >

    I have problem to convert the canonical date report date, there at - it another way to reach the exit without converting the date format.

    <? XML version = "1.0"? >
    <! - generated by the Oracle version 6.0.8.27.0 reports - >
    < RECDTREP >
    < LIST_G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO104 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 24636 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863063 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO107 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 24641 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863068 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    PO123 < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 24658 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863086 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    PO75 < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 31 March 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 22190 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 14 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510860842 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 31 March 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 971515 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO116 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 25 June 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 64271 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 30 June 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863077 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 25 June 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO92 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 31 March 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 22253 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 14 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510860890 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 31 March 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 971515 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO99 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 31 March 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 22263 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 14 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510860899 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 31 March 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 971515 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO109 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 25 June 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 64204 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 30 June 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863070 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 25 June 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO135 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 25 June 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 18/06/2008 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 64296 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 30 June 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510875546 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 25 June 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO101 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 24618 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863046 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO120 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 24653 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863081 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO122 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 24657 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863085 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO127 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 24662 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863090 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    PO100 < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 7 April 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > < / SNO_ATTRIBUTE1 >
    < > 24585 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 7 April 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863033 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 7 April 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO110 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 25 June 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008/06/11 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 64265 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 30 June 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510863071 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 25 June 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < SNO_CREATED_BY > 1433 < / SNO_CREATED_BY >
    < SNO_REQUEST_ID >-1 < / SNO_REQUEST_ID >
    < VENDOR_LOT_NUM > PO130 < / VENDOR_LOT_NUM >
    < SNO_CREATION_DATE > 25 June 09 < / SNO_CREATION_DATE >
    < SNO_ATTRIBUTE1 > 2008-06-13 00:00:00 < / SNO_ATTRIBUTE1 >
    < > 64275 OBJECT_ID < / OBJECT_ID >
    < INITIALIZATION_DATE > 30 June 09 < / INITIALIZATION_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 6510875487 < / Serial_number >
    < ITEM_CODE > 3000.006 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E016392 < / DESCRIPTION >
    ALLISON < MANUFACTURER > < / MANUFACTURER >
    < APPLICATION > home < / APPLICATION >
    < ITEM_COST > 8879.02 < / ITEM_COST >
    < MATERIAL_COST > 631.09 < / MATERIAL_COST >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > < / PO_UNIT_PRICE >
    < TRANSACTION_RECEIPT_DATE > 25 June 09 < / TRANSACTION_RECEIPT_DATE >
    < PO_NUMBER > 982121 < / PO_NUMBER >
    < / G_ASW_REC_DATE >
    < / LIST_G_ASW_REC_DATE >
    < CF_SORT_BY > manufacturing, the Date of receipt, organization, Code section < / CF_SORT_BY >
    < CF_SERIAL_WHERE > < / CF_SERIAL_WHERE >
    < / RECDTREP >

    HELLO Manu,

    7 April 09
    It is not a date,
    If you need to change the query to get the format to the xsd format: YYYY-MM-ddTHH + hh: mm

    otherwise, you need to write a custom sort function to decode and order it.
    If you make custom order and use

    the data will be processed as a string and you will see that the line is sorted on the channel.

  • Read the data in the first column selected in a multicolumn listbox

    When a line is selected in a ListBox multicolumn (1 point), how can I go on reading the data in the first column?

    The listbox multicolumn itself is the digital picture data type. If you have allowed only 1 point selection and selection mode select any row, it returns the line number. The property node 'Element names' to return a table 2d-chains of the elements in your Inbox. The index of the row to the value of the listbox and column 0. See code attached.

  • How to declare the data type of a column in a select query?

    How can we give the data type of each column on the fly during the selection of rows in a query?

    the cast function converts one data type to another.

    The syntax of the cast function is:

    Cast ({expr |}) (subquery) | (MULTISET (subquery)} AS type_name)

    Select cast (22 August 2003 ' AS varchar2 (30))
    Double;

    Published by: b_ * August 12, 2011 10:08

  • Select data based on the priority of the State

    ID PRO_ID PRO_OBJ_ID TASK_ID DEVELOPER_ID STATUS
    121243 4940 37506 5250 6532 REJECTED
    122063 4940 37506 5250 6532 RELATIVES
    138306 4940 37506 5250 6532 ACCEPTED
    138307 4940 37506 5250 6532 WIP




    Hello

    In the table above, I need to select data based on the State, a status which precedes CLOSE or ACCEPTED it should display all status any State which is after CLOSE or ACCEPTED, we do not consider.


    In the scenioro above, it should display only the status of first three. After having ACCEPTED, it should not display something


    Please suggest me a request how to write.


    Thank you
    Sudhir.

    Try:

    SQL> with t as (
      2  select 121243 id, 4940 pro_id, 37506 pro_obj_id, 5250 task_id, 6532 developer_id, 'REJECTED' status from dual union all
      3  select 122063, 4940, 37506, 5250, 6532, 'CLOSE' from dual union all
      4  select 138306, 4940, 37506, 5250, 6532, 'ACCEPTED' from dual union all
      5  select 138307, 4940, 37506, 5250, 6532, 'WIP' from dual union all
      6  select 138308, 4940, 37506, 5250, 6532, 'ACCEPTED' from dual union all
      7  select 138309, 4940, 37506, 5250, 6532, 'REJECTED' from dual union all
      8  select 121243, 4940, 37777, 5250, 6532, 'REJECTED' from dual union all
      9  select 122063, 4940, 37777, 5250, 6532, 'CLOSE' from dual union all
     10  select 138306, 4940, 37777, 5250, 6532, 'ACCEPTED' from dual union all
     11  select 138307, 4940, 37777, 5250, 6532, 'WIP' from dual union all
     12  select 138308, 4940, 37777, 5250, 6532, 'ACCEPTED' from dual union all
     13  select 138309, 4940, 37777, 5250, 6532, 'WIP' from dual
     14  ) -- actual query starts here:
     15  select t1.id
     16  ,      t1.pro_id
     17  ,      t1.pro_obj_id
     18  ,      t1.task_id
     19  ,      t1.developer_id
     20  ,      t1.status
     21  from   t t1
     22  where id <= (select max(id)
     23               from   t t2
     24               where  t2.status in ( 'ACCEPTED', 'CLOSED' )
     25               and    t1.pro_id = t2.pro_id
     26               and    t1.pro_obj_id = t2.pro_obj_id
     27               and    t1.task_id = t2.task_id
     28               and    t1.developer_id = developer_id
     29               );
    
            ID     PRO_ID PRO_OBJ_ID    TASK_ID DEVELOPER_ID STATUS
    ---------- ---------- ---------- ---------- ------------ --------
        121243       4940      37506       5250         6532 REJECTED
        122063       4940      37506       5250         6532 CLOSE
        138306       4940      37506       5250         6532 ACCEPTED
        138307       4940      37506       5250         6532 WIP
        138308       4940      37506       5250         6532 ACCEPTED
        121243       4940      37777       5250         6532 REJECTED
        122063       4940      37777       5250         6532 CLOSE
        138306       4940      37777       5250         6532 ACCEPTED
        138307       4940      37777       5250         6532 WIP
        138308       4940      37777       5250         6532 ACCEPTED
    
    10 rows selected.
    

    If it works then please provide us with some representative sample data again.

  • Insert as select on a table with 759 columns, including the Vitrual columns

    Dear people,

    DB version: 11.2.0.3.4
    Quality: Production
    Type: 2 node RAC

    Description of the problem: we meet with repeated ORA-00600 when we tried expdp a table as part of the application process. This has later been explored as a logical corruption on the primary key index. Request team works on the deletion and re-creation of the index according to the suggestion of support oracle.
    In the meantime, I tried to copy the table data affected with insert that choose, since exp pump/classic/ETG work or meet the requirement.

    The affected table contains more than 255 columns, to be precise - 757 normal columns and 2 virtual columns, these 2 virtual columns to create a composite subpartition on the table. Subparts are compressed BASIC.

    Since we cannot load the data in a virtual column, I exclude these 2 virtual columns and load data on to rest columns, virtual columns are filled based on the opinions of other 2 columns. The number of columns to select in the insert that is greater than 255, I am not able to load data using sql * more and sql developer, because they cannot manage this huge list of selection.

    SQL * Plus fails with the error "too Long".
    Developer SQL fails with "left/right parenthesis not found."
    I failed to Toad, so I have not tried the same thing, don't know if the TOAD can handle this huge list of selection either.

    My insert would look like below...

    Insert into the target (t1, t2, t3... t757) select (t1, t2, t3... t757) source;

    Can someone give me some directions please?

    Thanks and greetings
    Raja

    You sure have a closing parenthesis at the end of the select statement? This seems to reproduce the error:

    SQL> insert into t1 ( id,
      2  descr,
      3  name)
      4  select (id,
      5  descr,
      6  name
      7* from t
    SQL> /
    select (id,
              *
    ERROR at line 4:
    ORA-00907: missing right parenthesis
    

    You can also remove the opening parens of the select statement, because it is not really necessary.

    John

  • exclude data based on the position

    Hi all

    I use oracle 10g.

    We have a requirement where I need to exclude the data based on the 1st character of a column value.

    A table has a column that contains the varchar value.
    The condition is to exclude all rows where the column begins with an alphabet.

    Example;
     customer table:
    cust_id    cust_name   cust_age
    A123          JOHN            28
    1234         NASH            43
    B345         DEAN            32
    4325         SHAUN          21
    Now I want to select only rows with cust_id = 1234 and 4325 as these 2 is not first character as alphabet.
    There are thousands of row in the table.

    One way is to write all the alphabets as:
      SELECT *
        FROM CUSTOMERS
       WHERE SUBSTR(CUST_ID,1,1) NOT IN ('A','B','C','D',..............'Z');
    But I'm sure there is a better way to do maybe a function that can list all the alphabet or something.

    Kindly tell me how to get this result.

    Kind regards
    Shane
    SELECT *
    FROM CUSTOMERS
    WHERE NOT regexp_like(cust_id, '^[A-Z]');
    

    Published by: thomas.kellerer on August 11, 2009 02:08

  • Try an example date-based pivot

    Well, I spent the last few hours several looking at examples on how to convert data based on columns. I know what I want and what I have - I hope some of you kind, experienced can help me bridge the gap.

    What we try to do is run an employee performance evaluation. Every day an employee works, we count the number of hours that he/she works (and Yes, if there is no sheet we assume zero hour). What I have to do is to get a report that indicates a period of time (I convinced the boss to go in every two weeks for the coding of sake to avoid an undetermined number of columns). What I want to do, is take the data that looks like this:
    EMP_ID  TASK_HRS  EQ_HRS  DATE_INDEX
    87074     4     4     10-MAR-09
    80111     12     7     20-MAR-09
    80387     12     8     20-MAR-09
    80244     12     11     20-MAR-09
    81572     11.75     6     20-MAR-09
    87010     12     8.1     20-MAR-09
    81547     12     5.8     20-MAR-09
    84444     12     3     20-MAR-09
    80255     12     11     20-MAR-09
    80257     12     6     20-MAR-09
    84242     12     9     21-MAR-09
    and turn it into this:
    EMP_ID   20-MAR-09   21-MAR-09   22-MAR-09  ...   03-APR-09
    80111      12                   11                12.5    ...         11
    87010      12                    0                 11.5    ...         12
    ...
    For now, ignore the EQ_HRS column.

    At the end of the day, I will use the number of hours to generate a productivity rating based on other information of another view, but if I could get this far, the rest would be pretty straighforward. The part that I can't find a good explanation on how is generating the query to count the lines that pivots in the columns. I can see some examples, but I can't grasp the concept of how the pivot that happens. I would appreciate any help/explanation/example that would apply.

    Oh, and I'm on 10g, so I can't take advantage of the PIVOT 11 g feature for now (unfortunately).

    Hello

    This you will get 15 consecutive days, from a setting: start_date

    SELECT    emp_id
    ,       NVL (SUM (CASE WHEN date_index - :start_date = 0 THEN task_hrs END))     AS day_0
    ,       NVL (SUM (CASE WHEN date_index - :start_date = 1 THEN task_hrs END))     AS day_1
    ,       NVL (SUM (CASE WHEN date_index - :start_date = 2 THEN task_hrs END))     AS day_2
    ...
    ,       NVL (SUM (CASE WHEN date_index - :start_date = 15 THEN task_hrs END))     AS day_15
    FROM       table_x
    WHERE       date_index     BETWEEN :start_date
                     AND     :start_date + 14
    GROUP BY  emp_id
    ORDER BY  emp_id;
    

    Here is basically how it works.
    'GROUP BY emp_id' means that you will get a line by emp_id.
    Each of the last 15 columns sums up the task_hrs for a particular day in the range of 15 days. You will never have more than 1 row per employee per day: that is correct. You still need an aggregate as SUM function, because you're grouping BY emp_id.

    In SQL *, you can name the columns dynamically (for example "20 March 09", "21 March 09",..., "April 3 09" "") using variables substitution and COLUMN... NEW_VALUE.

    If date_index is not always midnight, use TRUNC (date_index) above.

    The query above will display only employees who have at least one line in the table in covered time interval.
    If you want to include all employees, even if they have 0 in the daily column, then OUTER JOIN for the employee table (or any table that has one row per emp_id).

    Generating the productivity index will likely be easier on non-dynamic data.

    Published by: Frank Kulash, March 25, 2009 15:01

    Published by: Frank Kulash, March 25, 2009 17:23
    Sorry, I forgot the 2nd argment (0) to NVL. I see you fixed.

  • How do you define a date formula in a column?

    I write the dates of publication for books in my numbers and want to format a column to a single date. This way I can write the date in some way and it would be to convert to the date I selected. For example: the format would, however, on September 1, 2009, I can write 01/09/09 and he would be converted automatically for September 1, 2009. Save me time.

    Select the column, and then open cell formatter:

    then select the format "Date & Time" in the menu "Data Format":

    Now select the details of the date and time:

    until you enter a valid date, the numbers will now apply the formatting that you have selected the dates you enter

  • SQL query * I want to insert a file column in the other table based on two columns

    I want to insert a column records to another table based on two columns

    the query below does not work

    insert into def_ver_lnki_p (job_name)

    Select def_job.job_name

    from def_job where def_job.job_id = def_ver_lnki_p.job_id and def_job.table_id = def_ver_lnki_p.table_id;

    Just to correct sql

    Update

    def_ver_lnki_p define job_name =)

    Select def_job.job_name

    of def_job

    where def_job.job_id = def_ver_lnki_p.job_id

    (and def_job.table_id = def_ver_lnki_p.table_id);

  • Filter the rows based on another column

    Hello

    I have a table like this:

    user_idteamsla_teamrownum
    11one01
    22one02
    33b13
    44b14
    55c3

    5

    I want a list of the first order of 3 users of sla_team.

    If 2 or more users have the same sla_team, must list both of them.

    In this case, I want to return user_id: 11, 22, 33, 44

    A way to do it is like this:

    Select *.

    table

    where sla_team < = (select max (sla_team) in the table where rownum < = 3)

    But my table is bigger and more complex query.

    Any other sugestion?

    Thank you and sorry for my bad English.

    Hello

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    This sounds like a job for a Query of Top - N, like this:

    WITH got_r_num AS

    (

    SELECT table_x. *- or whatever the columns that you want to

    , EVALUATE () DURING (ORDER BY sla_team) AS r_num

    FROM table_x

    -WHERE... - If you need any filtering, put it here

    )

    SELECT *- or the list of all columns except r_num

    OF got_r_num

    WHERE r_num<=>

    ORDER BY r_num

    ;

  • Disable the previous dating date picker in the column in a table

    can someone please help.

    on the date column in a table, need to disable previous dates.

    Current functionality. But when the validation page gets updated and the user is able to select earlier dates.



    To restrict the datePicker for new lines changed the URL of the button 'Add Row '.

    javascript:myAddRow();

    In the page edit, I added this to "Javascript > function and Variable global statement.

    function myAddRow()

    { apex.widget.tabular.addRow();

    $("td[headers='DETAIL_DATE'] input:last")

    .datepicker("option","changeMonth",false)

    .datepicker("option","minDate",$v("P2_MASTER_MONTH_MINDATE"))

    .datepicker("option","maxDate",$v("P2_MASTER_MONTH_MAXDATE")); };

    https://Apex.Oracle.com

    w/u/p: nani5048/test/test

    App 92603 5 page

    Thank you

    Nani

    I created a dynamic action

    the loading of the page

    $("td [en-têtes = 'STATUS_DATE'] entrée")

    . DatePicker ("option", "minDate", $v ("P5_MASTER_MONTH_MINDATE"));

    as well as the global javascript function

    function myAddRow() {}

    apex.widget.tabular.addRow ();

    $("td [en-têtes = 'STATUS_DATE'] entrée")

    . DatePicker ("option", "minDate", $v ("P5_MASTER_MONTH_MINDATE"));

    }

Maybe you are looking for

  • my browser.newtab.url keeps returning to the time where I change it

    I want to open my new tabs as my homepage to google, but when I change the browser.newtab.url on www.google.com , it comes back to what it was before every time I close firefox.Can someone help me?

  • my firefox crashes for no apparent reason

    my firefox crashes for no apparent reasonthe crash report says:EMPTY: no thread crash has been identified; dump corruptedthe report of the accident itself http://crash-stats.Mozilla.com/report/index/BP-715dc850-c4c1-42ee-ACD9-d8ba12120903

  • repeated no reliable connection to gmail

    Recently I deleted my entire browsing history and cache. Now I get "Untrusted connection" when you try to connect to my gmail accounts. But I don't think that's true.

  • Drive HARD Canvio 3.0 capabilities

    I'm trying 3 different computers, each with their own operating system image (WIN: XP, VISTA, 7.0), using a Canvio 3.0 (750 GB) HARD drive. Trying from the 2nd computer image, I get an alert that if I continue, the first image of PC will be crushed..

  • Where to find Win XP 64 bit for the Satellite M305D-S4830 energy management/conservation

    I was able to completely load Windows XP 64-bit on my Satellite M305D-S4830 with all the drivers.Everything is great except my battery only lasts is not too long to work. I've searched but have not been able to find a working copy of Toshiba Power Sa