Convert this query from Ms Access to Oracle?

How in the hole world can do this query in oracle?
TRANSFORM Sum(NET_SALES) AS SALES
SELECT YEAR_MONTH
FROM TBLCUSTOMER
WHERE (CUSTOMER=2083 Or CUSTOMER=1035 Or CUSTOMER=2097)
AND YEAR_MONTH Between 200709 And 200801
GROUP BY YEAR_MONTH
ORDER BY YEAR_MONTH
PIVOT CUSTOMER;

Like this perhaps:
SQL> ed
Wrote file afiedt.buf
  1  WITH t AS (SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 1 AS emplid, 100 as sales FROM dual UNION ALL
  2             SELECT TO_DATE('01/01/2008','dd.mm.yyyy'), 1, 200 FROM dual UNION ALL
  3             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 2, 300 FROM dual UNION ALL
  4             SELECT TO_DATE('01/06/2008','dd.mm.yyyy'), 2, 400 FROM dual UNION ALL
  5             SELECT TO_DATE('01/03/2007','dd.mm.yyyy'), 2, 500 FROM dual UNION ALL
  6             SELECT TO_DATE('01/05/2007','dd.mm.yyyy'), 3, 600 FROM dual UNION ALL
  7             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 3, 700 FROM dual UNION ALL
  8             SELECT TO_DATE('01/12/2008','dd.mm.yyyy'), 3, 800 FROM dual)
  9  -- END OF TEST DATA
10  select year, month, emp_1_sales, emp_2_sales, emp_3_sales
11  from (
12        select extract(year from dt) as year, extract(month from dt) as month,
13               sum(decode(emplid, 1, sales, 0)) as emp_1_sales,
14               sum(decode(emplid, 2, sales, 0)) as emp_2_sales,
15               sum(decode(emplid, 3, sales, 0)) as emp_3_sales
16        from t
17        group by extract(year from dt), extract(month from dt)
18       )
19* order by emp_3_sales desc, emp_2_sales desc, emp_1_sales desc
SQL> /
      YEAR      MONTH EMP_1_SALES EMP_2_SALES EMP_3_SALES
      2008         12           0           0         800
      2008          2           0         300         700
      2007          5           0           0         600
      2007          3           0         500           0
      2008          6           0         400           0
      2008          1         300           0           0
6 rows selected.
SQL> ed
Wrote file afiedt.buf
  1  WITH t AS (SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 1 AS emplid, 100 as sales FROM dual UNION ALL
  2             SELECT TO_DATE('01/01/2008','dd.mm.yyyy'), 1, 200 FROM dual UNION ALL
  3             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 2, 300 FROM dual UNION ALL
  4             SELECT TO_DATE('01/06/2008','dd.mm.yyyy'), 2, 400 FROM dual UNION ALL
  5             SELECT TO_DATE('01/03/2007','dd.mm.yyyy'), 2, 500 FROM dual UNION ALL
  6             SELECT TO_DATE('01/05/2007','dd.mm.yyyy'), 3, 600 FROM dual UNION ALL
  7             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 3, 700 FROM dual UNION ALL
  8             SELECT TO_DATE('01/12/2008','dd.mm.yyyy'), 3, 800 FROM dual)
  9  -- END OF TEST DATA
10  select extract(year from dt) as year, extract(month from dt) as month,
11         sum(decode(emplid, 1, sales, 0)) as emp_1_sales,
12         sum(decode(emplid, 2, sales, 0)) as emp_2_sales,
13         sum(decode(emplid, 3, sales, 0)) as emp_3_sales
14  from t
15  group by extract(year from dt), extract(month from dt)
16* order by 5 desc, 4 desc, 3 desc
SQL> /
      YEAR      MONTH EMP_1_SALES EMP_2_SALES EMP_3_SALES
      2008         12           0           0         800
      2008          2           0         300         700
      2007          5           0           0         600
      2007          3           0         500           0
      2008          6           0         400           0
      2008          1         300           0           0
6 rows selected.
SQL>If you meant something different, you'd better give an example of how you expect the output to be.

Similar Messages

  • I want to convert date from Microsoft Access to Oracle.

    I want to convert date from Microsoft Access to Oracle.
    My Oracel date format is 21-Jul-2004 02:24:09 AM
    I use sqlldr in Oracle 9i Database and I
    write control file
    load data
    infile 'test.txt'
    into table test
    fields terminated by "," optionally enclosed by '"'
    trailing nullcols
    name,
    birthday
    data file 'test.txt' for input
    "dao","21-Jul-2004 02:24:09 AM"
    why did error? ORA-01843: not a valid month
    Thank.

    replace birthday with
    birthday "to_date(:birthday, 'DD-Mon-YYYY HH:MI:SS AM', 'NLS_LANGUAGE=''american''')"Of course, if your monthes are in German, then set the language to german (JUL=JUL but DEZ<>DEC)
    Regards
    Laurent

  • DATA IMPORT from MS.ACCESS TO ORACLE DATABASE

    I have an MS ACCESS MDB file , I to import all the Tables and Data into ORACLE DATABASE through FORMS.Because this file is on Client side, and maintain on daily basis ,so it is very hard to import manually daily through traditional ODBC method,for that our one team member busy all day with that issue.
    Is it possible in our forms to import data from MS.ACCESS to ORACLE. I tried HOST command but it doesn't work.
    Data structure and Table Name are same both is MS Access and Oracle.
    We are Oracle 8i and Developer 6i

    Like i said in my previous post, the same steps that you used to do manually, you need to do it through forms, it's not that straight forward, you need to do lots of coding.
    connect form to MS Access db read the data, and insert them into oracle tables.
    Search the forum, there are solutions previously posted, and keep checking the online help .
    Tony

  • Migration from MS Access to Oracle 8

    Sir,
    I have exported the MS Access table from MS Access to Oracle in the following way.
    I have selected the table from MS Access and clicked on export and then it asked for exporting option. I have selected ODBC databases and given the option from 'emptab' to emptab. I have created a new system dsn and finally the table was exported to oracle(user name: scott pwd : tiger. when I logged on to scott/tiger and queried the tables select * from tab; , all the tables in that user are displaying. But I am not able to query on that particular table. I was getting the message 'table or view' doesn't exist. Pl guide me how to access that table and query on that table either desc table or insert into that table or update etc.
    with warm regards
    [email protected]
    srinivas

    Srinivas,
    The Oracle Migration Workbench will migrate access data and datastructures over to oracle, it can then modify the access database so that link tables are created to access the oracle information from the access forms and views.
    If you are using ODBC to export the data:
    What are the commands you are entering and the output? Note that oracle tables are usually upper cased so if the table name is MY_TABLE, select * from "my_table"; will not work whereas select * from my_table; will. Access export via odbc preserves the case so one may need to select * from "my_table";
    select table_name from user_tables;
    Will show the current users tables, to show what case is expected, upper or lower.
    I hope these small pieces of information are helpful in solving the issue.
    Regards,
    Turloch
    Oracle Migration Workbench Team

  • How to migrate data from MS Access to Oracle???????

    how to migrate data from MS Access to Oracle???????

    You can use heterogeneous services (HS) connection to MS-Access from Oracle and still use the same PL/SQL (or even a single CTAS statement) or SQL to load directly to Oracle tables. It's transparent, quick and clean as opposed to writing complex control files.
    You might have to set the ODBC connection to your Access database and add the details to Oracle listener.
    Please let me know if you are not sure how to set up the connection.

  • Converting this query to Oracle-Help

    New account as my old email address has changed so I had to create a new one. Sucks!
    Either way can I please get some help with converting the query below to oracle syntax not microsoft sql. Cheers
    select  eventtypeid as Payment_Type,
         sum(commission_amount) as commission_amount,
         startdate as commission_date
    from
    SELECT distinct
              PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
    case when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('2573','185')
         then 'D'
         when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('1126','1055')
         then 'O'
         when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('789','4000','785','871','1028','743')
         then 'R'
    else Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE
    end as SDC,
              Master_Usage.GENERICATTRIBUTE2 AS Service_Id,
              Master_Usage.EVENTTYPEID,
              sum(Master_Usage.CONTRIBUTIONVALUE) AS Commission_Amount
    FROM              Master_Usage INNER JOIN PERIOD
                   ON Master_Usage.PERIODSEQ = PERIOD.PERIODSEQ
              INNER JOIN (select distinct
                        lastname,
                        super_distributor_code,
                        distributor_code,
                        participantid,
                        startperiod
                   from Dealer_Hierarchy_107_114
                   where startperiod in ('107','108','110','111','112','114')
                   AND NOT POSITIONTYPEID LIKE 'MI %'
                   and not super_distributor_code = 'null' or distributor_code = 'null') as dealer_hierarchy
                   ON Master_Usage.GENERICATTRIBUTE1 = dealer_hierarchy.PARTICIPANTID and dealer_hierarchy.startperiod in ('107','108','110','111','112','114')
    WHERE          
              (NOT Master_Usage.PRODUCTID = 'IDDV' OR Master_Usage.PRODUCTID IS NULL)
              AND Master_Usage.PERIODSEQ in ('107','108','110','111','112','114')
              and Dealer_Hierarchy.startperiod in ('107','108','110','111','112','114')
              and Master_Usage.NAME not like '%revenue%'
              and Master_Usage.name not like '%GST%'
    group by      PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
              Master_Usage.GENERICATTRIBUTE2,
              Master_Usage.EVENTTYPEID
    ) as asf
    group by asf.EVENTTYPEID,
          startdate
    order by commission_amount desc

    please see the bold section,
    could that be the reason ??
    select eventtypeid as Payment_Type,
         sum(commission_amount) as commission_amount,
         startdate as commission_date
    from
    SELECT distinct
              PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
    case when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('2573','185')
         then 'D'
    when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('1126','1055')
         then 'O'
    when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('789','4000','785','871','1028','743')
         then 'R'
    else Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE
    end as SDC,
              Master_Usage.GENERICATTRIBUTE2 AS Service_Id,
              Master_Usage.EVENTTYPEID,
              sum(Master_Usage.CONTRIBUTIONVALUE) AS Commission_Amount
    FROM      Master_Usage INNER JOIN PERIOD
                   ON Master_Usage.PERIODSEQ = PERIOD.PERIODSEQ
              INNER JOIN (select distinct
                        lastname,
                        super_distributor_code,
                        distributor_code,
                        participantid,
                        startperiod
                   from Dealer_Hierarchy_107_114
                   where startperiod in ('107','108','110','111','112','114')
                   AND NOT POSITIONTYPEID LIKE 'MI %'
                   and not (super_distributor_code = 'null' or distributor_code = 'null') as dealer_hierarchy
                   ON Master_Usage.GENERICATTRIBUTE1 = dealer_hierarchy.PARTICIPANTID and dealer_hierarchy.startperiod in ('107','108','110','111','112','114')
    WHERE      
              (NOT Master_Usage.PRODUCTID = 'IDDV' OR Master_Usage.PRODUCTID IS NULL)
              AND Master_Usage.PERIODSEQ in ('107','108','110','111','112','114')
              and Dealer_Hierarchy.startperiod in ('107','108','110','111','112','114')
              and Master_Usage.NAME not like '%revenue%'
              and Master_Usage.name not like '%GST%'
    group by      PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
              Master_Usage.GENERICATTRIBUTE2,
              Master_Usage.EVENTTYPEID
    ) as asf
    group by asf.EVENTTYPEID,
         startdate
    order by commission_amount desc

  • Very difficult migration from MS Access to Oracle with SQL Developer

    Dear Developers
    I have tried to used for one Project Oracle Sql Developer Migration from Access to Oracle (Application Express). Was about an evaluation if Oracle Express (with Application Express) or Mysql (with PHP) as target database.
    I am working with Oracle for 14 years and i earn my money in projects related with Oracle. Of course i am sentimental and i push every time when an opportunity comes to have as an option Oracle.
    This time beside my sentimental approach the decision was different.
    I will tell you why and i hope that someone there will listen and make something for a better Product.
    I was trying yesterday the whole day to migrate an Microsoft Access database. A nightmare....
    1. Microsoft Access Exporter 2000 was too slow. For a 25 MB Access database, running time was 15 Minutes. And 15 minutes to obtain an undocumented error. I followed your instruction and eliminate all references etc... as you described in HELP. a lot of time necessary to read and do..... After that i obtained an Error #..16. Sorry that i don't provide you with an exact number error. i don't have it right know and personally i am not interested anymore. For this error i don't find nothing in forums about it.... Search again and again..... Every time after waiting 15 Minutes in which you don't know exactly what application does or if really does something. I decided to delete sequentially macros, modules, forms, querys from Access database and see where Exporter stops... Time and time lost for trying and searching.... Finally i obtained my XML file only by keeping my Access tables. The file was produced even if i obtained at the end Error #5:..... Because was an error i am not really sure if the file was completly consistent with my database.
    2. I followed the next steps and with some errors (enabling, disabling constraints, objects couldn't be created because of different reasons) i had my Model and Oracle Schema. I have tried to export the data from Access and import it in Oracle. data exported was in UTF8 and SQL Loader Control file doesn't have
    LOAD DATA
    character set utf8
    So i tried to add the string "character set utf8" in my dozens of CTL files - with a freeware of course.....
    Maybe you can say that if i knew that from the beginning i would have set my character set in SQL Developer. I don't know and i will not ever try with this product!
    So finally after hours of working and trying and playing with my nerves, reading a lot of forums and documentation, i had an Oracle schema, maybe incomplete because of different errors at so much migration stages.
    And now i have tried for the first time in my life MySQL Migration Toolkit. I read that for migration to MYSQL this tool is what i needed.
    I recommend you to try the product and see something about the quality required for a piece of software. Is not enough if your product runs OK with Nortwind DEMO Access database. It should run OK with all ACCESS databases.
    With the tool i have done the job in 5 MINUTES. Simple, efficiently and without errors. At the end i had the SQL Scripts and the DATA imported in the database.
    Difficult to say something now. I am sentimental but i asked mysef if you can do something to improve the quality of the product.
    What arguments can we provide for a client in Migration from Access to Oracle ???? Can you honestly answer at that?
    Please try this MYSQL Migration Toolkit.....Maybe this give you some ideas about simple tasks and about what we really need...
    Best regards
    Adrian

    Dear Barry and Kgronau
    Thank you very much for your response. My Post was after a long day of trying to import an MDB file.
    Maybe you can understand why i was so angry...
    Yes i understand that your tool try to do more than other even if actually you don't really convert too much.
    From Modules to make some procedures where the whole code is commented! .....
    For other MDB which i tried to import in APEX the forms where really not usable. Queries are full of errors requires most of the time manual corrections.
    I am sorry that i can not provide you with this MDB which cause these problems.
    Data and software doesn't belong to me and the company which own it can not provide to you.
    What i hope from your product is, even when errors come, to show a better error explanation. At what object in Access error ocures ? This is very important because i can correct my MDB or just delete the module,form,query in cause if SQL Developer doesn't like it....
    Just showing an error Error #.... doesn't help me too much. And if an error occurs i don't know if program continues to work or is dead. No information about this. Maybe you can show that your application is alive and does something (working status etc...) ! Anyway we wait long minutes in front of dead screen....
    Again, thank you very much for your attention
    Adrian

  • Copying records from MS Access to Oracle ODBC

    I have a linked table from Oracle to an MS Access DB table. I am trying to "upsize" many records from the original MS Access DB table to one mirrored in Oracle.
    All is well save for the currency field in the original MS Access table. If I change the field to number or something from currency in Access, I will lose the formatting and potentially the data.
    I've tried several number combinations in the Oracle table but while I can copy and paste the records from the Access table to the linked Oracle table without getting any errors, when I query the records in the Oracle table it just shows pounds signs.
    Is there a certain number format in Oracle I should use for this?
    Is there a definitive way to make that work?
    I'll take any feedback I can get on this.
    Thanks.

    ok, this is still a bit insane. I copied all the records over, and in the MS Access ODBC linked part, I see the numbers correctly.
    After running various queries in Oracle, all are still showing #s unless it's a 0 value.
    i.e.
    SQL> SELECT LOAN_BALANCE FROM SEPTEMBERUPLOAD1A WHERE AUTOID < 30;
    LOAN_BALANCE
             .00
             .00
    29 rows selected.So then the question is, while I assume the data is in there potentially, and correct at that, is there a formatting trick I need to apply when querying the data through Oracle? Will people just see the pound signs? Let's say I'm later writing a Perl (yuck!) or Java (yeaaaah!) app on the web to view the data, will people see # signs? Or will they see double/decimal type figures?
    never mind....I guessed using the TO_CHAR function to retrieve it...I see that's what you do.
    SQL> SELECT TO_CHAR(LOAN_BALANCE) FROM SEPTEMBERUPLOAD1A WHERE AUTOID < 30;
    TO_CHAR(LOAN_BALANCE)
    0
    27786.16
    19864.43
    123670.56
    38820.51
    1417502.28
    101465.81
    90724.64
    127566.76
    62615.79
    74805.47
    17925.83
    122796.58
    103719.01
    72914.53
    169919.59
    33181.53
    0
    29623.22
    34192.74
    82956.63
    14387.6
    37506.27
    78149
    56214.33
    116728.95
    62696.78
    94718.46
    48605.89
    29 rows selected.Thanks!
    Message was edited by:
    user515689
    Message was edited by:
    user515689

  • Importing data from MS-Access into Oracle 9i

    I want to import data from access into oracle 9i. I already contain the same data in Oracle but these Access files contain updates and additional data to the existing data . So i need help to import in such a way that origional data remain same just addional data and updates come from MS-Access.

    Hi,
    You can achieve this by using the SQL Loader, which will help you out to load the data.
    For further reference check the below link
    http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a67792/ch05.htm#1261
    As you said that you have existing data in the table and you have Update's too. you have the Options like
    APPEND which you will useful to add the new records.
    - Pavan Kumar N

  • Unable to deploy from Jdev - access denied (oracle.security.jps.JpsPermissi

    Hi.
    My Jdev is Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1
    I am trying to deploy to standalone web logic 10.3.6.0
    But I get the following message
    <May 28, 2013 10:45:40 AM EDT> <Warning> <Deployer> <BEA-149004> <Failures were
    detected while initiating deploy task for application 'DrhCustomers'.>
    <May 28, 2013 10:45:40 AM EDT> <Warning> <Deployer> <BEA-149078> <Stack trace fo
    r message 149004
    java.security.AccessControlException: access denied (oracle.security.jps.JpsPerm
    ission AppSecurityContext.setApplicationID.null)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:
    546)
    at oracle.security.jps.util.JpsAuth$AuthorizationMechanism$3.checkPermis
    sion(JpsAuth.java:458)
    at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:518)
    at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:544)
    Truncated. see log file for complete stacktrace
    Caused By: java.security.AccessControlException: access denied (oracle.security.
    jps.JpsPermission AppSecurityContext.setApplicationID.null)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:
    546)
    at oracle.security.jps.util.JpsAuth$AuthorizationMechanism$3.checkPermis
    sion(JpsAuth.java:458)
    at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:518)
    at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:544)
    Truncated. see log file for complete stacktrace
    >
    I don't have any security settings in my application
    Please advice

    Thanks for the response James.
    Though the classpath/path looks like it has references to JDK 1.5, it is actually referring to jrocket JDK 1.6. I can confirm this because when I type "C:\ORACLE\MIDDLE~1\JROCKI~1.5-3\lib" in windows explorer it takes me to "C:\ORACLE\Middleware\jrockit_160_14_R27.6.5-32\lib"
    Moreover, C:\ORACLE\Middleware is the place where I installed weblogic 11gR1.
    I looked at the startWeblogic.cmd, setDomainEnv.cmd and commEnv.cmd to trace how the JDK path is getting manipulated and I found that in setDomainEnv.cmd there is a line "for %%i in ("%JAVA_HOME%") do set JAVA_HOME=%%~fsi " which is converting the full JDK path to short path. Below are the references in the .cmd files :
    setDomainEnv.cmd
    set BEA_JAVA_HOME=C:\Oracle\Middleware\jrockit_160_14_R27.6.5-32 <---------------------Setting the correct JDK version
    if "%JAVA_VENDOR%"=="Oracle" (
         set JAVA_HOME=%BEA_JAVA_HOME%
    ) else (
         if "%JAVA_VENDOR%"=="Sun" (
              set JAVA_HOME=%SUN_JAVA_HOME%
         ) else (
              set JAVA_VENDOR=Oracle
              set JAVA_HOME=C:\Oracle\Middleware\jrockit_160_14_R27.6.5-32
    set JAVA_HOME=%JAVA_HOME%
    for %%i in ("%JAVA_HOME%") do set JAVA_HOME=%%~fsi <------------------------Converting to short form
    .....And other commands
    if NOT "%WEBLOGIC_CLASSPATH%"=="" (
         if NOT "%CLASSPATH%"=="" (
              set CLASSPATH=%WEBLOGIC_CLASSPATH%;%CLASSPATH%
         ) else (
              set CLASSPATH=%WEBLOGIC_CLASSPATH%
    commEnv.cmd
    set WEBLOGIC_CLASSPATH=%JAVA_HOME%\lib\tools.jar;%BEA_HOME%\utils\config\10.3\config-launch.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.2.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar <-----------WEBLOGIC_CLASSPATH is set here
    Thanks,
    -Raghu

  • Please convert this query to update.

    Hi Experts,
    Please convert this MERGE statment to UPDATE.
    MERGE INTO CUSTOMER_DTLS CDT
        USING
            SELECT CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
            FROM CUSTOMER_DTLS CDT
            INNER JOIN REVEN_MAP RMP ON CDT.CDT_ID = RMP.ORG_ID
            INNER JOIN SALES_DTLS OST ON RMP.WB_IBU = OST.IBU AND OST.Rep_Code = CDT.CDT_SECSALESREP
            WHERE CDT.PRODUCT_SEC = 'M'
            AND CDT.CDT_ID = 600
        ) SALES_QUERY
        ON(
                CDT.CDT_ID = SALES_QUERY.CDT_ID
            AND CDT.CDT_ITEMREQ_NO = SALES_QUERY.CDT_ITEMREQ_NO
            AND CDT.CDT_UNIT_NO = SALES_QUERY.CDT_UNIT_NO
            AND CDT.CDT_UPDATE_DT = SALES_QUERY.CDT_UPDATE_DT
            AND CDT.PRODUCT_SEC = 'M'
        WHEN MATCHED THEN
        UPDATE SET CDT.CDT_SALES_REP  = SALES_QUERY.SalesName,
                CDT.CDT_OutSide_SALES_DTLS     = SALES_QUERY.Team,
                CDT.CDT_OutSide_Team_ID        = SALES_QUERY.Team_ID
        WHERE CDT.CDT_SALES_REP IS NULL
        AND CDT.PRODUCT_SEC = 'M'
        AND CDT.CDT_ID = 600;
    Please help me.
        Thanks.

    Hi All,
    The merge query first doing join and make it as a SALES_QUERY query.
            SELECT CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
            FROM CUSTOMER_DTLS CDT
            INNER JOIN REVEN_MAP RMP ON CDT.CDT_ID = RMP.ORG_ID
            INNER JOIN SALES_DTLS OST ON RMP.WB_IBU = OST.IBU AND OST.Rep_Code = CDT.CDT_SECSALESREP
            WHERE CDT.PRODUCT_SEC = 'M'
            AND CDT.CDT_ID = 600
        ) SALES_QUERY
    On top of it using the result of SALES_QUERY checking the following matching.
    ON(
                CDT.CDT_ID = SALES_QUERY.CDT_ID
            AND CDT.CDT_ITEMREQ_NO = SALES_QUERY.CDT_ITEMREQ_NO
            AND CDT.CDT_UNIT_NO = SALES_QUERY.CDT_UNIT_NO
            AND CDT.CDT_UPDATE_DT = SALES_QUERY.CDT_UPDATE_DT
            AND CDT.PRODUCT_SEC = 'M'
    But in your update it's just joining and after that not used any of these values for comparison.
    CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
    How this works.
    Please explain.
    Thanks.

  • Problems with german umlauts when Migration from MS Access to Oracle

    When I make a Migration from MS Access 97 to Oracle 8.1.5, I have Problem with the germans characters (umlauts). The Oracle is using the rigth character Set for german characters. What can I do? Is it e problem from the MS Access ODBC Driver or the Oracle ODBC Driver?

    Is your character set for Oracle set up to UTF8??

  • Data Migration from Microsoft Access to Oracle 9i

    Dear All
    This is my first request in your forum,My problem is that I have installed SQL developer but unable to migrate my MDB (Microsoft access file) into Oracle 9i,I have done the following activities in order to migrate data.
    open sql developer
    under migration,click quick migration
    quick migration wizard diaglog box appear,click new,
    in the oracle tab, input the following information
    input connection name 'zuhair',give user name and password (sys/s),check save password option,give role "sysdba" ,give connection type "basic",didnt check any any check box like os authorization and others,give host name 'zkhan-dfml',port '1521',sid 'dba' and then push the test button and then status show "success"
    in the access tab, input the following information
    input connection name ,input mdb file name by using browse button,after this step click test button then the following message display 'test fail odbc microsoft access driver not a valid password
    I have tried to create odbc link but i think i have done some thing wrong,kindly help
    Regards
    Zuhair

    Hi Zuhair,
    If you give details of the problems you are still having then we should be able to get SQL*Developer to work.
    However, if you don't want to use SQL*Developer then the following options are taken from note 393760.1 available in Metalink if you have access to that -
    1. Use a gateway that supports the non-Oracle database or generic connectivity if a third party ODBC driver is available to do a -
    'create Oracle_table as select from non_oracle_table@database_link'
    for each table. You would then have to manually create all the other objects (views, indexes, stored procedurs etc) and permissions etc that existed in the non-Oracle database.
    2. Use the SQL*Plus COPY command to copy data from the non-Oracle database to the
    Oracle database using a gateway or generic connectivity. The syntax is as follows:
    COPY FROM username/password@oracle_sid -
    INSERT destination_oracle_table -
    USING query;
    The following example selects all rows from the EMP table in the non-Oracle database and
    inserts them into the local Oracle EMP table:
    COPY FROM SCOTT/TIGER@ora10 -
    INSERT EMP -
    USING SELECT * FROM SCOTT.EMP@gateway;
    where "gateway" is the database link created for the gateway.
    3. Load the non-Oracle data into flat files and use SQL*Loader to put the data into Oracle tables. Again manual
    work is required for the other objects.
    4. Contact the Oracle Product Technology Services (PTS) group for assistance. See the webpage -
    http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
    5. Use a third party migration tool. See -
    http://www.oracle.com/technology/tech/migration/isv/third_party.html
    6. Use JDBC to connect to the non-Oracle database and Java in the Oracle database. This method will work but it is not suppported by the JDBC team.
    =========
    The amount of work involved will depend on the number and size of Access tables that you want to migrate.
    Regards,
    Mike

  • Upload data from microsoft access to oracle form(in data block)

    Hi all,
    Any one can help me, how we can upload data from access file to developer form(in data block).
    as
    we upload data from text file to developer form(in data block) using some packages.
    Thank's in advance

    Hi Zuhair,
    If you give details of the problems you are still having then we should be able to get SQL*Developer to work.
    However, if you don't want to use SQL*Developer then the following options are taken from note 393760.1 available in Metalink if you have access to that -
    1. Use a gateway that supports the non-Oracle database or generic connectivity if a third party ODBC driver is available to do a -
    'create Oracle_table as select from non_oracle_table@database_link'
    for each table. You would then have to manually create all the other objects (views, indexes, stored procedurs etc) and permissions etc that existed in the non-Oracle database.
    2. Use the SQL*Plus COPY command to copy data from the non-Oracle database to the
    Oracle database using a gateway or generic connectivity. The syntax is as follows:
    COPY FROM username/password@oracle_sid -
    INSERT destination_oracle_table -
    USING query;
    The following example selects all rows from the EMP table in the non-Oracle database and
    inserts them into the local Oracle EMP table:
    COPY FROM SCOTT/TIGER@ora10 -
    INSERT EMP -
    USING SELECT * FROM SCOTT.EMP@gateway;
    where "gateway" is the database link created for the gateway.
    3. Load the non-Oracle data into flat files and use SQL*Loader to put the data into Oracle tables. Again manual
    work is required for the other objects.
    4. Contact the Oracle Product Technology Services (PTS) group for assistance. See the webpage -
    http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
    5. Use a third party migration tool. See -
    http://www.oracle.com/technology/tech/migration/isv/third_party.html
    6. Use JDBC to connect to the non-Oracle database and Java in the Oracle database. This method will work but it is not suppported by the JDBC team.
    =========
    The amount of work involved will depend on the number and size of Access tables that you want to migrate.
    Regards,
    Mike

  • Fastest way to load data From MS Access to Oracle DB

    Hi All,
    We get an Access DB every week which we need to load to an Oracle DB, currently we have been using SQL loader but the process is slightly painful and horribly boring, so m trying to do some automation kind of stuff. I was thinking of doing the whole thing using a java application and then schedule it to run it at some pre-decided time. The approach I took was to read the access file and then load it using PreparedStatements to the oracle DB. But going through various threads in the forum, i found that its going to b a bit too slow (and the record count in my tables is around 600,000). Can there be a better way to do this? anyone done something similar b4.

    Well the only reason I want to use Java (i may go for C#) is that i dont want to spend time manually creating those CSV files from Access. Can that be done using something else?So use java to create the CSV files.
    And have you actually tried going straight to Oracle? What exactly is your time constraint?
    And another issue is that I sometimes have to make some adjustments (rounding off) to the data which is usually through query, but that is usually done after the data has been loaded in the DB.Which would make it irrelevant to actually moving the data then. If you are cleaning the data with SQL already then it is simple to wrap that in a proc and do it that way. Presumably you are loading to temp (non-production in-lined) tables first, then cleaning and moving.

Maybe you are looking for