convert the access query to oracle sql

I'm trying to convert this query MS Access to oracle sql:

Sum (IIf (IsNull ([INV_MTL_MATERIAL_TRANSACTIONS1]! [PRIMARY_QUANTITY]), 0,-[INV_MTL_MATERIAL_TRANSACTIONS1]! [PRIMARY_QUANTITY])) AS PRIMARY_QTY


I tried to convert myself but still no luck.  Invalid number of arguments.


Sum (if (NVL (INV. MTL_MATERIAL_TRANSACTIONS1. PRIMARY_QUANTITY), 0,-INV. MTL_MATERIAL_TRANSACTIONS1. PRIMARY_QUANTITY)) AS PRIMARY_QTY


Can someone help me convert this request? Thank you.

The immediate if (IIF) statement said:

If primary_quantity is null return 0 for another return negative primary_quantity.

Since there is no difference at all between 0 and - 0 I would write it as:

sum (nvl (primary_quantity, 0) * - 1).

Change a minute later, never send before thinking.

Because you are just adding up the values obtained, he must not care about NULL values at all as aggregate functions generally ignore nulls, it should just be:

Sum (primary_quantity * - 1).

John

Tags: Database

Similar Questions

  • How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    WITH cte (col1, col2) AS
    (
    SELECT col1, col2
    FROM dbo. [tb1]
    WHERE col1 = 12
    UNION ALL
    SELECT c.col1, c.col2
    FROM dbo. [tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
    )
    DELETE one
    FROM dbo. [tb1] AS an INNER JOIN b cte
    ON a.col1 = b.col1

    Hello
    Something like this maybe:

    DELETE FROM dbo.tb1 a
     WHERE EXISTS (
      SELECT 1
        FROM dbo.tb1 b
      WHERE a.co11 = b.col1
          AND a.col2 = b.col2
       START WITH b.col1 = 12
      CONNECT BY b.col2 = PRIOR b.col1)
    

    Although you need to do here is to check that CONNECT it BY SELECT, returns records you wait first, then the DELETION should work too.

  • convert the access & quot; SQL & quot; for SQL

    Sorry, I know this isn't a problem of DW, but I hope that someone out there who's good with SQL can help me quickly.

    I'm (obviously) not well versed in SQL, but I know that some access methods conform to the real SQL. I can't understand how to recreate a query that works in SQL access, so I can use it just in my Recordset.

    The "Access SQL" is:

    TURN Count (tblData.fldAnswerArray) AS CountOffldAnswerArray
    SELECT 'count' AS Expr1
    OF tblData
    WHERE (((DateValue ([fldTimeStamp])) between January 1, 2006 # and # 30 September 2006))
    GROUP BY "count".
    TblData.fldAnswerArray PIVOT;

    DW Recordset window doesn't like it, however (enter a SELECT statement from a call to a procedure...).

    With my data that looks like this:

    fldRecordID fldUserID fldQuestionID fldAnswerArray fldTimeStamp
    2086 141 134 0 06/09/2006-13:48:43
    750 65 80 1 8/23 / 2006 08:54:03
    2038 136 74 0 05/09/2006 12:51:21

    I'm trying to meet up with a record that shows how many fldAnswerArray are 0 and 1 are based on the provided date range (which will be dynamic).

    For example:

    COUNTIES 0 1 (column heads)
    ------------------------------------------
    Total 29 13 (record resulting)

    Feasible?

    The most compatible SQL, you cannot use PIVOT.
    To get the exact result you described, follow these steps:

    SELECT 'total' AS [account], AS COUNT (fldAnswerArray) - SUM (fldAnswerArray)
    [0], SUM (fldAnswerArray) AS [1]
    OF tblData
    WHERE [fldTimeStamp] BETWEEN ' 2006-01-01' AND ' 2006 - 09 - 30 23:59:59.997'

    There is no point by selecting the word "total" in the recordset object, however.
    You can add to your application. It would also be preferable if you I
    the County and the total sum of responses and answers Yes, then did the subtraction
    client to determine the number of no responses.

  • How to modify data in "Result grid query" in Oracle SQL developer

    Dear,

    I would like to know how to change values directly in the query result grid.

    I use Oracle SQL Developer version 4.0.3.16

    Thank you

    Khalil

    EditValues.JPG

    I checked in SQL Developer 4 and I found no option to do this.

    I don't think it's available. You can open the table and add filters on each column and change. Or you can add where clause as suggested the link written by Jeff that I already gave. (http://www.thatjeffsmith.com/archive/2013/06/sql-developer-im-looking-at-a-record-how-do-i-edit-it/)

    Or you write update instructions.

    See you soon

    AJ

  • 0 and the decimal point in Oracle SQL

    Hello


    IM using Oracle Sql developer 'Oracle Database 11g Enterprise Edition Release 11.1.0.6.0' (I'm fairly new), im having trouble inserting '0 before 1' in the table, as well as with the decimal point
    I created a table with the following:

    CREATE TABLE employee
    (Employe_id number (4,0) NOT NULL primary key,)
    L_Name varchar2 (15).
    What varchar2 (10),
    Number of Pay_Rate (5);

    Then tried to insert this: insert into employee
    values ('003', 'Clarke', 'Michael', '13 h 00');
    which has been a success, but when I used the query select it to display the table, the result was not the same

    result:
    Employee_id L_Name what Pay_Rate
    1 13 Michael Clarke


    How can I ensure that the result looks like this (001 and 13 h 00):
    Employee_id L_Name what Pay_Rate
    001 Micheal Clarke 13.00

    Edited by: 936867 may 25, 2012 20:15

    Edited by: 936867 may 25, 2012 20:18

    936867 wrote:
    Sorry, I wanted to ask "what needs to be changed in the create table statement, so when I introduced through the 'Insert into' data is presented as above after the select query. I want the data to show as entered when I look at the table, I know that can use the select query to display data in the desired format.

    Then do not define the columns as a NUMBER, but as strings of VARCHAR2,
    but realize that you can't do arithmetic on strings.

    NUMBERS have no beginning or ending zeros but bites can contain what you want.

  • Migration: Access 2003 to Oracle SQL

    Dear all

    I would like to migrate from Access 2003, to Oracle 10 g. I use SQL Developer to the task and have reached the point to capture the XML file I exported from access. I need to create a repository of migration on the target database, and this causes problems that I have all of the necessary privileges.

    In the process, I have been informed that the migration from Access to Oracle are not easy to reach and in fact requires careful planning before execution. My goal is not really to transfer the data stored in the database file. I only really want to transform the logic of code SQL Oracle access. I was wondering if anyone could advise on the typical sides of success in the realization of this task.

    I migrated the same Access database to MS SQL Server some time ago and the process seems to be going smoothly. Would it not be reasonable then to migrate MS SQL to Oracle SQL, if this is easier?

    Any comments would be much appreciated.

    Thank you.

    M

    Use the option of rapid migration of SQL Developer...

    Here, you specify the mdb file and oracle database connection...

    and then it's just a matter of clicks

    you will be able to transfer your data from access to oracle...

    personally, I have not tried the ODBC option between oracle and access...

    will try that...

  • How to recover the vales separated by commas in the same column in Oracle SQL

    Dear members

    Please give me the solution for the below question

    Oracle table

    Ename product
    A 1,2,3
    B 1,2,3


    Product column has data like this only separated by commas

    Output should be like this.

    Ename, product
    A 1
    A 2
    A 3
    B 1
    B 2
    B 3

    Can we get the output above using just Oracle SQL select statement?
    I tried in Google I got an answer in SQL server, there is something called "Cross apply split" function, I'm not sure in Oracle.

    Welcome to the forum.

    Here is another interesting site, with lots of useful examples:
    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:2189860818012 #2654179200346949517

    Also, be sure to read the SQL and PL/SQL FAQ:
    http://forums.Oracle.com/forums/Ann.jspa?annID=1535

  • Rewrite the static query in dynamic SQL

    Can someone please help me write a dynamic query in pl/sql to SQL next?

    It's the game ('25', ' 04 "). the number of list might be n.
    The column_type varies from(1..6) and
    the from(1..6) of column_amt1 lines

     SELECT t.claim_no, t.cert_no, t.rec_code,
     (NVL(decode(t.column_type1,'25',NVL (t.column_amt1, 0)),0)+
        NVL(decode(t.column_type1,'04',NVL(t.column_amt1, 0)),0 )
      )  
      +
       (NVL(decode(t.column_type2,'25',NVL (t.column_amt2, 0)),0)+
        NVL(decode(t.column_type2,'04',NVL(t.column_amt2, 0)),0 )
       ) 
      +
       (NVL(decode(t.column_type3,'25',NVL (t.column_amt3, 0)),0)+
        NVL(decode(t.column_type3,'04',NVL(t.column_amt3, 0)),0 )
       ) 
      +
       (NVL(decode(t.column_type4,'25',NVL (t.column_amt4, 0)),0)+  
         NVL(decode(t.column_type4,'04',NVL(t.column_amt4, 0)),0 )
        ) 
      +
         (NVL(decode(t.column_type5,'25',NVL (t.column_amt5, 0)),0)+  
          NVL(decode(t.column_type5,'04',NVL(t.column_amt5, 0)),0 )
          ) 
      +
          (NVL(decode(t.column_type6,'25',NVL (t.column_amt6, 0)),0)+  
           NVL(decode(t.column_type6,'04',NVL(t.column_amt6, 0)),0 )) amt from test_detail t;
       
    Thanks in advance
    Hena

    But in fact, you should not dynamic SQL at all. What you could do is create a SQL type and use MEMBER OF:

    SQL> CREATE OR REPLACE
      2    TYPE test_detail_type_tbl
      3      AS
      4        TABLE OF varchar2(2)
      5  /
    
    Type created.
    
    SQL> select  case_id,
      2          item,
      3          code,
      4          case
      5            when type1 member of test_detail_type_tbl('25','04') then nvl(amt1,0)
      6            else 0
      7          end +
      8          case
      9            when type2 member of test_detail_type_tbl('25','04') then nvl(amt2,0)
     10            else 0
     11          end +
     12          case
     13            when type3 member of test_detail_type_tbl('25','04') then nvl(amt3,0)
     14            else 0
     15          end +
     16          case
     17            when type4 member of test_detail_type_tbl('25','04') then nvl(amt4,0)
     18            else 0
     19          end +
     20          case
     21            when type5 member of test_detail_type_tbl('25','04') then nvl(amt5,0)
     22            else 0
     23          end +
     24          case
     25            when type6 member of test_detail_type_tbl('25','04') then nvl(amt6,0)
     26            else 0
     27          end copay
     28    from  test_detail
     29  /
    
    CASE_ID    ITEM      CO      COPAY
    ---------- --------- -- ----------
    EML3371015 133761570 10        355
    EML3371015 133761570 10         20
    EML3371015 133761570 10          5
    EMC6369600 140328551 10         54
    EMH6353995 140328551 11      26.04
    
    SQL> select  case_id,
      2          item,
      3          code,
      4          case
      5            when type1 member of test_detail_type_tbl('25') then nvl(amt1,0)
      6            else 0
      7          end +
      8          case
      9            when type2 member of test_detail_type_tbl('25') then nvl(amt2,0)
     10            else 0
     11          end +
     12          case
     13            when type3 member of test_detail_type_tbl('25') then nvl(amt3,0)
     14            else 0
     15          end +
     16          case
     17            when type4 member of test_detail_type_tbl('25') then nvl(amt4,0)
     18            else 0
     19          end +
     20          case
     21            when type5 member of test_detail_type_tbl('25') then nvl(amt5,0)
     22            else 0
     23          end +
     24          case
     25            when type6 member of test_detail_type_tbl('25') then nvl(amt6,0)
     26            else 0
     27          end copay
     28    from  test_detail
     29  /
    
    CASE_ID    ITEM      CO      COPAY
    ---------- --------- -- ----------
    EML3371015 133761570 10        300
    EML3371015 133761570 10         20
    EML3371015 133761570 10          5
    EMC6369600 140328551 10          0
    EMH6353995 140328551 11       5.52
    
    SQL> 
    

    SY.

  • The using Excel and Oracle SQL Developer data import - I need help

    Dear friends,

    I use Oracle SQL Developer 1.5.1 and I need to import an Excel file into a database table. If I try to import this file into XLS format, fields and headers are properly presented and separated, but if I press the button 'Next', it does nothing - it remains stopped.

    I did some research here in this forum and it seems to me that when you try to import a file via the XLS format, Developer SQL has bugs. Is this correct?

    If I save the same file in the CSV format and try to import the same file, it moves forward, but SQL Developer is not separating headers and fields correctly. It includes all CSV fields into one - say Column0 and fields 1. TEST; 01/01/2000 under the same Column0.

    Save the file in the CSV format is not a problem, by taking a little time. But I don't know how to make Developer SQL import correctly. Could someone help me please? Thanks in advance.

    Best regards

    Franklin

    This is a known bug in 1.5.1 so use 1.5.0 to import from Excel.
    With respect to the CSV, make sure that you have the right setting in the Preferences - Database - settings of export of genres - delimiter of export custom .

    Have fun
    K.

  • MS Access 2010 and Oracle SQL Developer Version 4.0.3.16 error

    OS: Windows 7 Enterprise

    System type: 64-bit operating system

    I can't MS Access 2010 to work/open with SQL Developer version 4.0.3.16.

    ERROR when connecting to MS Access 2010 test

    "Status: failure Test failed: [Microsoft] [ODBC Driver Manager]" Data source name not found and no default driver specified".

    I added the 32-bit for MS Access ODBC data source I try to use with SQL version 4.0.3.16 with the "C:\Windows\SysWOW64\odbcad32.exe" application developer, but I still don't have the same error.

    I seems that Developer SQL version looking 4.0.3.16.is the 64-bit driver (ODBC Data Source) and I have no idea of directing SQL Developer version 4.0.3.16 to use the 32-bit driver (ODBC Data Source) when opening MS Access 2010

    Thanks in advance for your advice.

    the on-board jdk is 64-bit. To actually install a JDK 7 Java 32 bits, and then configure sql developer to use this JDK

    OR

    go back and get the 3.2 with a JDK embedded sql developer - it is a 32-bit, a

  • Remove the carriage returns in the text in an oracle SQL table column

    Hello

    Someone knows how to remove carriage returns in a text column in an Oracle table
    using SQL. So far, I have:

    Replace (text_field, Chr (13),' ')


    but this is ignored.

    (We use db 10g (enterprise Edition Release 10.2.0.4.0) and SQL * more 10.2.0.1.0)

    I would be very grateful for any help.

    -Mark

    How does the following:

    UPDATE table_name SET col_name = REPLACE (col_name, Chr (13), ");

    But if your new line is CR + LF, then use REPLACE (col_name, Chr (13) + Chr (10), ")

  • Error in the access query

    Hi guys, need help with this form.

    It is used to update and add employees to an access database. I took the script directly from maserting cf 4.5.
    I don't like the # s autour < cfform method = Post Action = "DB_Update_EE.cfm? Action = #FormAction #">."
    To enter an employee id field id, it returns "cannot display the Page.
    Any ideas?
    Here's the code: thanks in advance.

    < cfparam Name = "URL. Action"Default ="New">
    < CfSwitch Expression = "#Url.Action #" >
    < Cfcase Value = 'Load' >
    < name Cfquery = "TheRecord" Datasource = "NBProdReports" >
    Select * from tblUser where User_Id = #form. ID #.
    < / Cfquery >
    < / Cfcase >
    < cfcase Value = "Insert" >
    <! - insert the new record - >
    < cfquery Name = "InsertRecord" Datasource = "NBProdReports" >
    Insert in the tblUser (User_Last_Name User_First_Name, User_Id, Manager_Name,
    User_Type, User_Password) values ('#form.) LastName # ',' #form. FirstName #',' #Form.ID #',' #Form. ManagerName # ',' #form. UserType #',' #form. Password #'
    < / cfquery >
    <! - retrieve matching records - >
    < name cfquery = "TheRecord" Datasource = "NBProdReports" >
    Select * from tblUser where User_Last_Name = ' #form. LastName #' and User_First_Name
    = "#form.firstname #" and User_Id = ' #form. ID #' and Manager_Name = ' #form. ManagerName #'
    And User_Type = ' #form. UserType #' and User_Password = ' #form. Password #' order
    by User_Id
    < / cfquery >
    <! - check if it is the only record - >
    < cfif above 1 TheRecord.RecordCount >
    < cfloop Query = EndRowOptional = #TheRecord.RecordCount # StartRowOptional = #TheRecord.recordCount # "TheRecord" >
    < name cfquery = "TheRecord" Datasource = "NBProdReports" >
    Select * from tblUser where User_Id = # useridentifier #.
    < / cfquery >
    < / cfloop >
    < / cfif >
    < / cfcase >
    < cfcase Value = "Update" >
    <! - update registration - >
    < cfquery name = "UpdateRecord" Datasource = "NBProdReports" >
    Update tblUser Set User_Last_Name = ' #Form.lastName # ', User_First_Name and
    = ' #Form.FirstName # ', User_Id = ' #Form.Id # ', Manager_Name = ' #form. ManagerName #'
    User_Type = ' #form. UserType #' User_Password = ' #form. Password #' where useridentifier
    = #Form.Id #.
    < / cfquery >
    <! - remember registration - >
    < name Cfquery = "TheRecord" Datasource = "NBProdReports" >
    Select * from tblUser where User_Id = #Form.Id #.
    < / Cfquery >
    < / cfcase >
    < / CfSwitch >
    < isDefined ("TheRecord") cfif >
    < Cfset User_Last_Name = TheRecord.User_Last_Name >
    < Cfset User_First_Name = TheRecord.User_First_Name >
    < Cfset User_Id = TheRecord.User_Id >
    < Cfset Manager_Name = TheRecord.Manager_Name >
    < Cfset User_Type = TheRecord.User_Type >
    < Cfset User_Password = TheRecord.User_Password >
    < Cfset IdField = ' < Strong > used #TheRecord.User_Id # < / Strong > < Input Type = Hidden.
    ' Name = Id Value = #TheRecord.User_Id # > ">
    < Cfset Submit = "Update" >
    < Cfset culture = "Update" >
    < / cfif >
    < name Cfparam = default 'User_Last_Name"=" ">
    < name Cfparam = default 'User_First_Name"=" ">
    < name Cfparam = "User_Id" Default = "" >
    < name Cfparam = default "Manager_Name" = "" >
    < name Cfparam = 'User_Type' Default = "" >
    < name Cfparam = "User_Password" Default = "" >
    < Cfparam name = 'Submit' default = "Insert" >
    < cfform method = Post Action = "DB_Update_EE.cfm? Action = load ">"
    ID update:
    < input Type = Text Name = 'Id' Size = '3' >
    < input Type = Submit Value = "Submit" >
    < / cfform >
    < HR >
    < cfoutput >
    < cfform method = Post Action = "DB_Update_EE.cfm? Action = #FormAction #">"
    #IDField #.
    < table Border = 0 Cellspacing = 5 >
    < b >
    Last name < td > < table >
    < td >
    < input Type = Text Name = "LastName" Size = 20 = value ' #User_Last_Name # ">"
    < table >
    < /tr >
    < b >
    First name < td > < table >
    < td >
    < input Type = Text Name = "FirstName" Size = 20 = value ' #User_First_Name # ">"
    < table >
    < /tr >
    < b >
    < Td > user ID < table >
    < td >
    < input Type = Text Name = 'Id' Size = 20 = value ' # useridentifier #' >
    < table >
    < /tr >
    < b >
    Name of the < td > < table >
    < td >
    < input Type = Text Name = "ManagerName" Size = 20 = value ' #Manager_Name # ">"
    < table >
    < /tr >
    < b >
    Type of user < td > < table >
    < td >
    < input Type = Text Name = "UserType" size = 20 value =' #User_Type # ">"
    < table >
    < /tr >
    < b >
    the password for user < td > < table >
    < td >
    < input Type = Text Name = "Password" size = 20 value =' #User_Password #' >
    < table >
    < /tr >
    < b >
    < td > < table >
    < td >
    < input Type = Submit Value =' #Submit # ">"
    < table >
    < /tr >
    < /table >
    < / cfform >
    < / cfoutput >
    < HR >
    < a href = "DB_Update_EE.cfm? Action = New "> create a new record < /a >"

    It seems that the variables of culture is only set with the if statement where isDefined ("TheRecord")

    Consider giving culture a default with cfparam or change your code so that the form appears only when a variable culture was created.

  • Guyz I need to convert the database from ms access to oracle 10g

    Hello everyone... I wanan convert my access database to oracle 10g. As I create a form like OVERVIEW MONTHLY after the transfer to oracle 10 g... I wud really cud happy if a few b help me in this matter...
    I'm ready to send database... access to u people can check it out and get back to me with a useful solution!

    Hello

    Oracle SQL Developer migration

    Oracle SQL Developer integrates migration support, offering users the opportunity to migrate objects from database and data from MySQL, Microsoft Access and Microsoft SQL Server, Sybase to Oracle. This document details the installation steps to help prepare your environment for migration of database and provides a brief description of each of the 5 main steps of a migration.

    http://www.Oracle.com/technology/tech/Migration/Workbench/files/omwb_getstarted.html

    Concerning

  • Oracle SQL Developer 1.5.5 cannot save the file

    I change the contents of a column in a table, I get this trying to save the changes:

    Failed to save TABLE... ("Failed save the changes").

    This error will disappear when I do the same task in Oracle SQL Developer 1.1.3.
    Please help me!

    You can avoid the prompt variable substitution with 'set scan off' at the top of your script. Who does not have the problem that the generated update is not updated all the records because of the clause last ORA_ROWSCN. This can happen if someone else updates the row that you questioned it before you have saved your update, but there were other problems with the clause ORA_ROWSCN generated from memory.

    In addition, the reason why you couldn't see the new value when querying after the update was that developer SQL has replaced the bit '& cc' of the string with the contents of what you typed in the field of variable substitution. If it wasn't, then the value would have been the same after the update.

    theFurryOne

    Published by: thefurryone on August 6, 2009 12:41

  • The value of the indentation / tab size in Oracle SQL Developer

    I've been searching for an hour. Cannot understand this.

    Where, on the UI of the application or in the file 'product - preferences.xml', can I change the (tab) indentation size developer SQL 3? My organization uses PowerBuilder, and when I copy + paste our SQL PB (which uses the main tabs) in Oracle SQL Developer, it looks like crap. It would really help if I could change the code editor for a tab size equivalent to three spaces.

    And no, we cannot use spaces. :-)

    Thank you!

    (maybe SQL Developer 2 might have a field of size tab in 'Préférences')

    1.5.x, it is under Preferences - database - SQL Formatter - alignment and Indentation .
    However, at least in the 1.5.3 current, a bug ignores the preferences of the tab completely, so you are stuck with 2 spaces. If you can't wait until it gets fixed (with luck in the upcoming 1.5.4 or maybe 2.0), revert to a previous version.

    Kind regards
    K.

Maybe you are looking for