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

Tags: Database

Similar Questions

  • export data to sql

    Hello

    I'm trying to export essbase data then reload it into the sql table, I to the right, click Export, then choose "All data" and check "Export to the format column", if I get the text file. However, when I try to import into a sql table, it's just a great column.

    What is the best way to export data out essbase and then import them into a table in sql, the idea is that I want to just export, for example, budget data, and then import them into sql.

    Thank you

    If you read my blog, you will see that you can really control the export format except in the designate one of the dense dimensions such as columns. The rest follows the contour. I'll guess that your periods dimension is what is prevalent throughout. While you can not retrieve the columns in the desired order. If it is still a cube of dev, you can add a dense dimension with a single member and use it as your column. It would not affect the performance of the cube, but would affect any charge the rules or you get already.

    If you need to format you describe, another suggestion would be to export the format as you see, then put views above it that unions periods to take a single column of data and forcing a month name in it.

    If your table looks like the year, scenario, dept, acct, per1, Per2, Per3etc
    Then, you could do a view as
    Select the year, scenario, dept, Acct, 'Jan', table 1, where 1 is not null
    Union
    Select the year, scenario, dept, Acct, 'February', Per2 table where Per2is not null
    etc.

  • 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

  • Export data - with the colunn attribute

    Hello, we have a cube with 12 decreases intensity, we have a Sun cost center that we have assigned a dim (SGA) attribute. The Sun CC has ~ 3,000 and the dim SGA has approximately 80 members with each CC with an LMS are entrusted to him.

    I need to export data to power a different cube based on the Sun BMG. I tried to do this with a report Script and it worked very well for a member of the SGA and one account, but when I tried to do it for all members of the SGA that he brought EAS (v9.3.1.4) as well as the report never came back. I tried it twice, the people in charge the servers weren't happy either time.

    I searched the web looking for solutions and see a lot of start analytics and JExport. No money to start analytics and I can't find the source of JExport. Does anyone have an suggestions.

    I've been watching the DataExport command, but I don't think I can have the attribute member is displayed in the output file.

    My thought is to get rid of the protected attribute in Essbase and let the FDM to manage the translation as the protected attribute is only intended to be used to export data.

    Any suggestion would be appreciated.

    Thanks in advance.
    Steve

    JExport is here: http://essbaselabs.blogspot.com/2008/10/cdf-jexport-and-dynamic-members.html
    ^ ^ ^ Those are the guys who wrote it.

    I already tried to put a Sun in a DATAEXPORT attribute. Have you tried and failed?

    Kind regards

    Cameron Lackpour

  • 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. ;)

  • Export data to SQL Loader format bugs?

    I have a problem to the export of large tables in SQL * Loader format files.

    Developer SQL is sitting there with almost all CPU (> 95%) on my machine (I'm only under SQL Developer & Process Explorer) and same constantly redraw (the page is white).

    The .ldr file is created, but seems to be empty. (I would have thought that he would be constantly added to the).

    In fact, nothing happens.

    Does anyone else have this problem? I use SQL Developer 2.1 on XP with a 9i DB.

    NIC

    Unfortunately, this is how things are done now.
    If you have a better suggestion (such as hot flashes automatically recovered rows and the re-use of freed memory), you can always add this as a feature request to the exchange of SQL Developer, for other users can vote to add weight to the possible future implementation. I'd do it.

    Kind regards
    K.

  • 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.

  • 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

  • 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.

  • How to export data to excel that has 2 tables with the same number of columns and the column names?

    Hi everyone, yet once landed upward with a problem.

    After trying many things to myself, finally decided to post here...

    I created a form in form builder 6i in which clicking on a button, the data gets exported to the excel sheet.

    It works very well with a single table. The problem now is that I cannot do the same with 2 tables.

    Because the tables have the same number of columns and the columns names.

    Here are the 2 tables with column names:

    Table-1 (MONTHLY_PART_1) Table-2 (MONTHLY_PART_2)
    SL_NOSL_NO
    MODELMODEL
    END_DATEEND_DATE
    U-1U-1
    U-2U-2
    U-4U-4
    ..................
    ..................
    U-20U-20
    U-25U-25

    Given that the tables have the same column names, I get the following error :

    402 error at line 103, column 4

    required aliases in the SELECT list of the slider to avoid duplicate column names.

    So how to export data to excel that has 2 tables with the same number of columns and the column names?

    Should I paste the code? Should I publish this query in 'SQL and PL/SQL ' Forum?

    Help me with this please.

    Thank you.

    Wait a second... is this a kind of House of partitioning? Shouldn't it is a union of two tables instead a join?

    see you soon

  • No need to advise - compare the date in *.sql with sysdate.

    Hi guys,.

    Need some help here.

    Someone has a script that will compare the date specified with the current sysdate. If previously, he will order that SQL * PLUS to leave immediately.
    The audit will be essentially in a script *.Sql. Whenever we run the script, @c:\script.sql, it will be first of all to compare the dates and decide whether to proceed with the rest of the codes (dml) below the date checker in the same script.sql

    Thank you

    I would like to combine the solutions of bencol and alberto:

    whenever sqlerror exit
    
    DECLARE
       v_date   DATE := TO_DATE('', 'YYYYMMDD');
    BEGIN
       IF v_date >= TRUNC(SYSDATE) -- or perhaps:  v_date>= sysdate
       THEN
         null;
       ELSE
         raise_application_error(-20000,'Date is before SYSDATE!');
       END IF;
    END;
    /
    
    whenever sqlerror continue
    
    -- rest of your script
    ...
    

    (not tested)

    Published by: hm on 08.05.2012 02:51

  • Export data from one schema to another SQL schema

    Hello.

    I have 2 plans. One is called MICC_ADMIN and the other is called MICC_PROD. What I want is to export from MICC_ADMIN to import into MICC_PROD. I tried to do with the tool of data workshop, one of the table has approximately 19,000 records, so he gets frozen trying to export data. So I was wondering if is it possible to do this via the sql command. Thank you.

    Best regards, Bernardo.

    Hello

    You give the right to select on MICC_APEX_ADMIN. SRDB_MAIN to MICC_APEX_PROD;
    Then sign in as MICC_APEX_ADMIN and run

    GRANT SELECT ON MICC_APEX_ADMIN.SRDB_MAIN TO MICC_APEX_PROD;
    

    Then log in as MICC_APEX_PROD and INSERT performance

    Kind regards
    Jari

  • 30EA2 - SQL Developer Vs Index SQL/Plus functional on column Date

    I just spotted this while using EA3.2, but it may also exist on other versions, I will consider. I'm on a 9i 9.2.0.7 box, but will see if I can recreate on an instance of 10 or 11

    The question is, if I create a shadow table

    CREATE TABLE paul_test
    (
    CREATION_DATE DATE,
    DATE of creation_date2,
    last_updsate_date DATE,
    date of last_updsate_date2
    )
    ;

    If I then create a functional index on creation_date via SQL Dev:

    create index pt_idx1 on paul_test (nvl (creation_date, ' 01-JAN-4000'));

    and create a functional index on creation_date2 via SQL more

    create index pt_idx2 on paul_test (nvl (creation_date2, ' 01-JAN-4000'));

    What I see when you perform a describe table statement and looking at the index or when querying ALL_IND_EXPRESSIONS on the table TABLE_NAME is the following:

    SQL Dev index is: NVL("CREATION_DATE",'01-JAN-4000')

    The Index of over SQL is: NVL ('CREATION_DATE2', TO_DATE ('4000-01-01 00:00:00 ',' yyyy-mm-dd hh24:mi:ss'))))

    Why are they not compatible?

    If I then fill up with 1 million rows and fill creation_date/creation_date2 with enough data to make no small enough value I then collect statistics on the table and explain the plans of selects on creation_date/creation_date2 via SQL dev. and SQL Plus what I see, it's different


    -Select
    NVL SELECT (creation_date, ' 01 - JAN - 4000 "")
    OF eagadev.paul_test
    where nvl (creation_date, ' 01-JAN-4000') = ' 01-JAN-4000';

    SQL Dev explain Plan
    Use PT_IDX1


    More SQL explain Plan:

    SQL > SELECT count (1)
    2 FROM eagadev.paul_test
    3 where nvl (creation_date, ' 01-JAN-4000') = ' 01-JAN-4000';

    COUNT (1)
    ----------
    100


    Execution plan
    ----------------------------------------------------------
    0 SELECT STATEMENT Optimizer = CHOOSE (cost = 30 card = 1 bytes = 8)
    1 TRI 0 (AGGREGATE)
    2 1 INDEX (LINE SCAN) OF "PT_IDX1" (NO ONE) (cost = 30 Ca
    RD = 5825 bytes = 46600)

    Statistics
    ----------------------------------------------------------
    14 recursive calls
    0 db block Gets
    8 compatible Gets
    0 physical reads
    Redo size 60
    224 bytes sent via SQL * Net to client
    276 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed


    -Select2

    SELECT count (1)
    OF eagadev.paul_test
    where nvl (creation_date2, ' 01-JAN-4000') = ' 01-JAN-4000';

    SQL Dev explain the Plan:
    FULL analysis

    More SQL explain Plan:

    SQL > SELECT count (1)
    2 FROM eagadev.paul_test
    3 where nvl (creation_date2, ' 01-JAN-4000') = ' 01-JAN-4000';

    COUNT (1)
    ----------
    100


    Execution plan
    ----------------------------------------------------------
    0 SELECT STATEMENT Optimizer = CHOOSE (cost = 28 card = 1 bytes = 8)
    1 TRI 0 (AGGREGATE)
    2 1 INDEX (LINE SCAN) OF "PT_IDX2" (NO ONE) (cost = 28 Ca
    RD = 5825 bytes = 46600)





    Statistics
    ----------------------------------------------------------
    14 recursive calls
    0 db block Gets
    8 compatible Gets
    0 physical reads
    Redo size 60
    224 bytes sent via SQL * Net to client
    276 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed


    The select on creation_date2 says plan is different between Dev SQL and SQl Plus. SQL Dev does not seem to be implicitly convert the '' 01-JAN-4000 in a date.

    Their behaviour are not the same?

    Then the problem may be due to different configurations of NLS between SQLPlus and SQLDeveloper, try to check the date format configured NLS in SQLPlus and SQLDeveloper.

    You can change the date format in SQLDeveloper, NLS of:

    Tools-> preferences - ZDatabase-> NLS

  • Developer SQL 2.1.0.63.73 exports DATE as a TIMESTAMP

    In my view, that it is a bug. When I export a table to a XLS file, the values in the DATE columns are saved as if they were TIMESTAMP:
    for example. December 31 09 12:00:00 AM exported as 31 December 09 12.00.00.000000000 AM

    Not really a huge deal until you try to import, in which case you cannot import a TIMESTAMP into a DATE column. First of all, you will get an error from the Miss AM / A.M.. or AM/PM. You cannot explicitly specify the date format then import either as rejects Oracle it since it is not supported. The proper way is to cast to a date, but you can do this through the import feature.

    Nevertheless, I think the export function should export DATEs according to the NLS Date Format settings, but it is not.

    If it makes any difference, I use the 64-bit version of Windows of SQL Developer on Windows 7 64 - bit with the Oracle 64-bit client.

    Hello

    Don't know if it's something related to my previous problem.
    My SQL Dev gives the correct date format to export to Excel, but fails on an insert export

    Verdin, a member of the sql dev team gave this workaround solution that solved my problem
    >
    You can add the following in the sqldeveloper.conf to ensure that the driver tell not the column of a DATE in the TIMESTAMP column type.

    AddVMOption - Doracle.jdbc.mapDateToTimestamp = false
    >

    as suggested in this thread
    Re: 2.1 EA1: problems with Date type columns

    Hope this helps,

    Buntoro

  • Force SQL Developer 1.5.4 to export data on 1 sheet XLS

    Hello.

    I use SQL Developer 1.5.4 to export data in XLS format.
    The exported file is about 40 MB of wholesale.

    When exporting, I noticed that developer SQL divides the data into multiple worksheets, with about 64 001 lines each.

    Please, is there a way I could force SQL Developer to have all data on a spreadsheet of singke?


    Thank you.

    I'm just guessing, but I suspect that the 64 000 line limit is so the resulting XLS file can be opened in Excel 2003 or an earlier version. Excel 2003 has a limit of ~ 65 536 (2 ^ 16) rows in a worksheet. Even if you were to export as a text or CSV (separator: tab) file and try to load it into Excel, it could choke and leave once the limit of the worksheet intervened.

    Hrsg.:.

Maybe you are looking for

  • No sound in Windows 10

    I have a new iMac El Cap, fully implemented in day running.  I created a partition of 10 Windows using Bootcamp.  Sound does not. Win Device Mgr shows no sound information. Direct X DXDiag says there is no sound h/w and advises to load a driver if it

  • Display turns into a very bright light after playing game on Satellite P300D

    Hello I have a problem with my Toshiba P300D laptop. After playing a shooting game (for example Call of Duty). My screen turns bright after a few days. Then, it is almost impossible to see all kinds of images in light colored or white letters. Every

  • Support of IP camera OR cRIO

    Hello I work with a cRIO 9022. Also, I have a camera (Panasonic C210A) based ethernet. Should be power thanks to its converter. The converter has received 2 slots for LAN and Ethernet cables are such that we're going to the camera and we're going to

  • How to change Windows 7 Home Premium from English to Spanish?

    I need to download or buy something?

  • Photosmart 7510 - calendar begins with Sunday

    Hello I have a 7510 all-in-1. The calendar application that allows you to print a calendar sstarts monthly Sunday as the first day. How can we change this? Thank you