Results 1 to 6 of 6
  1. #1
    RThomas321 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    2

    Help Converting Oracle PL/SQL Query into Access

    Can anyone help with converting this PL/SQL query for Access 2010?
    Particularly, the partition functionality.

    select Table_A.number0,
    Table_B.ST_CD,


    Table_C.ID_CD AS SPID,
    to_char(Table_D.COLLECT_DT, 'MON-YY') as Mprd,
    count(Table_D.D_number)
    over (partition by --IDENTIFICATION_CD,
    Table_A.number0,
    to_char(Table_D.COLLECT_DT, 'MON-YY'),
    substr(Table_C.ID_CD,6,5)
    ) as SampleCt,
    avg(CONCENTRATION)
    over (partition by --IDENTIFICATION_CD,
    Table_A.number0,
    to_char(Table_D.COLLECT_DT, 'MON-YY'),
    substr(Table_C.ID_CD,6,5)) as SampAvg,
    Table_D.COLLECT_DT AS SAMPLEDATE,
    TABLE_E.CONCENTRATION

    FROM Table_A
    inner join Table_B
    on TABLE_B.SYS_NUMBER = Table_A.SYS_NUMBER
    inner join TABLE_C
    on TABLE_C.B_NUMBER = TABLE_B.B_NUMBER
    inner join TABLE_D
    on TABLE_D.C_NUMBER = TABLE_C.C_NUMBER
    inner join TABLE_E
    on TABLE_E.D_NUMBER = TABLE_D.D_NUMBER
    inner join TABLE_F
    on TABLE_E.F_NUMBER = TABLE_F.F_NUMBER
    where Table_F.CODE in ('1009', '1011');

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I think the closest you will get in Access is an aggregate GROUP BY (Totals) query or a nested subquery or a report using its Grouping & Sorting functionality with aggregate calcs in header/footer sections. The report will allow display of detail records and summary calcs.

    http://stackoverflow.com/questions/2...y-and-group-by
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I don't think this is a simple conversion, nor some application of aggregate functions.
    see this for more re Oracle analytic functions.

    I don't recall anyone trying to develop equivalent functions with vba/Access. I'm not familiar with SQL server, but I did find a link to show those functions(or similar functionality) exist in SQL server.

    Via Google I found this that may be of some help.

    Good luck

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If ranking is the goal, review http://allenbrowne.com/ranking.html

    Exactly what is the output you want?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    It's the Over and Partition By that isn't available in Access.
    I'm sure someone has tried to create functions to do this in Access/vba, but I haven't been able to find any.

    Here are a couple of links to threads with similar issue and "solution" (more gooogling!)

    http://www.mrexcel.com/forum/microso...partition.html

    http://www.access-programmers.co.uk/...d.php?t=206471



  6. #6
    RThomas321 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    2
    Quote Originally Posted by orange View Post
    It's the Over and Partition By that isn't available in Access.
    I'm sure someone has tried to create functions to do this in Access/vba, but I haven't been able to find any.

    Here are a couple of links to threads with similar issue and "solution" (more gooogling!)

    http://www.mrexcel.com/forum/microso...partition.html

    http://www.access-programmers.co.uk/...d.php?t=206471


    Thanks, I'll check those out.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Convert QUERIES from ORACLE to ACCESS!?!
    By jas0214 in forum Queries
    Replies: 2
    Last Post: 04-23-2012, 07:22 AM
  2. Load csv data to Oracle through Access
    By acces2oracle in forum Access
    Replies: 1
    Last Post: 10-24-2011, 02:41 PM
  3. Converting access to oracle
    By wthoffman in forum Access
    Replies: 0
    Last Post: 03-08-2011, 11:05 AM
  4. Importing data from Oracle to access
    By indira in forum Access
    Replies: 3
    Last Post: 11-18-2010, 02:58 PM
  5. Oracle Discoverer to MS Access
    By money_213 in forum Import/Export Data
    Replies: 0
    Last Post: 06-27-2006, 12:43 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums