Display data with sql

Hello

create TABLE EMP ( )

Emp_id NUMBER ,

DATE of DT_FROM ,

DATE of DT_TO ,

CREATE_DATE DATE)

into EMP

(ID_EMP, DT_FROM, DT_TO, CREATE_DATE)


Values


()100 TO_DATE (March 1, 2001 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (June 30, 2001 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (1 May 2001 05:44:20 ', ' MM/DD/YYYY HH24:MI:SS '));



into EMP


()Emp_id DT_FROM DT_TO CREATE_DATE( )


Values


()100 TO_DATE (1 July 2008 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (April 30, 2012 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (May 8, 2009 14:11:21 ', ' MM/DD/YYYY HH24:MI:SS '));



into EMP


(ID_EMP, DT_FROM, DT_TO, CREATE_DATE)


Values


()100 TO_DATE (1 June 2008 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (April 30, 2012 00:00:00 ', "MM/DD/YYYY HH24:MI:SS"), TO_DATE (June 26, 2009 15:48:15 ', ' MM/DD/YYYY HH24:MI:SS '));



into EMP


(ID_EMP, DT_FROM, DT_TO, CREATE_DATE)


Values


()100 TO_DATE (September 30, 2012 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (September 30, 2012 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (September 28, 2012 17:13:52 ', ' MM/DD/YYYY HH24:MI:SS '));



into EMP


(ID_EMP, DT_FROM, DT_TO, CREATE_DATE)


Values


()100 TO_DATE (October 1, 2012 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (30 April 2013 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (December 14, 2012 11:42:15 ', ' MM/DD/YYYY HH24:MI:SS '));



into EMP


(ID_EMP, DT_FROM, DT_TO, CREATE_DATE)


Values


()100 TO_DATE (31 May 2013 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (31 May 2013 00:00:00 ', ' MM/DD/YYYY HH24:MI:SS '), TO_DATE (May 8, 2013 13:26:30 ', ' MM/DD/YYYY HH24:MI:SS '));




expected results:




DT_FROM DT_TO

                 03 / 01 / 2001           06/30/2001



                 06 / 01 / 2008           04/30/2012



                 09 / 30 / 2012           09/30/2012



                 10 / 01 / 2012           04/30/2013



                 05 / 31 / 2013           05/31/2013




reason for with the exception of the the 1 July 2008 ' line is there is another line with less dt_from value that was created after this line created. If there is a sub sequent row


less dt_from value and latest creation date we need to get that line and exclude the lines as over a.

Thank you

Hello

So, you need to know if there is a previous dt_from on a line more later (where 'later' is determined by create_date).  This sounds like a job for the analytical MIN function:

WITH got_min_dt_from AS

(

SELECT dt_from, dt_to

, MIN (dt_from) over (PARTITION BY emp_id - just guessing

ORDER BY DESC create_date

) AS min_dt_from

WCP

)

SELECT dt_from, dt_to

OF got_min_dt_from

WHERE dt_from = min_dt_from

ORDER BY dt_from

;

Emp_id play a role in this problem?  It is difficult to say when all the rows of the data sample has the same value.

Tags: Database

Similar Questions

  • Query to display data with total

    Hi team,

    I have the whee requirement I need to display data with total and the total general.

    Examples of data include:

    with t as 
    (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual
    union all
    select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual
    )
    select * from t 
    

    Need the output like below format

    Chris FT 10 PF Reg 02/05/2014 2456 10 50 55 60

    Chris FT 10 Reg 10/06/2014 1000 PF 30 50 55 60

    Chris 10 FT PF NonReg 10/06/2014 20 - 5 1 1 1

    5456 35 101 111 121 subtotal

    John PT PF Reg 02/05/2014 1153 11 10 50 55 60

    John PT Reg 16/05/2014 1000 PF 11 8 40 45 50

    2153 18 90 100 110 subtotal

    7609 total 53 191 211 231

    Could you please give some thought to get the result as above.

    Thank you!

    something like this:

    with t as (select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)

    Union of all the

    Select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double

    Union of all the

    Select "chris" nm, 10 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double

    )

    SELECT decode (REUNION (nm), 1, 'Total', decode (grouping (State), 1, "partial": nm, nm)) nm

    , no, emplmt, profund, status, dt, sum (sal), sum (days), sum (intrst), sum (intrs1), sum (intrs2)

    T

    Rollup Group (nm, (no, emplmt, profund, status, dt));

    HTH

  • Member not found when loading data with SQL

    Hello everyone:

    I created a cube map extract all information with SQL statements and it works perfectly. Now I'm trying to load data in the same way, but I can't.

    I created a view that returns data in this format:

    Dimension 1 < tab > axis 2 < tab > member... Member of dimension 5 < tab > measure 1 < tab > 2 < tab > measure 3

    I designed a new rule, indicating for each column in the dimension; and for each measure which specific member of dimension of accounts must be used. I have check and everything is ok, but when I try to load data, it does not work and tells me error:

    + "Data value [3.5] met before that all the selected Dimensions, [1] Records duly filled.
    + Essbase error unexpected 1003007 "+"

    If I get the names of the members with quotes (because they contain spaces, and it is perhaps the reason for the previous error, although the rule analysis correctly) with the SQL statement, when Essbase import, it deletes these quotes. I must use another symbol, and as a rule change this another symbol quotes. Is this normal? I know that this issue when importing formulas, but not here.

    Why in 'Dimension building' I don't have this problem with quotes?

    And when changing the symbols of quotes, this error occurs:

    + "Member x not found in the database" +. " But I check the Member and there are in general terms. What's wrong with that? »


    Thanks in advance

    Concerning

    Javier

    Published by: Javi M on 26-mar-2011 05:52

    Yes, the SQL files and data (of all kinds) are supported by more than one column of data. As you noted, you just point to the Member that represents the column.

    That said, I bet that if you look at your view/table and load the rule against your outline, I bet you find a dimension be mismapped, for example, you think that this column 4 points to the scenario, but you really repointe it produces and which purported to be the column 1, or you missed a dimension. Happens to me all the time.

    Kind regards

    Cameron Lackpour

  • I want to display date with day between sysdate to a date later one in sql

    SYSDATE to 21/09/2014

    It should display as

    @@@

    wednessday 08/06/2014

    Thursday 08/07/2014

    08/08/2014 Friday

    Saturday 08/09/2014

    .

    .

    .

    .

    .

    .

    .

    21/09/2014 Sunday

    SQL> select sysdate + (level-1) dt
      2       , to_char(sysdate + (level-1), 'fmDay') dt_day
      3    from dual
      4  connect by level <= to_date('21-09-2014', 'dd-mm-yyyy') - sysdate + 1;
    
    DT        DT_DAY
    --------- ---------
    06-AUG-14 Wednesday
    07-AUG-14 Thursday
    08-AUG-14 Friday
    09-AUG-14 Saturday
    10-AUG-14 Sunday
    11-AUG-14 Monday
    12-AUG-14 Tuesday
    13-AUG-14 Wednesday
    14-AUG-14 Thursday
    15-AUG-14 Friday
    16-AUG-14 Saturday
    17-AUG-14 Sunday
    18-AUG-14 Monday
    19-AUG-14 Tuesday
    20-AUG-14 Wednesday
    21-AUG-14 Thursday
    22-AUG-14 Friday
    23-AUG-14 Saturday
    24-AUG-14 Sunday
    25-AUG-14 Monday
    26-AUG-14 Tuesday
    27-AUG-14 Wednesday
    28-AUG-14 Thursday
    29-AUG-14 Friday
    30-AUG-14 Saturday
    31-AUG-14 Sunday
    01-SEP-14 Monday
    02-SEP-14 Tuesday
    03-SEP-14 Wednesday
    04-SEP-14 Thursday
    05-SEP-14 Friday
    06-SEP-14 Saturday
    07-SEP-14 Sunday
    08-SEP-14 Monday
    09-SEP-14 Tuesday
    10-SEP-14 Wednesday
    11-SEP-14 Thursday
    12-SEP-14 Friday
    13-SEP-14 Saturday
    14-SEP-14 Sunday
    15-SEP-14 Monday
    16-SEP-14 Tuesday
    17-SEP-14 Wednesday
    18-SEP-14 Thursday
    19-SEP-14 Friday
    20-SEP-14 Saturday
    
    46 rows selected.
    
    SQL>
    
  • PDM Viewer do not display data with time stamp

    Need help with the timestamp of the data in a PDM file generated by the DAQ Assistant.

    When I use the PDM Viewer, with x the value absolute time scale, the date starts in 1903. If I use Excel to look at the file that the start time is correct (i.e. 2013).

    Bo_Xie, I simplified my VI and now able to display the correct time stamp. Thanks for your time!

  • MEV: Display data in sql developer

    Hello

    We have SRM policies on all of our tables. If we define a package variable in our session and query a table in sql sheet I see all relevant data.

    Is it possible to display the data in when I browse through the tables in the tree?

    This is a new session, I presume.

    I don't want a logon trigger on.

    Best regards Erik

    The sql worksheet and object editors share a session, what you do in the spreadsheet must apply to the drafting of the table - unless you use a spreadsheet not shared.

  • Loading data with sql loader

    Hi Experts,

    I have a file in the following format. I have to insert the data from these files in a table. Can I use SQL Loader to load these files.

    My question is that I need to schedule the download of these files. Can I integrate sql loader in a procedure?
    Agent Id|Agent Type|Create Date|Termination CDC|Activation CDC|Deactivation CDC|Agent IdX|Agent Status|Status Date|Status Reason Code|Update CDC|Update Serial|Update User|New Owner Agent Id|Previous Owner Agent Id|Agent Name|Primary Address1|Primary Address2|Primary Address3|Secondary Address1|Secondary Address2|Secondary Address3| Primary City|Primary State|Primary Zip|Primary Zip Suffix|Primary Country|Secondary City|Secondary State|Secondary Zip|Secondary Zip Suffix|Secondary Country|Phone Number|Fax number|Mobile Number|Business Type|Field Rep|Bill to Chain Id|Mon Open Time|Mon Close Time|Tue Open Time|Tue Close Time|Wed Open Time|Wed Close Time|Thu Open Time|Thu Close Time|Fri Open Time|Fri Close Time|Sat Open Time|Sat Close Time|Sun Open Time|Sun Close Time|Zone Id|Line Charge Class|Chain Id|Chain Code| Primary Contact  Name| Primary Contact Title| Primary Contact Phone|Secondary Contact Name|Secondary Contact Title|Secondary Contact Phone|Tertiary contact Name|Tertiary Contact Title|Tertiary Contact Phone| Bank Id| Bank Account Id| bank Account Type| Bank Account Date| EFT Flag| Fund Limit|Invoicable|TaxCode|Tax Id|Sales Tax|Service Charge|Instant Cashing Type|Instant Telsel Rep| Instant Number of Bins| Instant Number Itvms| InstantCredit Limit|Auto Reorder| Instant Terminal Reorder| Instant Telsel Reorder| Instant Teleset Active CDC| Instant Initial Distribution|Auto Telsel Schedule| Instant Auto Settle| Instant Call Day| Instant Call Week| Instant Call Cycle| Instant Order Restriction| Instant Delivery Flag| Instant Account Type| Instant Settle Class| Region|County|Territory|Route|Chain Statement|Master Agent Id| Minority Owned| Tax Name| State Tax Id|Mailing Name| Bank Account Name| DSR
    0|1|0|0|0|0|0|1|0|0|302|0|0|0|0|||||||||||||||||||||0|0|0|||||||||||||||0|0|0|||||||||||||0|-2145916800|0|0|0|0||0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0||0|0|0|||||
    1|1|1256213087|0|-39081|-39081|1|2|1256213087|999|302|0|0|0|0|Pseudo Outlet||||||||MU|||MU||MU|||MU||||0|0|1|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|0|0|0|||||||||||||
    {code)
    
    Edited by: Kevin CK on 02-Feb-2010 03:28                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Here you go...

    drop table agent_dump_csv_temp
    /
    
    create table agent_dump_csv_temp
      (Agent_Id                   NUMBER
      ,Agent_Type                 NUMBER
      ,Create_Date                NUMBER
      ,Termination_CDC            NUMBER
      ,Activation_CDC             NUMBER
      ,Deactivation_CDC           NUMBER
      ,Agent_IdX                  NUMBER
      ,Agent_Status               NUMBER
      ,Status_Date                NUMBER
      ,Status_Reason_Code         NUMBER
      ,Update_CDC                 NUMBER
      ,Update_Serial              NUMBER
      ,Update_User                NUMBER
      ,New_Owner_Agent_Id         NUMBER
      ,Previous_Owner_Agent_Id    NUMBER
      ,Agent_Name                 VARCHAR2(50)
      ,Primary_Address1           VARCHAR2(50)
      ,Primary_Address2           VARCHAR2(50)
      ,Primary_Address3           VARCHAR2(50)
      ,Secondary_Address1         VARCHAR2(50)
      ,Secondary_Address2         VARCHAR2(50)
      ,Secondary_Address3         VARCHAR2(50)
      ,Primary_City               VARCHAR2(50)
      ,Primary_State              VARCHAR2(50)
      ,Primary_Zip                VARCHAR2(50)
      ,Primary_Zip_Suffix         VARCHAR2(50)
      ,Primary_Country            VARCHAR2(50)
      ,Secondary_City             VARCHAR2(50)
      ,Secondary_State            VARCHAR2(50)
      ,Secondary_Zip              VARCHAR2(50)
      ,Secondary_Zip_Suffix       VARCHAR2(50)
      ,Secondary_Country          VARCHAR2(50)
      ,Phone_Number               VARCHAR2(50)
      ,Fax_number                 VARCHAR2(50)
      ,Mobile_Number              VARCHAR2(50)
      ,Business_Type              NUMBER
      ,Field_Rep                  NUMBER
      ,Bill_to_Chain_Id           NUMBER
      ,Mon_Open_Time              VARCHAR2(5)
      ,Mon_Close_Time             VARCHAR2(5)
      ,Tue_Open_Time              VARCHAR2(5)
      ,Tue_Close_Time             VARCHAR2(5)
      ,Wed_Open_Time              VARCHAR2(5)
      ,Wed_Close_Time             VARCHAR2(5)
      ,Thu_Open_Time              VARCHAR2(5)
      ,Thu_Close_Time             VARCHAR2(5)
      ,Fri_Open_Time              VARCHAR2(5)
      ,Fri_Close_Time             VARCHAR2(5)
      ,Sat_Open_Time              VARCHAR2(5)
      ,Sat_Close_Time             VARCHAR2(5)
      ,Sun_Open_Time              VARCHAR2(5)
      ,Sun_Close_Time             VARCHAR2(5)
      ,Zone_Id                    NUMBER
      ,Line_Charge_Class          NUMBER
      ,Chain_Id                   NUMBER
      ,Chain_Code                 NUMBER
      ,Primary_Contact_Name       VARCHAR2(50)
      ,Primary_Contact_Title      VARCHAR2(50)
      ,Primary_Contact_Phone      VARCHAR2(50)
      ,Secondary_Contact_Name     VARCHAR2(50)
      ,Secondary_Contact_Title    VARCHAR2(50)
      ,Secondary_Contact_Phone    VARCHAR2(50)
      ,Tertiary_contact_Name      VARCHAR2(50)
      ,Tertiary_Contact_Title     VARCHAR2(50)
      ,Tertiary_Contact_Phone     VARCHAR2(50)
      ,Bank_Id                    NUMBER
      ,Bank_Account_Id            NUMBER
      ,Bank_Account_Type          NUMBER
      ,Bank_Account_Date          NUMBER
      ,EFT_Flag                   NUMBER
      ,Fund_Limit                 NUMBER
      ,Invoicable                 NUMBER
      ,TaxCode                    NUMBER
      ,Tax_Id                     NUMBER
      ,Sales_Tax                  NUMBER
      ,Service_Charge             NUMBER
      ,Instant_Cashing_Type       NUMBER
      ,Instant_Telsel_Rep         NUMBER
      ,Instant_Number_of_Bins     NUMBER
      ,Instant_Number_Itvms       NUMBER
      ,InstantCredit_Limit        NUMBER
      ,Auto_Reorder               NUMBER
      ,Instant_Terminal_Reorder   NUMBER
      ,Instant_Telsel_Reorder     NUMBER
      ,Instant_Teleset_Active_CDC NUMBER
      ,Instant_Initial_Distribution NUMBER
      ,Auto_Telsel_Schedule       NUMBER
      ,Instant_Auto_Settle        NUMBER
      ,Instant_Call_Day           NUMBER
      ,Instant_Call_Week          NUMBER
      ,Instant_Call_Cycle         NUMBER
      ,Instant_Order_Restriction  NUMBER
      ,Instant_Delivery_Flag      NUMBER
      ,Instant_Account_Type       NUMBER
      ,Instant_Settle_Class       NUMBER
      ,Region                     NUMBER
      ,County                     NUMBER
      ,Territory_x                NUMBER
      ,Route                      NUMBER
      ,Chain_Statement            NUMBER
      ,Master_Agent_Id            NUMBER
      ,Minority_Owned             NUMBER
      ,Tax_Name                   VARCHAR2(50)
      ,State_Tax_Id               NUMBER
      ,Mailing_Name               VARCHAR2(50)
      ,Bank_Account_Name          VARCHAR2(50)
      ,DSR                        NUMBER
      )
      ORGANIZATION EXTERNAL (
       TYPE oracle_loader
        DEFAULT DIRECTORY TEST_DIR
        ACCESS PARAMETERS (
          RECORDS DELIMITED BY NEWLINE
          SKIP 1
          BADFILE 'test.bad'
          DISCARDFILE 'test.dis'
          LOGFILE 'test.log'
          FIELDS TERMINATED BY '|'
          MISSING FIELD VALUES ARE NULL
          REJECT ROWS WITH ALL NULL FIELDS
            (Agent_Id
            ,Agent_Type
            ,Create_Date
            ,Termination_CDC
            ,Activation_CDC
            ,Deactivation_CDC
            ,Agent_IdX
            ,Agent_Status
            ,Status_Date
            ,Status_Reason_Code
            ,Update_CDC
            ,Update_Serial
            ,Update_User
            ,New_Owner_Agent_Id
            ,Previous_Owner_Agent_Id
            ,Agent_Name
            ,Primary_Address1
            ,Primary_Address2
            ,Primary_Address3
            ,Secondary_Address1
            ,Secondary_Address2
            ,Secondary_Address3
            ,Primary_City
            ,Primary_State
            ,Primary_Zip
            ,Primary_Zip_Suffix
            ,Primary_Country
            ,Secondary_City
            ,Secondary_State
            ,Secondary_Zip
            ,Secondary_Zip_Suffix
            ,Secondary_Country
            ,Phone_Number
            ,Fax_number
            ,Mobile_Number
            ,Business_Type
            ,Field_Rep
            ,Bill_to_Chain_Id
            ,Mon_Open_Time
            ,Mon_Close_Time
            ,Tue_Open_Time
            ,Tue_Close_Time
            ,Wed_Open_Time
            ,Wed_Close_Time
            ,Thu_Open_Time
            ,Thu_Close_Time
            ,Fri_Open_Time
            ,Fri_Close_Time
            ,Sat_Open_Time
            ,Sat_Close_Time
            ,Sun_Open_Time
            ,Sun_Close_Time
            ,Zone_Id
            ,Line_Charge_Class
            ,Chain_Id
            ,Chain_Code
            ,Primary_Contact_Name
            ,Primary_Contact_Title
            ,Primary_Contact_Phone
            ,Secondary_Contact_Name
            ,Secondary_Contact_Title
            ,Secondary_Contact_Phone
            ,Tertiary_contact_Name
            ,Tertiary_Contact_Title
            ,Tertiary_Contact_Phone
            ,Bank_Id
            ,Bank_Account_Id
            ,Bank_Account_Type
            ,Bank_Account_Date
            ,EFT_Flag
            ,Fund_Limit
            ,Invoicable
            ,TaxCode
            ,Tax_Id
            ,Sales_Tax
            ,Service_Charge
            ,Instant_Cashing_Type
            ,Instant_Telsel_Rep
            ,Instant_Number_of_Bins
            ,Instant_Number_Itvms
            ,InstantCredit_Limit
            ,Auto_Reorder
            ,Instant_Terminal_Reorder
            ,Instant_Telsel_Reorder
            ,Instant_Teleset_Active_CDC
            ,Instant_Initial_Distribution
            ,Auto_Telsel_Schedule
            ,Instant_Auto_Settle
            ,Instant_Call_Day
            ,Instant_Call_Week
            ,Instant_Call_Cycle
            ,Instant_Order_Restriction
            ,Instant_Delivery_Flag
            ,Instant_Account_Type
            ,Instant_Settle_Class
            ,Region
            ,County
            ,Territory_x
            ,Route
            ,Chain_Statement
            ,Master_Agent_Id
            ,Minority_Owned
            ,Tax_Name
            ,State_Tax_Id
            ,Mailing_Name
            ,Bank_Account_Name
            ,DSR
          )
        )
        LOCATION ('test.txt')
      )
      PARALLEL
     REJECT LIMIT UNLIMITED
    /
    
    SQL> select * from agent_dump_csv_temp
      2  /
    
      AGENT_ID AGENT_TYPE CREATE_DATE TERMINATION_CDC ACTIVATION_CDC DEACTIVATION_CDC  AGENT_IDX AGENT_STATUS STATUS_DATE STATUS_REASON_CODE UPDATE_CDC UPDATE_SERIAL UPDATE_USER NEW_OWNER_AGENT_ID PREVIOUS_OWNER_AGENT_ID
    ---------- ---------- ----------- --------------- -------------- ---------------- ---------- ------------ ----------- ------------------ ---------- ------------- ----------- ------------------ -----------------------
    AGENT_NAME                                         PRIMARY_ADDRESS1                                   PRIMARY_ADDRESS2                                   PRIMARY_ADDRESS3
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_ADDRESS1                                 SECONDARY_ADDRESS2                                 SECONDARY_ADDRESS3                                 PRIMARY_CITY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_STATE                                      PRIMARY_ZIP                                        PRIMARY_ZIP_SUFFIX                                 PRIMARY_COUNTRY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_CITY                                     SECONDARY_STATE                                    SECONDARY_ZIP                                      SECONDARY_ZIP_SUFFIX
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_COUNTRY                                  PHONE_NUMBER                                       FAX_NUMBER                                         MOBILE_NUMBER                                      BUSINESS_TYPE  FIELD_REP BILL_TO_CHAIN_ID
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------- ---------- ----------------
    MON_O MON_C TUE_O TUE_C WED_O WED_C THU_O THU_C FRI_O FRI_C SAT_O SAT_C SUN_O SUN_C    ZONE_ID LINE_CHARGE_CLASS   CHAIN_ID CHAIN_CODE PRIMARY_CONTACT_NAME                               PRIMARY_CONTACT_TITLE
    ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---------- ----------------- ---------- ---------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_CONTACT_PHONE                              SECONDARY_CONTACT_NAME                             SECONDARY_CONTACT_TITLE                            SECONDARY_CONTACT_PHONE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    TERTIARY_CONTACT_NAME                              TERTIARY_CONTACT_TITLE                             TERTIARY_CONTACT_PHONE                                BANK_ID BANK_ACCOUNT_ID BANK_ACCOUNT_TYPE BANK_ACCOUNT_DATE   EFT_FLAG FUND_LIMIT INVOICABLE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------- --------------- ----------------- ----------------- ---------- ---------- ----------
       TAXCODE     TAX_ID  SALES_TAX SERVICE_CHARGE INSTANT_CASHING_TYPE INSTANT_TELSEL_REP INSTANT_NUMBER_OF_BINS INSTANT_NUMBER_ITVMS INSTANTCREDIT_LIMIT AUTO_REORDER INSTANT_TERMINAL_REORDER INSTANT_TELSEL_REORDER INSTANT_TELESET_ACTIVE_CDC
    ---------- ---------- ---------- -------------- -------------------- ------------------ ---------------------- -------------------- ------------------- ------------ ------------------------ ---------------------- --------------------------
    INSTANT_INITIAL_DISTRIBUTION AUTO_TELSEL_SCHEDULE INSTANT_AUTO_SETTLE INSTANT_CALL_DAY INSTANT_CALL_WEEK INSTANT_CALL_CYCLE INSTANT_ORDER_RESTRICTION INSTANT_DELIVERY_FLAG INSTANT_ACCOUNT_TYPE INSTANT_SETTLE_CLASS     REGION     COUNTY TERRITORY_X
    ---------------------------- -------------------- ------------------- ---------------- ----------------- ------------------ ------------------------- --------------------- -------------------- -------------------- ---------- ---------- -----------
         ROUTE CHAIN_STATEMENT MASTER_AGENT_ID MINORITY_OWNED TAX_NAME                                        STATE_TAX_ID MAILING_NAME                                          BANK_ACCOUNT_NAME                                 DSR
    ---------- --------------- --------------- -------------- -------------------------------------------------- ------------ -------------------------------------------------- -------------------------------------------------- ----------
             0          1           0               0              0                0          0            1       0                      0        302             0           0                  0                       0
    
                                                                                                                                                                                                                    0          0                0
                                                                                                 0                 0          0
    
                                                                                                                                                                                                0        -2.146E+09          0          0          0
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                          0
                               0                    0                   0                1                 0          0                         0                     0                    0                    0          0          0           0
                             0               0              0
    
             1          1  1256213087               0         -39081           -39081          1            2  1256213087                999        302             0           0                  0                       0
    Pseudo Outlet
    
    MU                                                                                                                                               MU
                                                       MU
    MU                                                                                                                                                                                                       0         0                1
    06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59          0              0     0
    
                                                                                                                                                                                                1        -2.146E+09          1          0          1
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                      -3287
                               0                    0                   0                1                 1          2                         0                     0                    0                    1          0        999           0
                             5               0              0
    
    SQL>
    

    He dislikes the identifier 'territory', so I renamed it to "territory_x" (I guess that's a reserved word).
    Your initial problem you had was your fields "SEPARATED"... instead of "TERMINATED" by. ;)

  • color change for data with sql developer

    I recently saw a few changed the parameter SQL developer to show some color for cells that contain null values. Cannot find where to set this property. Does anyone know how a color of a cell with nulls in default SQL Developer?

    -app

    Go to tools | Preferences | Database | Advanced. There is an option to set the background color set to null.

    Ashley
    SQL development team

  • export data with SQL-plus

    I have a table like this

    Column1 | Column2
    ----------------
    one | -2147483646
    b | -2147483638
    c | -2147483656
    d | -2147483651


    I exported the information with this script:
    SET LINESIZE 50
    termout off Set
    topic on the value
    set pagesize 1000
    NEWPAGE 0 VALUE
    coil outfile.txt

    @query.txt 4

    spool off
    Set termout on


    all values in column2 will be displayed as -2, 147F + 09

    How to display the actual value (without rounding, or as if it were a string)?

    You do not specify what is in your query.txt script, but assuming that it is something like select * from your table. You can use something like

    SET LINESIZE 50
    set termout off
    set heading on
    set pagesize 1000
    SET NEWPAGE 0
    column column2 format 9999999999
    spool outfile.txt
    

    LW

  • 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
  • How always display the date with taskbar buttons activated in widows 8?

    It's got to be average, just to be there. Even using the buttons small taskbar, it is actually enough space to have always the date and stacked. I would be well with them, next to each other also. I don't really understand why the date masks even as it would fit really well. I'm fine with the help of a third party program if necessary. I already have the classic interface installed because microsoft somehow forgot to add the menu start Windows 8.

    There are several strange suggestions and wonderful here for you to play with.  Make sure that you first create a system restore point.

    Windows 7 - display date using small icons
    http://superuser.com/questions/89628/Windows-7-display-date-using-small-icons

    http://www.Google.com.au/search?q=use+small+taskbar+but+have+date+and+time&SourceID=IE7&RLS=com.Microsoft:-to THE: IE-address & ie = & oe = & gws_rd = cr & redir_esc = & ei = 4L7sUaPiKKWSiQe2_IFQ

  • Encapsulate data problems when loading with sql loader

    Hi all

    I use sql loader to load data into a flat file HP UNIX.

    I find the fi the NUMBER data type or date type get wraped to the new line, the control file triggered errors.

    The data looks like to (field dilimiter is |, record dilimter is ~):

    1 A87CCH | 1 A87CCH | PLAN_ACCOUNT_PROMOTION | HIR6A-1 | 20100706 06:06:24 | 1 DNE1 | DC?
    2010.7 FY1011 Promoiton | 1 A87AW0 | 1 HJEZE | Private | 20100730 00:00:00 | 00 20100710
    : 00:00 | 0 | Completed | 20100730 00:00:00 | 20100710 00:00:00 | 0 | 1 4A6PKP | TFMAAI | N
    | 0 | 0 | 0 | 0 | 0 | 0 | 1 4A6PKP | Approved | 1 8U4E-163 | 00:00:20110630 00 |
    20100708 01:45:35 | 20100707 00:00:00 | -1||| 0 | 9000 | 0 | 0 ||| 100. N | 0 | 0 | 0 | 0
    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | N | 20110426 04:01:34 | 1 8U4E-163 | 0|||||||||
    ||||| ~


    The control file looks like:

    OPTIONS (ERRORS = 1000, DIRECT = TRUE, PARALLEL = TRUE, DATE_CACHE = 5000, discardmax = 50)
    UNRECOVERABLE
    load data
    INFILE ' / home/bs7822/leon/leon.dat' "str" ~ "»
    BADFILE ' / home/bs7822/leon/leon.bad'
    DISCARDFILE ' / home/bs7822/leon/leon.discard'
    ADD THE LEON_123456 TABLE
    FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY "" "
    TRAILING NULLCOLS
    (
    X_INTERFACED_DT EXPRESSION "to_date (replace (replace (: X_INTERFACED_DT_BF, chr (10),"), Chr (13), "), 'YYYYMMDD hh24:mi:ss')", "
    X_INTERFACED_DT_BF boundfiller,
    EXTERNAL DECIMAL X_ACCRUAL_AMT,
    X_PLAN_SHIPMENT_PATTERN_ID TANK (90)
    )

    I think that replace it can treat the wrapped date. But I want to know if we can find a faster or easier way to conquer this topic since the beginning.

    Best regards

    Leon

    user12064076 wrote:
    Thank you for your response. But how to ensure that a record is in a single line? For example, to unload data with coil?

    The table has more than 100 columns.

    Best regards
    Leon

    UH... which guarantee is implemented by anyone or anything that generates the data in the first place.
    for example if I am extracting data to CSV for a customer or another application, making sure that it is 1 card per line with delimiters known etc.

    What is your own code that produces the data in the first place? If so, how are you to produce? With large amounts of data I wouldn't do it with SQL * Plus spool command, but I do with UTL_FILE within PL/SQL, or generating data in a file CLOB and spell the CLOB in a go using one of the CLOB methods available writing files.

  • Excerpt from SQL data with specific format.

    All,

    I have the oracle database version 10.2.0.4 in which I need to extract data from a table using the format below.

    1.1 st 3 positions of the postal code, followed by
    2.1 st letter of the name, followed by
    3.1 st 2 consonants in the name of the street, followed
    4 2 (for companies)

    I can use the function substr to 1 and 2 above.
    For 3, I tried regexp_substr. but the output includes vowels too. I don't know how to proceed. Is there another function or is there another way to do it?

    I am concatenating 3 columns and display data as below.
    for example
    Col1            Col2         Col3     
    FLOOR INC  24540       67 FRANKLIN TPKE STE 114 
    
    Displayed as 
    245FFR2     
    234AAS2 
    Help, please.
    -- testdata:
    with yourtable as
    (
      select 'abcdefg' name from dual union all
      select '1aBexea' name from dual
    )
    -- query for first two consonants:
    select substr(regexp_replace(regexp_replace(name,'[^a-zA-Z]',''),'[aeiouAEIOU]',''),1,2)
    from yourtable;
    

    Explanation:
    -Internal Regexp removes everything except the letters.
    -Outer Regexp removes vowals and keep the consonants.
    -substr selects the first two consonants.

  • Display different data with CSV

    Hello

    How can I build a query to separate the data with csv, but show me only the distinct records

    SQL>  SELECT t1.cd_usuario||','||t1.cd_usuario_cc usuarios
      2    FROM sibtb_usuario_email t1;
     
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    upisergi,udoaldir,ubaemers
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    ukagisle,udoaldir
    usisheil,ureanacl,usomaris
    ureanacl,
    usisheil,udoaldir,ujuhelio,ujujulio,ufinilo
    I woudld like show only, each record in each line
        ukagisle
        udoaldir
        upisergi
        ukagisle
        usisheil
        ureanacl
        usomaris
        ujuhelio
        ujujulio
        ufinilo
       
    Is it possible to do so, by using ORACLE 9.2.02

    TIA

    Like this?

    With T as(
    SELECT distinct t1.cd_usuario||','||t1.cd_usuario_cc||',' usuarios
    FROM sibtb_usuario_email t1
    )
    select distinct usuarios from (
         select
         case when no=1 then
              substr(usuarios, 1,instr(usuarios,',')-1)
         else
              substr(usuarios,instr(usuarios,',',1,no-1)+1,(instr(usuarios,',',1,no)-instr(usuarios,',',1,no-1))-1)
         end usuarios
         from t
         cross join
         (
              select level no
              from (select max((length(usuarios)-length(replace(usuarios,',')))+1) len from t)
              connect by level <= len
         )
    )
    where trim(usuarios) is not null
    /
    
    USUARIOS
    ---------------------------------------------
    usisheil
    ujujulio
    upisergi
    udoaldir
    ureanacl
    ukagisle
    ubaemers
    usomaris
    ujuhelio
    ufinilo
    
    10 rows selected.
    
    Elapsed: 00:00:00.07
    

    HTH,
    Prazy

    Published by: Prazy on April 28, 2010 18:33
    In SQL format... Looked clumsy *.<>

  • Display data in the report to pl/sql

    I need to display data in a report using pl/sql.

    The structure of the table would be fixed, but the data it would come from a pl/sql.

    Is this possible in Apex 3.2.1 for that? If so, how can we do this?

    Hi Hozy,

    As much as I know APEX report cannot manipulate the slider.

    If the options are:
    1)
    Try the PIPE...
    http://www.databasejournal.com/features/Oracle/article.php/2222781/returning-rows-through-a-table-function-in-Oracle.htm

    (2) as has said Roel, complete apex collection using your ps/sql and use it in the report.

    Kind regards
    Shijesh

Maybe you are looking for

  • Playing a disc error has occurred

    I use hp compack cq42... suddenly, I have on my laptop and the laptop then tell a disk read error occurred

  • HP HP Officejet 6500 E709n solutions Center opens blank

    I have windows 7 32-bit, I downloaded Adobe Flash Player 11 Active X and it always opens with a white screen. Is there something I can do, I'm not too computer competent and a hard time trying to figure this out.

  • Street and trail GPS travel questions

    I just started a 60 day trial of streets and travel 2011.  I have difficulties clear GPS track. If this is not possible, can I select the track and change the color or the size of the line?  I use the 2007 version and am able to erase or change color

  • Loss of memory hard drive

    I have a computer Dell Dimension 3000 DIM relatively old, running on Windows XP that was equipped with 40 gig of memory, which is now under 6 gig. My programs take hardly 2 gig of memory and I transferred all my documents to a flash drive, which cons

  • UEFI on = operating system not found

    Hi all.  I'm working on an Acer e1 - 472p with Windows 8.1.  Swapped the hard drive to SSD and added the 4 GB of RAM.  After a lot of creoles (including going to Legacy mode BIOS), I had loaded operating system.  As expected, it turned on fine since