Help:Modifying access sql to Oracle sql

Hello folks can anybody please help me in changing the following code to oracle.Thanks a million.
select
IIf(prorated_directpay = 0 And prorated_feepaid = 0,
"CASH DEPOSIT",
IIf(prorated_directpay <> 0 And prorated_feepaid = 0,
'NONCASH DIRECTPAY',
IIf(prorated_directpay <> 0 And prorated_feepaid <> 0,
"NONCASH FEE RECEIVED"))) AS recovery_flg,
Left$(patientmemberid, Len(patientmemberid) - 2) AS Pat Mem ID
from
table
WHERE (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_FEEAMT) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_DIRECTPAY) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_FEEPAID) <> 0))
Edited by: user11961230 on Nov 5, 2009 1:35 PM

user11961230 wrote:
Hello folks can anybody please help me in changing the following code to oracle.Thanks a million.
select
IIf(prorated_directpay = 0 And prorated_feepaid = 0,
"CASH DEPOSIT",
IIf(prorated_directpay <> 0 And prorated_feepaid = 0,
'NONCASH DIRECTPAY',
IIf(prorated_directpay <> 0 And prorated_feepaid <> 0,
"NONCASH FEE RECEIVED"))) AS recovery_flg,
Left$(patientmemberid, Len(patientmemberid) - 2) AS Pat Mem ID
from
table
WHERE (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_FEEAMT) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_DIRECTPAY) <> 0))
Or (((Debtor . LOB) = "MEDICAL") And ((Debtor . PRORATED_TRANAMT) = 0) And
((Debtor . PRORATED_FEEPAID) <> 0))
Edited by: user11961230 on Nov 5, 2009 1:35 PMYou bet, start by applying the lessons you learned in [YOUR LAST POST|http://forums.oracle.com/forums/message.jspa?messageID=3874940#3874940] and then come back with specific questions. Have you thought to use google to determine what the Access functions, which are not available in Oracle, do? After doing that, you can again google to see if you can find similar functionality in Oracle, if not ... we're here to help.

Similar Messages

  • Translating ms-access sql to oracle sql

    I would like to translate this ms-access sql to oracle sql.
    SELECT
    CStr(STUDENT_ID),
    FIRST_NAME,
    LAST_NAME,
    IIF(LEN(CLASS_CODE)=3,"Y","") AS "ELEMENTARY_SCHOOL",
    IIF(LEN(CLASS_CODE)=4,"Y","") AS "MIDDLE SCHOOL",
    FROM T_STUDENT
    Thanks in advance for your help.
    Sandra

    For an equivalent of IIF, look at CASE or DECODE. For LEN use LENGTH.
    A business rule that says elementary and middle schools can always be identifed by the length of their codes sounds rather unreliable, though.

  • Convert IIF Access SQL to Oracle SQL...

    I am in the process of converting a MS Access application to VB.Net with Oracle database behind. However I am having a problem converting an MS Access Query that contains IIF statements into an Oracle SQL command. Below is the MS Access SQL code:
    SELECT PDTABLE_132.UNIQUE_CLASH_ID, CISClashStatusTbl.Approval_Type AS Clash_Status, CISClashTypeTbl.Clash_Type, *IIf([TEMP_ACTION_DISCIPLINE] Is Null,"UNALOCATED",[TEMP_ACTION_DISCIPLINE]) AS ACTION_DISCIPLINE*, *IIf([CISDisciplineTbl].[Discipline] Is Null,[PD_2910A_PDTABLE_111].[DISCIPLINE_NAME],[CISDisciplineTbl].[Discipline]) AS TEMP_ACTION_DISCIPLINE*
    FROM ((((((((((((PDTABLE_132 INNER JOIN PD_2910A_PDTABLE_113 ON PDTABLE_132.MODEL_INDEX_NO_A = PD_2910A_PDTABLE_113.MODEL_INDEX_NO) INNER JOIN PD_2910A_PDTABLE_113 AS PD_2910A_PDTABLE_113_1 ON PDTABLE_132.MODEL_INDEX_NO_B = PD_2910A_PDTABLE_113_1.MODEL_INDEX_NO) INNER JOIN PDTABLE_119 ON PD_2910A_PDTABLE_113.MODEL_INDEX_NO = PDTABLE_119.MODEL_INDEX_NO) INNER JOIN PDTABLE_119 AS PDTABLE_119_1 ON PD_2910A_PDTABLE_113_1.MODEL_INDEX_NO = PDTABLE_119_1.MODEL_INDEX_NO) LEFT JOIN CISClashStatusTbl ON PDTABLE_132.IF_APPROVAL_STATUS = CISClashStatusTbl.Approval_Code) LEFT JOIN CISClashTypeTbl ON PDTABLE_132.RECENT_CLASH_TYPE = CISClashTypeTbl.Clash_Code) INNER JOIN PD_2910A_PDTABLE_112 ON PD_2910A_PDTABLE_113.AREA_INDEX_NO = PD_2910A_PDTABLE_112.AREA_INDEX_NO) INNER JOIN PD_2910A_PDTABLE_112 AS PD_2910A_PDTABLE_112_1 ON PD_2910A_PDTABLE_113_1.AREA_INDEX_NO = PD_2910A_PDTABLE_112_1.AREA_INDEX_NO) LEFT JOIN CISOwnerTbl ON PDTABLE_132.UNIQUE_CLASH_ID = CISOwnerTbl.UNIQUE_CLASH_ID) LEFT JOIN CISDisciplineTbl ON CISOwnerTbl.Discipline_Code = CISDisciplineTbl.Discipline_Code) LEFT JOIN PD_2910A_PDTABLE_111 ON PDTABLE_132.ACTION_DISCIPLINE = PD_2910A_PDTABLE_111.DISCIPLINE_INDX_NO) LEFT JOIN PD_2910A_PDTABLE_111 AS PD_2910A_PDTABLE_111_1 ON PDTABLE_132.DISCIPLINE_INDEX_A = PD_2910A_PDTABLE_111_1.DISCIPLINE_INDX_NO) LEFT JOIN PD_2910A_PDTABLE_111 AS PD_2910A_PDTABLE_111_2 ON PDTABLE_132.DISCIPLINE_INDEX_B = PD_2910A_PDTABLE_111_2.DISCIPLINE_INDX_NO
    ORDER BY PDTABLE_132.UNIQUE_CLASH_ID;
    Any help would really be appreshiated.
    Thanks in advance
    Simon
    Edited by: user8275408 on 21-Jan-2010 07:25

    Hi, Simon,
    Welcome to the forum!
    An Oracle equivalent of
    IIf(TEMP_ACTION_DISCIPLINE Is Null,"UNALOCATED",TEMP_ACTION_DISCIPLINE) AS ACTION_DISCIPLINEis
    CASE
         WHEN  TEMP_ACTION_DISCIPLINE Is Null
         THEN  'UNALOCATED'
         ELSE  TEMP_ACTION_DISCIPLINE
    END          AS ACTION_DISCIPLINE, This assumes that temp_action_discipline is a string. (All THEN and ELSE clauses must return the same data type, or at least compatable types.)
    CASE is the most general way of doing IF-THE-ELSE logic in Oracle SQL.
    For certain special situations, there may be shorter ways.
    Testing a variable to see whether it is NULL or not is one of those situations, so you could also say
    NVL2 ( TEMP_ACTION_DISCIPLINE
         , TEMP_ACTION_DISCIPLINE
         , 'UNALOCATED'
    This site noramally compresses whitespace. Whenever you post formatted text here (and code should always be formatted), type these 6 characters:
    (all small letters, inside curly brackets) before and after formatted sections.
    Edited by: Frank Kulash on Jan 21, 2010 10:41 AM
    After reading Bluefrog's answer, I realized that you're testing and possibly returning the same thing, temp_action_discipline.
    In that case, NVL, like Bluefrog suggested, is the best thing to do.  CASE and NVL2, as shown above, will give the right results, but they're more complicated than you need for this job.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Entity Framework - Code First - Migration - How to access SQL Server and Oracle using the same context?

    Hello,
    I use Entity Framework code first approach.
    My project is working fine with SQL Server. But, I want to access Oracle too. I want to switch SQL Server and Oracle in run time.
    I am able to access Oracle using "Oracle.ManagedDataAccess.EntityFramework.dl" in a new project.
    But, Is this possible to access SQL Server and Oracle in the same project.
    Thanks,
    Murugan

    This should be possible with a Code-First workflow.  In Code-First the database mapping layer is generated at runtime.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Access SQL Function in Oracle?

    Microsoft Access SQL has a function called LastOf which extracts
    data from a column within the last row returned when multiple
    rows are returned. This function works even when many tables are
    joined and only one of them returns multiple rows. Does Oracle's
    SQL implementation have anything like it?

    I can't find a reference to a LastOf function for MS-Access.
    Perhaps you are refering to the Last(expr) function or MoveLast
    method of DAO Recordset.
    Last behavior can be reached in one of several ways depending on
    the desired results, most depending on the ordering of the result
    set. Both Access and VB use the concept of a recordset, which is
    analogous to a CURSOR in Oracle.
    To use an implicit cursor, and only retreive the one row, you
    might use the sudo-colomn ROWNUM:
    SELECT my_col FROM my_tab WHERE ROWNUM = 1
    This would give you the first record of the result set, but there
    is no guarantee on which row it would be - so you might consider
    ordering the result set:
    SELECT my_col FROM my_tab WHERE ROWNUM = 1 ORDER BY my_col ASC;
    Which would return one row, the value of my_col being the
    smallest value in the table. Now might be a good time to talk
    aggrogate functions, such as:
    SELECT MIN( my_col ) FROM my_tab;
    which does the same thing as above.
    If all else fails, RTFM.
    -Kevin

  • MS Access Crosstab to Oracle SQL

    Gurus,
    I am trying to convert MS Access Query to Oracle SQL, What would be the Oracle query for this MS Access Crosstab Query?
    I am working on Oracle 10g so, I can't take advantage of oracle PIVOT function.
    Thank you
    Edited by: 951334 on Aug 10, 2012 6:52 AM
    Edited by: 951334 on Aug 13, 2012 5:51 AM

    if your crosstab columns are static you can use well-known technique like
    select tablespace_name,
    sum(case segment_type when 'TABLE' then bytes end) TABLES_BYTES,
    sum(case segment_type when 'INDEX' then bytes end) INDEXES_BYTES,
    sum(case segment_type when 'LOBSEGMENT' then bytes end) LOB_BYTES
    from dba_segments
    group by tablespace_name;
    for dynamic crosstab columns you require to build this query dynamically in application

  • Access SQL Query Problem - Pls help

    Hi,
    I'm connecting to an Access database and have a query which looks somehting like this:
    SELECT Accept.ACCEPT_NO,
         Accept.CURRENCY,
         Accept.INT_RATE,
         Accept.F_AMOUNT,
         Accept.DEALER,
         Accept.MATURITY,
         Accept.START_DATE,
         Accept.DEAL_DATE,
         Accept.DEALTICKET,
         Accept.BANK_NAME,
         Accept.CALC_DAYS,
         "2001/11/22" AS CurrentDate
    FROM Accept;
    It works fine without the line with CurrentDate so i'm sure something's wrong there. What i want to do is set CurrentDate as a constant ("2001/11/22") i dont have any experience with Access so any help you could give me would be greatly appreciated.
    Thanx in advance.

    I was able to successfully query an access 97 database using the following SQL:
    String sql = "SELECT emp.emp_fname, emp.emp_lname, '2001/11/22' AS CurrentDate FROM emp";don't know why your's wouldn't work. Was there a SQLException? Or are you trying to get it to work using the Access SQL editor?
    Jamie

  • Accessing SQL Server from Oracle

    I found an article:
    http:www.databasejournal.com/features/oracle/article.php/3442661
    It shows how to setup a connection from Oracle to SQL Server.
    I am new to Oracle Using SQL Loader and PL/SQL.
    I would like to use the SQL Loader in Oracle to load a table in SQL Server. It is my understanding that a ctl file is used and is called by an Oracle application.
    I would not have an Oracle application. I would like to use the ctl file to load the SQL Server table. Can someone point me on how to use the ctl file for SQL Server?
    Also, in PL/SQL would there be a connection string to connect to SQL Server when accessing a table.
    Is there a book or some documentation that would address the above?
    Thanks in Advance.

    that article shows you how to access SQL Server database through Oracle, therefore you have no need to use SQL Loader to load data from SQL Server bcos it can be queried directly by using simple select statement.
    If you want to load the data into Oracle just use CREATE TABLE ... AS SELECT ...
    in PL/SQL, what you need is the database link.
    Cheers,
    NH

  • Migration: Access 2003 to Oracle SQL

    Dear All
    I would like to perform a migration from Access 2003, to Oracle 10g. I am using SQL Developer for the task, and have reached the point of capturing the XML file that I exported from Access. I need to create a migration repository on the target database, and this is causing problems as I do not have all the necessary privileges.
    In the process, I have been advised that migrations from Access to Oracle are not easy to achieve, and in fact require careful planning before execution. My objective is not really to transfer the data stored within the database file. I only really want to convert Access logic into Oracle SQL code. I was wondering if anyone could advise on the typical odds of success in achieving this task.
    I migrated the same Access database to MS SQL Server some time ago and the process seemed to go smoothly. Would it be reasonable then to migrate from MS SQL to Oracle SQL if this is easier?
    Any feedback would be very much appreciated.
    Thank you.
    M

    Thanks for your response.
    I am not familiar with the intricacies of the process, I'm just following the instructions set out in the Oracle Migrating 3rd Party Databases white paper.
    In this document, a process is set out consisting of steps that export an Access database, and then capture it to an Oracle user area with appropriate privileges. The process is achieved through Oracle SQL Developer.
    I'd be very grateful if you could expand on your answer if there is a better way of translating Access queries into Oracle SQL. I am aware that an Access front-end is capable of connecting with an Oracle database to execute queries, however, there are considerable limitations in the use of Access that I would like to avoid - hence the migration.

  • Access SQL-Server Data from Oracle 10gXE

    Hello,
    I want to access sql-server data from oracle 10g XE. I need the same functionality provided by Sql-server by Linked Servers, by which we can query on any data source(oracle, Excel, Access).
    do, Oracle 10gXE provide us with same functionality ???
    any pointers ???

    Yes, it does work with Express Edition.
    Here is a thread from the XE forum with examples.
    Re: Database Link to MS Access
    They refer to a MS Access database, but the procedure is the same.
    Doug

  • Oracle access sql syntax

    Hi,
    I am migrating access database to oracle 9i. Do you know of any changes to access sql syntax for it to use oracle backend?

    Very general question. It of course depends on the SQL you use. They are not 100% compatibile. The workbench will create the necessary link tables on your behalf, but you may need to update the SQL in you Access application code. Also you might have to tune your access application to work better in a client/server mode, e.g. if you where doing a join of two tables you would want that to occur on the server not on the client. This depends how you interface/bypass the jet engine. These issues are common whether the backend is Oracle or SQL Server for that matter.
    This should become obvious during your testing.
    Donal

  • How to connect access database through oracle sql prompt

    i want to connect access database via oracle , i am trying to import all the data in Access table into oracle table how it is possible .
    A.R

    The simplest way, if You have already created tables in Oracle DB, is to open the Access MDB, link Oracle tables via ODBC and build a query to append rows reading from Access tables to Oracle tables.
    Hope this helps
    Max

  • Help Modifying SQL Query

    We just upgraded from Crystal Reports 8.0 to 2008 and are unable to modify the SQL query for any of our old Crystal Report files.  I can view the query by going to "Database", "Show SQL Query..." but am unable to edit the SQL statement in any way.
    If there a setting within "Options" or anywhere else that has this locked?  Is there another place with the application that allows me to edit the SQL Query?  I looked at the "Select Expert" but none of my WHERE elements show up there.

    The SQL query cannot be modified. (It is my understanding that you could in older versions... Not sure in which version that changed.)
    The latest versions of CR allow the use of SQL Commands. SQL Commands allow you to "paste" the SQL generated by CR and modify it or write your own SQL from scratch.
    HTH,
    Jason

  • Help on accessing Oracle object !

    Hi,
    Looking for a help in accessing oracle object using JDBC. I've the following object defined in Oracle.
    TYPE ty_ctg_prod AS OBJECT(
    PROD VARCHAR2(40 ),
    NODE_ID NUMBER ,
    CTG_ID NUMBER );
    TYPE ctg_PROD_ary AS VARRAY (50) OF ty_ctg_PROD;
    The procedure out parameter is returning :
    x_ctg_prod_ary OUT ctg_prod_ary
    Do I need to use a OracleTypes.STRUCT API Or oracle.sql.ARRAY to access data in this scenario.
    Any pointers will be highly appreciated.
    Thanks,
    Shamik

    // Get the object1 value from the second column col_object1
                oracle.sql.STRUCT object1 = (oracle.sql.STRUCT)collabstatement.getObject(2);
                // Get the object1 values from each row
                Object[] object1Values = object1.getAttributes();
                // Get the first value of object1, which is a string
                String str = (String)object1Values[0];
                // Get the second value of object1, which is of the type object2
                oracle.sql.STRUCT object2 = (oracle.sql.STRUCT)object1Values[1];
                // Get the values of object2
                Object object2Values[] = object2.getAttributes();
                str = (String)object2Values[0];
                BigDecimal num =  (BigDecimal)object2Values[1];you can also use :oracle.sql.Datum[] attrs = oracleSTRUCT.getOracleAttributes();more info :
    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/objects/ObjectTypes.html

  • Problem accessing SQL Express 2008 R2 after VS package install

    I've written an application package in Visual Studio 2010 which requires SQL Express 2008 R2. I've also created a separate setup package and set SQL Express as a prerequisite. Everything runs as expected except that after the install on target machine
    I do not have adequate permissions in SQL to attach the database or set up the user via SQLCMD script. This happens on WIN 7 and up. I know it is a permissions issue with the default install of SQL but do not know how to otherwise perform the install and make
    it work. Looking for someone to walk me through and resolve this issue.

    Hi Zanith,
    Actually this forum is to discuss the VS IDE issue.
    >> Everything runs as expected except that after the install on target machine I do not have adequate permissions in SQL to attach the database or set up the user via SQLCMD script
    Based on your description, the important issue would be related to the permission, as my understanding, it would be related to the SQL Server setup or configuration.
    So my suggestion is that you’d better post this issue to the SQL Server forum.
    https://social.technet.microsoft.com/Forums/en-US/home?forum=sqlgetstarted
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlexpress
    I also found two cases about the SQL Server permission issue.
    Reference:
    http://stackoverflow.com/questions/9185142/sql-server-2008-r2-express-permissions-cannot-create-database-or-modify-users
    http://serverfault.com/questions/53645/don-t-have-permission-to-access-sql-server-express-2008
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Dynamic addressing in Empty BPEL

    hi I am trying to implement dynamic addressing in Empty BPEL(because my BPEL gets input from JMS queue so there is no requirement of Client) But without the client partner link(which BPEL generates in case of syn or async BPEL) i am not able to imple

  • Dv2000 No Power, No signs

    I have a HP Dv 2000 series Special edition ( KC448UA / dv2740se) This laptop does not power on what so ever. I have already tried to clear the CMOS but still nothing. It also does not give out any signs, no lights flashing, or any kind of noise what

  • Too big a file???

    My daughter is doing an anthology for her school. There is a page for each student. For each page she scans a writing sample, a drawing and a photo, saves them as TIFFs, and then puts them in the template she has made up. It's been saved as a continu

  • Old silver door mac will not power up. I just want to pull a few files off!

    I cannot get my old silverdoor mac to boot up. A light comes on for a second in the middle of the on button and then nothing. I only want to boot it up to pull 1 little very important file. When I imported my itunes library onto my new mac I didn't b

  • Adobe flash player update notification

    I have the latest version of Google Chrome on a Mac OSX.  I just got this pop-up on my screen. Is it legitimate, or might it contain malware?Is