Missing right parenthesis using DECODE and SUBSTR

Hello,
Can anyone explain why I am getting missing right parenthesis when trying to execute this query
INSERT INTO LOCATION_INFO
(LOCATION,REGION)
SELECT SUBSTR(OLD_SYSTEM_SITE_CODE,1,2),  DECODE(SUBSTR(OLD_SITE_SYSTEM_CODE, 1, 2), 'CA', CHICAGO,'TX', DALLAS, NEW YORK)
FROM SITE_MAPPING_TABLE;Thanks for looking
Mike

INSERT INTO LOCATION_INFO
(LOCATION,REGION)
SELECT SUBSTR(OLD_SYSTEM_SITE_CODE,1,2),
       DECODE(SUBSTR(OLD_SITE_SYSTEM_CODE, 1, 2), 'CA', 'CHICAGO','TX', 'DALLAS', 'NEW YORK')
FROM SITE_MAPPING_TABLE;i think the CHICAGO, DALLAS, and NEW YORK are character strings and should be enclosed in single quotes

Similar Messages

  • Using DBMS_METADATA.GET_DDL get error: ORA-00907: missing right parenthesis

    Hi,
    I'm trying to extract schema DDL from a database (10.2.0.4.0 - 64bit Enterprise Edition on Solaris 10). I run the query below and get an ORA-00907: missing right parenthesis error.
    SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN ('TABLE_PARTITION','INDEX_PARTITION','LOB');
    This is the output when running the above in sqlplus worksheet
    select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects where object_type not in ('TABLE_PARTITION','INDEX_PARTITION','LOB')
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    removing the where clause gives the following:
    select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    Any pointers would be gratefully received. I know I could get the DDL out using exp/imp but I want to understand why I'm getting the missing parenthesis error.
    cheers,
    Ewan

    SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN You don't need an alias here. Get rid of " AS object_type" and it should work.

  • FOR UPDATE on updatable cursor and error: ORA-00907: missing right parenthesis

    Anyone run into this? I've searched the message board and bug db to no avail.
    - Using latest Oracle JDBC 2.0 compliant "thin" driver and Oracle 8.1.6 database.
    1) Using prepareStatement specifying an updatable cursor for something like "SELECT FNAME,LNAME FROM USERS FOR UPDATE OF FNAME,LNAME"
    2) Updating FNAME using updateString("FNAME","whatever"), and then calling updateRow() of the ResultSet yields:
    ORA-00907: missing right parenthesis
    If I remove the FOR UPDATE clause then everything works just fine.
    Workarounds/suggestions appreciated!
    Thanks,
    Ryan
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Andrew Edgar ([email protected]):
    I have this same problem!
    The error occurs when performing updateRow.
    The turning off of auto commit only gets the query to work but not the actual update.
    Will this be fixed in the next version of the Driver?<HR></BLOCKQUOTE>
    Here is the stack Trace I recieved:
    java.sql.SQLException: ORA-00907: missing right parenthesis
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
    at oracle.jdbc.driver.UpdatableResultSet.execute_updateRow(UpdatableResultSet.java:2135)
    at oracle.jdbc.driver.UpdatableResultSet.updateRow(UpdatableResultSet.java:1322)

  • Missing right parenthesis error when querying using a list of values

    Would anyone know why this statement gives the ORA-00907: missing right parenthesis error..?
    SELECT FIELD_X
    FROM TABLE_Y
    WHERE FIELD_X IN (
    'AJD'
    'RED'
    'ADF'
    'MOI'
    The reason why I wanted the AJD, RED, ADF, etc values on top of each other is because I need to add the single quotes around those terms in Excel before pasting them into the SQL statement (there are actually over 400 terms so above just shows a subset)

    Fortunately the SQL syntax is documented in the SQL manual
    { expr [, expr ]...
    | ( [expr [, expr ]] ...)
    }http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/expressions015.htm#i1033664
    Note the comma following each value in the syntax diagram and examples.

  • FOR UPDATE on scrollable cursor and error: ORA-00907: missing right parenthesis

    If change my query to have a FOR UPDATE and make it an updatable scrollable cursor I get an error on the updateRow() command saying "ORA-00907: missing right parenthesis"
    If I remove the FOR UPDATE it works OK.
    The problem I have is trying to update a CLOB from a ResultSet. If I do not upate any other column I get the error saying that the error"
    "ORA-22920: row containing the LOB value is not locked"
    I can get around this by adding FOR UPDATE. But if I add FOR UPDATE and try to update any non-CLOB column I get the 00907 error above.
    Hmmmm. So here is what I can and cannot do:
    - I CAN update the CLOB IF I update another column 1st and NO FOR UPDATE clause.
    - I CAN update the CLOB only if I have FOR UPDATE clause.
    - I CANNOT update just the CLOB without FOR UPDATE.
    - I CANNOT update any non-CLOB column with FOR UPDATE.
    What a pain in the ***! How am I to provide generic access to the applications being built on my DB layer. This is crazy!

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Andrew Edgar ([email protected]):
    I have this same problem!
    The error occurs when performing updateRow.
    The turning off of auto commit only gets the query to work but not the actual update.
    Will this be fixed in the next version of the Driver?<HR></BLOCKQUOTE>
    Here is the stack Trace I recieved:
    java.sql.SQLException: ORA-00907: missing right parenthesis
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
    at oracle.jdbc.driver.UpdatableResultSet.execute_updateRow(UpdatableResultSet.java:2135)
    at oracle.jdbc.driver.UpdatableResultSet.updateRow(UpdatableResultSet.java:1322)

  • Using Toplink with Oracle Spatial (missing right parenthesis error)

    Hi,
    I always get the following error when I try to create spatial query with toplink.
    Internal Exception: java.sql.SQLException: ORA-00907: missing right parenthesis
    Any idea ? Also, there is no trace of my point in the generated sql....
    Here is the generated query:
    SELECT ID, [...]
    FROM QUEBEC_CITY
    WHERE (MDSYS.SDO_NN(GEOMETRY, JGeometry (gtype=1, dim=2, rid=8307, NULL) = 'TRUE')
    ORDER BY ID ASC
    Here is my code... :
    double[] coord = new double[]{-71.25163d, 46.8527d};
    JGeometry point = JGeometry.createPoint(coord, 2, 8307);
    SpatialOperator nearestNeighbor = SpatialOperator.nearestNeighbor(session);
    ReadAllQuery query = new ReadAllQuery(UrbanEdgeDescriptor.class);
    ExpressionBuilder eb = query.getExpressionBuilder();
    Expression geom = eb.get("geometry");
    query.setSelectionCriteria(nearestNeighbor.buildExpression(geom, point));
    query.addAscendingOrdering("id");
    List<UrbanEdgeDescriptor> results = (List)db.getSession().executeQuery(query);
    System.out.println(results!=null);

    The problem is the toString() on JGeometry. It does not print out a complete description the database can use inline. It produces:
    JGeometry (gtype=1, dim=2, rid=8307
    To get JGeometry types to work in your queries the easiest solution is to use parameter binding so the literal representation is not used.
    Doug

  • UpdateRow(): ORA-00907 missing right parenthesis???

    This pertains to Oracle8i 8.1.7 JDBC Drivers JDK 1.2.x for NT (classes12.zip) that I just downloaded today from the website.
    I call rset.updateRow() after I update a particular column
    rset.updateString("col_name","whatever")
    and get the following SQLException message.
    ORA-00907: missing right parenthesis.
    I tried to call rset.updateRow() without doing an updateString() and it passes with no exception.
    I've looked at my very simply code over and over and don't see how any of it could be a problem. Is it possible that Oracle released this driver forgetting about a little ")" somewhere in the SQL that it sends to the database in this method?
    Again:
    (1) rset.updateString("col_name","whatever");
    rset.updateRow();
    throws the SQLException
    (2) rset.updateRow();
    is fine by itself
    null

    If you are using the FOR UPDATE in your SELECT stmt, there is a bug.
    See BUG:1811866
    Encountered the same problem myself.
    Was unable to find any further reference to this bug on Oracle's site. Is this still outstanding, and, if so, is there a target date for the fix?

  • OraOLEDB.Oracle GetRecordSet() throw "ORA-00907: missing right parenthesis"

    Hi,
    I am unfortunately working on an old VB6 app that is constructing a huge (11902 characters) ad-hoc SQL statement which is then passed to the GetRecordSet() method of my DBConnection. The app is using the OraOLEDB.Oracle provider. When the GetRecordSet() method is executed, however, I get the following error:
    ORA-00907: missing right parenthesis
    Now I have grabbed the contents of the string that is passed in to the GetRecordSet() function and have thoroughly examined it and there are no missing parens. Additionally, I am able to execute the select statement in Oracle SQL Developer as well as SQL*Plus, withou difficulty. So I am sure that the string is syntactically correct.
    I am beginning to suspect that something fishy is happening in the provider - perhaps the string is too long and it is getting truncated somewhere?
    Can anyone out there help me out?
    Thanks, Steve

    maybe the conversion you are trying to do is not valid especially in the first one into binary(1).
    check out the conversion table for CAST operator in the SQL REFERENCE of the documentation.

  • Error message ORA-0097  missing right parenthesis

    Dear all;
    Please what is wrong with this particular code because I keep getting the error message ORA-0097: missing right parenthesis
    pl/sql: sql statement ignored. Thank you
    spectification of package
    create or replace package NEW_INFORMATION is
    function get_total return number;
    procedure daily_tasks;
    function display_type_id return varchar2;
    end NEW_INFORMATION ;body of package
    create or replace package body NEW_INFORMATION  is
    function get_total return number is
    oput number(10);
    begin
      select count(unique (p1.p_id)) into oput
      from table_one p1 where p1.p_id in
        ('CYY','AIR, '');
    return oput;
    end;
    function display_type_id return varchar2 is
    used_cells varchar2(30);
    begin
    select unique(p1.p_id) as cells into used_cells
      from part p1 where p1.pl_id in
      ('CYY','AIR', '');
    return used_cells;
    end;
    procedure daily_tasks is
    name_id varchar2(20);
    temp_num number(6,2);
    production_daystotal number(6,2);
    result_first_cc_A number (7,2);
    begin
    name_id := display_type_id ();  -- used to call the function
    temp_num :=  get_total();  --used to call the function
    select name_id, trunc(first_partcal_A.initial_cc_A / temp_num over())  +  
    case
    when mod(first_partcal_A.initial_cc_A,temp_num over()) >= row_number() over(order by name_id) then 1
    else 0
    end
    from
    select round(total_as.t_as/prodmonths.proddaysinmonth) as inital_cc_A
    from
    (select count(*) as t_as from table_one p1 where p1.a_code = 'A') total_as,
    (select count(*) as proddaysinmonth  from
    (select mon_dt + level - 1 as dt,  to_char(mon_dt + level - 1, 'DY', 'NLS_DATE_LANGUAGE = ENGLISH') as dy_days from
    ((select trunc(to_date(m || '/' || a, 'MM/YYYY'), 'MM') as mon_dt
                          from
                          (select to_char(sysdate, 'MM') as m,
                                  to_char(sysdate, 'YYYY') as a  from dual)))
    connect by mon_dt + level - 1 <= last_day(mon_dt))
    where dy_days in ('MON', 'TUE', 'WED', 'THU'))prodmonths) first_partcal_A;
    order by name_id;
    end daily_tasks;
    end NEW_INFORMATION

    Pls try this
    CREATE OR REPLACE PACKAGE BODY new_information
    IS
       FUNCTION get_total
          RETURN NUMBER
       IS
          oput   NUMBER (10);
       BEGIN
          SELECT COUNT (UNIQUE (p1.p_id))
            INTO oput
            FROM table_one p1
           WHERE p1.p_id IN ('CYY', 'AIR', '');
          RETURN oput;
       END;
       FUNCTION display_type_id
          RETURN VARCHAR2
       IS
          used_cells   VARCHAR2 (30);
       BEGIN
          SELECT UNIQUE (p1.p_id) AS cells
                   INTO used_cells
                   FROM part p1
                  WHERE p1.pl_id IN ('CYY', 'AIR', '');
          RETURN used_cells;
       END;
       PROCEDURE daily_tasks
       IS
          name_id                VARCHAR2 (20);
          temp_num               NUMBER (6, 2);
          production_daystotal   NUMBER (6, 2);
          result_first_cc_a      NUMBER (7, 2);
       BEGIN
          name_id := display_type_id ();             -- used to call the function
          temp_num := get_total ();                   --used to call the function
          SELECT   name_id,
                     TRUNC (first_partcal_a.initial_cc_a / temp_num /*over()*/)
                   + CASE
                        WHEN MOD (first_partcal_a.initial_cc_a, temp_num) >=
                                              ROW_NUMBER () OVER (ORDER BY name_id)
                           THEN 1
                        ELSE 0
                     END
              INTO name_id,
                   temp_num
              FROM (SELECT ROUND (total_as.t_as / prodmonths.proddaysinmonth
                                 ) AS inital_cc_a
                      FROM (SELECT COUNT (*) AS t_as
                              FROM table_one p1
                             WHERE p1.a_code = 'A') total_as,
                           (SELECT COUNT (*) AS proddaysinmonth
                              FROM (SELECT     mon_dt + LEVEL - 1 AS dt,
                                               TO_CHAR
                                                  (mon_dt + LEVEL - 1,
                                                   'DY',
                                                   'NLS_DATE_LANGUAGE = ENGLISH'
                                                  ) AS dy_days
                                          FROM ((SELECT TRUNC
                                                           (TO_DATE (m || '/' || a,
                                                                     'MM/YYYY'
                                                            'MM'
                                                           ) AS mon_dt
                                                   FROM (SELECT TO_CHAR
                                                                   (SYSDATE,
                                                                    'MM'
                                                                   ) AS m,
                                                                TO_CHAR
                                                                   (SYSDATE,
                                                                    'YYYY'
                                                                   ) AS a
                                                           FROM DUAL)))
                                    CONNECT BY mon_dt + LEVEL - 1 <=
                                                                 LAST_DAY (mon_dt))
                             WHERE dy_days IN ('MON', 'TUE', 'WED', 'THU')) prodmonths) first_partcal_a
          ORDER BY name_id;
       END daily_tasks;
    END new_information;i have added INTO clause
    and removed over() after MOD and TRUNC

  • Objects Runtime Error -- Missing Right Parenthesis

    I am getting a RUNTIME error when using objects "Missing right parenthesis". The same script runs in Oracle 8i but will not run in the newly installed oracle8 enterprise edition. Oracle closed the support track saying they no longer support this version of Oracle. Unfortunately we have a client that we support and must match their environment. Does anyone know what might be missing or wrong with our environment?
    This is the code and error:
    declare
         l_users gl_jointype := gl_joinType ( gl_JoinOBJECT ( 1,'test'));
    begin
    insert into t select * from TABLE ( CAST ( l_users as gl_JoinType ) );
    END;
    gives me the following RUNTIME error
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 4
    We are running oracle: this is our SQL Plus blurb
    Connected to:
    Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
    With the Partitioning and Objects options
    PL/SQL Release 8.0.5.0.0 - Production
    This is the object and type creation:
    DROP TYPE gl_JoinType;
    CREATE OR REPLACE TYPE gl_JoinObject AS OBJECT
    ( NumberJoin NUMBER, -- Number for Dynamic Joins
    CharJoin VARCHAR(80) -- Varchar for Dynamic Joins
    CREATE OR REPLACE TYPE gl_JoinType AS TABLE OF gl_JoinObject;
    Create the table:
    CREATE TABLE t ( NumberJoin Number, CharJoin VARCHAR2(80));

    CAST and this use of TABLE are new features, not in 8.05 or 8.06 (I'm not sure when they were introduced, 8i I suspect.)
    I get the same error on my 8.06 instance:
    1 declare
    2 l_users gl_jointype := gl_joinType ( gl_JoinOBJECT ( 1,'test'));
    3 begin
    4 for x in (select * from TABLE ( CAST ( l_users as gl_JoinType ) ))
    5 loop
    6 dbms_output.put_line('x.NumberJoin = ' || x.NumberJoin);
    7 end loop;
    8* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 4

  • Missing right parenthesis?

    I have to create one table that has 106 columns, and I met one error that I can't understand. The error is ORA-00907, missing right parenthesis. But if I reduce the column number to 17, the table can be created. Why? Does Oracle XE limit the column number?

    Cause:
    A left parenthesis has been entered without a closing right parenthesis, or extra information was contained in the parentheses.All parentheses must be entered in pairs.
    Action:
    Correct the syntax and retry the statement.
    Peter.

  • SDO_Relate Missing right Parenthesis error

    Hi,
    I am trying to run this query
    SELECT a.ID
    FROM a
    WHERE
    (sdo_relate(a.shape,
    SdoGeometry(2003,8307,null,(1,1003,1),(-118.36170848374563,34.14009578993409,-118.36170848374563,34.14013981369518,-118.36165712269101,34.14013981369518,-118.36165712269101,34.14009578993409,-118.36170848374563,34.14009578993409)),
    'mask=anyinteract')='TRUE')
    and got an error "ORA-00907: missing right parenthesis".
    Does anyone know why?
    Thanks for any help.

    please try
    SQL> SELECT a.ID
    2 FROM a
    3 WHERE
    4 (sdo_relate(a.shape,
    5 SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3),
    6 SDO_ORDINATE_ARRAY(-118.36127, 34.1414971, -118.36127, 34.1420039))
    7 , 'mask=anyinteract')='TRUE') ;

  • Missing right parenthesis sql plus

    Hi, trying to create this table but *'Missing right parenthesis'* on the 16th line, which starts FOREIGN KEY comes up, I don't know where I'm going wrong. Help PLEASE!
    CREATE TABLE player_performance
    player_performance_id numeric(10)NOT NULL,
    player_id numeric(10) NOT NULL,
    match_id numeric(10) NOT NULL,
    two_points_attempts integer,
    two_points_made integer,
    three_points_attempts integer,
    three_points_made integer,
    free_throw_attempts integer,
    free_throws_made integer,
    minutes_played integer,
    fouls_made integer,
    rebounds integer,
    CONSTRAINT player_performance_PK PRIMARY KEY (player_performance_id)
    FOREIGN KEY (player_id) REFERENCES player (player_id);
    );

    Can you post this in the correct forum? E.g. PL/SQL
    (And try removing that first semi-colon)

  • Missing right parenthesis command error

    I'm getting a missing right parenthesis error on the following command on line 35 column 23
    SELECT DISTINCT OR_LOG.LOG_ID,OR_LOG.LOC_ID,PATIENT.PAT_NAME,V_MRN.MRN,PATIENT.PAT_ID
    ,TO_CHAR(OR_LOG.SURGERY_DATE,'MM/DD/YYYY') AS SURGERY_DATE,ROOM.PROV_NAME AS ROOM_NAME
    ,DIABETES.REF_BILL_CODE,DIABETES.PARENT_NAME,DIABETES.DX_NAME
      FROM EPICADM.OR_LOG OR_LOG INNER JOIN EPICADM.PATIENT PATIENT ON OR_LOG.PAT_ID=PATIENT.PAT_ID
      INNER JOIN EPICADM.PAT_OR_ADM_LINK ADM_LINK ON OR_LOG.LOG_ID=ADM_LINK.OR_CASELOG_ID
      INNER JOIN EPICADM.PAT_ENC_HSP ENC_HSP ON ADM_LINK.OR_LINK_CSN=ENC_HSP.PAT_ENC_CSN_ID
      INNER JOIN EPICADM.V_FV_MRN V_MRN ON OR_LOG.PAT_ID=V_MRN.PAT_ID
      INNER JOIN EPICADM.CLARITY_LOC CLARITY_LOC ON OR_LOG.LOC_ID=CLARITY_LOC.LOC_ID
      LEFT OUTER JOIN EPICADM.CLARITY_SER room ON OR_LOG.ROOM_ID = ROOM.PROV_ID
      INNER JOIN
    SELECT DISTINCT PAT_ID,REF_BILL_CODE,PARENT_NAME,DX_NAME
    FROM
    SELECT PROBLEM_LIST.PAT_ID,DIAB.REF_BILL_CODE,DIAB.DX_NAME,DIAB.PARENT_NAME
    FROM PROBLEM_LIST INNER JOIN
    SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
    FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
    INNER JOIN
    SELECT EDG_CURRENT_ICD9.CODE, CLARITY_EDG.DX_NAME,EDG_CURRENT_ICD9.DX_ID
    FROM EDG_CURRENT_ICD9
    WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG.REF_BILL_CODE BETWEEN '305' AND '305.99')
    )DIAB ON PROBLEM_LIST.DX_ID=DIAB.DX_ID
    UNION ALL
    SELECT MEDICAL_HX.PAT_ID,DIAB2.REF_BILL_CODE,DIAB2.DX_NAME,DIAB2.PARENT_NAME
    FROM MEDICAL_HX INNER JOIN
    SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
    FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
    INNER JOIN
    SELECT EDG_CURRENT_ICD9.CODE, CLARITY_EDG.DX_NAME,EDG_CURRENT_ICD9.DX_ID
    FROM EDG_CURRENT_ICD9 ON CLARITY_EDG .DX_ID=EDG_CURRENT_ICD9.DX_ID
    WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG.REF_BILL_CODE BETWEEN '305' AND '305.99')
    ) DIAB2 ON MEDICAL_HX.DX_ID=DIAB2.DX_ID
    ) CMB
    ) DIABETES ON OR_LOG.PAT_ID=DIABETES.PAT_ID
        WHERE (PATIENT.TEST_PATIENT_YN <> 'Y'
      OR PATIENT.TEST_PATIENT_YN     IS NULL)
      AND OR_LOG.PROC_NOT_PERF_C     IS NULL
      AND OR_LOG.LOG_ID=275957

    Apart from what Zac pointed out, I also believe you're missing out on referencing a table in this part of the query:
    INNER JOIN
    SELECT EDG_CURRENT_ICD9.CODE, CLARITY_EDG.DX_NAME,EDG_CURRENT_ICD9.DX_ID
    FROM EDG_CURRENT_ICD9 ON CLARITY_EDG.DX_ID=EDG_CURRENT_ICD9.DX_ID
    WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG.REF_BILL_CODE BETWEEN '305' AND '305.99')
    )DIAB ON PROBLEM_LIST.DX_ID=DIAB.DX_ID
    You were missing the table name and the join in the italicized and bold portion although I'm not very sure if this is the right table and join. I copied that from the Inner Join under the UNION ALL.
    I also think there's something wrong with the alias CMB. I don't see it being referenced in any of the joins.
    -Abhilash

  • PL-SQL Solve: Using INSTR and SUBSTR

    I am trying to work on this and cannot get a solution. Please help
    You have to use INSTR and SUBSTR to solve
    Question:
    You have the following acceptable value
    Numberic: 0-34
    80-100
    or Non Numberic X S U D- D D+
    Im have to use INSTR and SUBSTR functions to test that the value is a valid (as above) number before TO_NUMBER is called:
    SELECT TO_NUMBER('?? ') //HERE ?? and a space (for 100 etc) is for the values as above
    FROM DUAL
    WHERE ....INSTR(......)<=;
    (Hence if the number is true then number comes back or it says no rows)
    and also id non numberic it should also be tested.
    I am completely unsure about it but tried this
    SELECT TO_NUMBER('34 ')
    FROM DUAL
    WHERE INSTR('0123456789',1,1)<=9 (looking at first number ?)
    AND
    INSTR('0123456789',2,2)<=9
    AND
    INSTR('0123456789',3,3)=0;
    Please help

    We have the following value that we can use:
    Numeric: 0-34 and 80-100 only
    or Non Numberic X S U D- D D+
    Have to use INSTR and SUBSTR functions to test that the value is a valid
    (for now only trying to create a function which can later be put into a procedure.)
    SELECT TO_NUMBER('12 ') //e.g HERE 12 and a space for the values as above
    FROM DUAL
    the where clause looks at all three spaces to make sure values are correct (given number or non-numberic values only)
    (Hence if the number is true then number comes back (meaning true)
    or it says NO rows)
    If value is non numeric, test it to allow non numberic also.
    I am completely unsure about it but tried this
    SELECT TO_NUMBER('34 ')
    FROM DUAL
    WHERE INSTR('0123456789',1,1)<=9 (looking at first number ?)
    AND
    INSTR('0123456789',2,2)<=9
    AND
    INSTR('0123456789',3,3)=0;
    Something like this has to be done.....subst (instr, x,x,) i think mite help.

Maybe you are looking for

  • Not Enough Disk Space In Target Folder PLEASE HELP!

    I've produced a project with 10 menus and 21 tracks totaling 3.1 gigs and I can not burn it. Each time I get the remark "Not Enough Disk Space In Target Folder." I have 8.8 gigs on my internal harddrive and various externals. PLEASE SOMEBODY HELP. I

  • [Question] New Button from Toolbar which creates a new Outlook Mail?

    Hello together, I am faced with an issue by using a button from the toolbar in order to create a new outlook mail. Do you know the functionality from html? href="mailto:email@email?subject=CRM%20Feedback&body=Bereich%20(z.B.%20Opportunity%.... This c

  • UCCheck Showing error with XSL statement

    We are preparing to convert to Unicode and my XSL scripts are failing in UCCheck.  It appears my XSLT script (Z_EBPP_FINAL_OUTPUT_CSV) is fine, but the SAP created code behind it is failing (Z_EBPP_FINAL_OUTPUT_CSV=======XT) on the first line "<xsl:t

  • Aesthetic standards for power point on ItunesU

    Does anyone know if apple has a document or webpage that has the aesthetic qualities that should be reflected in a powerpoint if its expected to be viewable on an ipod? i.e.; 24 point font, high contrast colors, etc? Thanks mucho, Michell

  • Getting UTC date from NSDate

    I am using following function to convert NSDate in "UTC" date. -(NSString *)getUTCFormateDate:(NSDate *)localDate NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; [dateForma