Why ORA-00907?

Sorry for my english, I've tried the following query in TOAD and it works OK, but i try the same from vb.net using oraoledb and error ORA-00907 appears.
select M.NRO_ASIENTO as N_Asiento ,
(select count(ASI.NRO_ASIENTO) FROM dgo_asientos ASI WHERE ASI.NRO_ASIENTO <= A.NRO_ASIENTO and ASI.TIPO_ASIENTO='002') as ordenAsiento
FROM dgo_movimientos M, dgo_asientos A
WHERE A.EJERCICIO= M.EJERCICIO and A.NRO_ASIENTO= M.NRO_ASIENTO
any ideas??
thank you

I also get the ORA-00907 with the query show below. It fails in both 9.2.0.2 and 9.2.0.4. It works fine using SQL*PLus and Micrcosoft's MSDAORA driver (!) against a 9.2.0.1 database and Microsoft .NET Framework v1.0.3705.
Tony Bravo
SQL> r
1 select SUM(case when emad.EMAD_ADJUSTMENT_CD = 'GI'
2 then empo.EMPO_BASIC_PAY * cora.CORA_MAX_ADJUSTMENT / 100
3 else 0 end) as SumGIAvailable,
4 SUM(case when emad.EMAD_ADJUSTMENT_CD = 'MI'
5 then empo.EMPO_BASIC_PAY * cora.CORA_MAX_ADJUSTMENT / 100
6 else 0 end) as SumMIAvailable,
7 SUM(case when emad.EMAD_ADJUSTMENT_CD = 'MI'
8 then empo.EMPO_BASIC_PAY * emad.EMAD_ADJUSTMENT_VALUE / 100
9 else 0 end) as SumMISpent,
10 SUM(case when emad.EMAD_ADJUSTMENT_CD = 'CAD'
11 then emad.EMAD_ADJUSTMENT_VALUE else 0 end) as SumCADSpent
12 from PBCS_EMPLOYEE_POSITIONS empo,
13 PBCS_EMPL_COMP_REVIEWS emco,
14 PBCS_EMPL_COMP_ADJUSTMENTS emad,
15 PBCS_COMP_ADJUSTMENT_RANGES cora
16 where empo.EMPO_EMPLOYEE_ID = emco.EMCO_EMPLOYEE_ID
17 and empo.EMPO_PERIOD_ID = emco.EMCO_PERIOD_ID
18 and emco.EMCO_REVIEW_ID = emad.EMAD_REVIEW_ID
19 and emad.EMAD_ADJUSTMENT_CD = cora.CORA_ADJUSTMENT_CD
20 and emco.EMCO_PERIOD_ID = cora.CORA_PERIOD_ID
21* and empo.EMPO_PERIOD_ID = 4
SUMGIAVAILABLE SUMMIAVAILABLE SUMMISPENT SUMCADSPENT
10813.14 27726 9460 17002

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.

  • ORA-00907 in a simple query from dual

    Hi,
    Anybody knows the reason for obtain ora-00907 when we enclose between parenthesis a SQL sentence whith an orderby clause?. Look at the last example:
    --> SQL fine
    select 'A' zz from dual order by 1;
    (select 'A' zz from dual) order by 1;
    select * from (select 'A' zz from dual order by 1);
    --> ORA-00907     Why?
    (select 'A' zz from dual order by 1);
    Regards
    Carlos

    you don't need order by in inlinew view
    if you want order by use
    select * from (select 'A' zz from dual ) order by 1;

  • 'Order By' in Exists / Not Exists condition causing ORA-00907 in Apex4.1.1

    Hi Guys,
    We have just upgraded from apex 3.2.1 to 4.1.1. on Oracle DB V11.2.0.1, while testing the apps in apex, I come across this problem.
    When I have a page process that has a condition defined.
    When Condition Type is Exists (SQL query returns at least one row) or Not Exists (SQL query returns no rows) and the Expression 1 is a query with an 'Order By' clause, e.g.
    SELECT 123 FROM DUAL
    ORDER BY 1
    When the process is triggered, Apex 3.2.1 would evaluate the condition and run the process just fine, however Apex 4.1.1 would throw an error : ORA-00907: missing right parenthesis
    I totally understand that an Order by clause in an Exists or Not Exists condition is unnecessary and agree that they shouldn't be there in the first place.
    But unfortunately I am dealing with other developers codes and these conditions have been coded like these, probably from copy & paste codes.
    Saying that, I also believe that an Apex upgrade should not stop anything that is working in previous releases without warning or provide a workaround, right?
    I don't know if this affects other types of artifacts that can have a condition in apex when upgrading from 3.2.1, e.g Regions/Items/Computations/Validations etc.
    Does anyone else get this behaviour? and is there an easy solution to fix these?
    Ideally I don't want to go through all processes (and whatever other artifacts might be affected too) in all apps in all workspaces to check the condition type and remove the 'Order By' clause manually.
    Thanks for any advises
    Just did some more testing
    'Computation' , 'Validations', 'Processes' and 'Branches' have the same problem, 3.2.1 takes 'Order By' fine in Exists/Not Exists condition, but 4.1.1 throws error.
    'Regions', 'Buttons', 'Items' have consistent behaviour - both 3.2.1 and 4.1.1 throw error ORA-00907: missing right parenthesis, when page is rendered.
    Edited by: Danny on 25/04/2012 20:07

    Hi Danny,
    that's interesting. I just had a look what happens when you use an EXISTS or NOT EXISTS condition type. The following final SQL statement will be generated with your above example. You can also see that if you run your application in debug mode.
    select count(*) from sys.dual where exists (select 123 from dual order by 1)Executing that statement in SQL*Plus will also show the ORA-00907 error. It appears that the SQL parser doesn't allow an order by clause in an EXIST clause.
    I wonder why this should have worked in previous versions, but I can only suspect that in the past we may just have executed
    select 123 from dual order by 1which can be slightly slower because with the new EXISTS statement the SQL engine can stop processing earlier if it finds a record.
    We try to be backward compatible as much as possible, but I doubt that we will change that back to the way it was before because of the performance penalty 99.9% of our customers would face.
    Possible Workaround: You might be able to use the new "Application Search" to scan your application for "order by" and fix it for all hits where the attribute name is "Expression 1".
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • ORA-00907 MISSING RIGHT PARANTHESIS

    Dear all,
    The query
    FLASHBACK TABLE schema.table_name TO TIMESTAMP('18-JAN-2008 18:55:58','DD-MON-YYYY HH24:MI:SS');
    gives me the error
    ORA-00907 MISSING RIGHT PARANTHESIS
    WHAT AM MISSING HERE ?
    kAI

    Pretty much the usual
    You grossly violate forums etiquette by
    - not posting a version and a platform
    - not looking up the error message
    - not verifying syntax
    - by SHOUTING most of your question
    in short you demonstrate you are utterly lazy and utterly rude.
    Doing so, you have now entered as a runner up in the competition to qualify for the biggest abuser of this forum by not doing anything yourself.
    Yes, I know you will be angry. And why will you be angry? Because I state the truth!
    People like you should be banned from this forum completely.
    Sybrand Bakker
    Senior Oracle DBA

  • Passing Multiple Parameters values to a command- ORA-00907

    I am trying to create a report in CR2008 using a SQL query against an Oracle 9i database. The field ( im."Report_No") I am using the parameter ({?CaseNo}) on is a VarChar, even though it only contains numbers. The number is 9 digits in the database (like 123456789), but is used differently by the users (12-456789) omitting the 3rd character. The query below works with a single value in the parameter, but returns ORA-00907 when multiple values are used.
    SELECT im."Report_No"
    --, ic."Report_No" Redundant from IM
    , im."Reported_Date"
    , im."Assignment"
    , CASE
    WHEN ip."Address" IS NOT NULL
    THEN ip."Address"
    WHEN ip."Address" IS NULL
    AND ia."Address" IS NOT NULL
    THEN ia."Address"
    WHEN ip."Address" IS NULL
    AND ia."Address" IS NULL
    THEN im."Location"
    END Address
    , CASE
    WHEN ip."City" IS NOT NULL
    THEN ip."City"
    WHEN ip."City" IS NULL
    AND ia."City" IS NOT NULL
    THEN ia."City"
    WHEN ip."City" IS NULL
    AND ia."City" IS NULL
    THEN im."City"
    END City
    , CASE
    WHEN ip."State" IS NOT NULL
    THEN ip."State"
    WHEN ip."State" IS NULL
    AND ia."State" IS NOT NULL
    THEN ia."State"
    WHEN ip."State" IS NULL
    AND ia."State" IS NULL
    THEN 'NV'
    END State
    , CASE
    WHEN ip."ZIP_Code" IS NOT NULL
    THEN ip."ZIP_Code"
    WHEN ip."ZIP_Code" IS NULL
    AND ia."ZIP_Code" IS NOT NULL
    THEN ia."ZIP_Code"
    WHEN ip."ZIP_Code" IS NULL
    AND ia."ZIP_Code" IS NULL
    THEN im."ZIP_Code"
    END Zip_Code
    , ip."First_Name" || ' ' || ip."Last_Name" Name
    , ip."Involvement"
    FROM "TIBURON"."RP_INMAST_VIEW" im
    INNER JOIN "TIBURON"."RP_INCASE_VIEW" ic
    ON im."Report_No" = ic."Report_No"
    INNER JOIN "TIBURON"."RP_INPER6_VIEW" ip
    ON im."Report_No" = ip."Report_No"
    LEFT OUTER JOIN "TIBURON"."RP_INADRS_VIEW" ia
    ON ip."INPER6_ID" = ia."INPER6_ID"
    WHERE im."Report_No" IN (substr({?CaseNo}, 1, 2))|| '0' || (substr({?CaseNo}, 4, 6))
    AND ip."Involvement" = '{?InvCode}'
    Thanks in advance for any help.
    Edited by: James Cody on Dec 29, 2011 8:49 PM

    Hi James,
    Does the query accept commad separated values? Could you check if the query runs fine (with multiple values passed as a command separated string) on the database (using SQL+)?
    -Abhilash

  • 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?

  • 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)

  • Error in form ora- 00907

    hi all
    i have work in the oracle form and genrating the dynamic query in the pl/sql block and to accessing in the remote so use the statemet
    dbms_sql.parse(src_cur, str,1);
    st_cur is cursor define
    str is my string pass;
    1 insad of dbms_sql.native bas in the remote data are access
    way is error is give and what is the solutaion.
    help
    thanks;

    Could you list the exact code you are using as the error is:
    ORA-00907: missing right parenthesis
    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.

  • ORA-00907: missing right parenthesis when using group by clause with xmlagg

    I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
    select xmlelement("Mitigation",
                    xmlelement("m_szMethodName",tm.DisplayName),
                    xmlelement("SubstanceInterferenceProtocolList",
                                (select xmlagg(xmlelement("MitigationProtocol",
                                        xmlelement("m_szMethodName",tm.DisplayName),
                                        xmlelement("m_szInterferenceProtocolName",tmp.protocol_name),
                                        xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code),
                                        xmlelement("m_ProtocolParameters",
                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                xmlelement("m_Consumables",
                                                    xmlelement("Consumable",
                                                        xmlelement("m_szConsumId", xrl.rgnt_pack_name),
                                                        xmlelement("m_szProductCode",xrl.pack_prod_code),
                                                        xmlelement("m_nVolume",tmp.fluid_vol),
                                                        xmlelement("m_szProtocolStep",xps.protocol_step_name))),
                                                    xmlelement("m_ProtParamList",
                                                        xmlagg(
                                                        xmlelement("ParameterValues",
                                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                            xmlelement("m_Time",xpsd.parameter_ntime_value))
                                                        group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)
                    order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep )
                    from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl,
                    xpr_protocol_settings xps, xpr_protocol_settings_default xpsd
                    where tmp.ccd_test_id = tm.ccd_test_id
                    and tmp.ccd_test_id = xrl.ccd_test_id
                    and tmp.pack_prod_code = xrl.pack_prod_code
                    and tmp.intf_type = 1
                    and xps.protocol_name = xpsd.protocol_name
                    and xps.protocol_step_name = xpsd.protocol_step_name
                    and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist
                    and xps.protocol_name =  tmp.PROTOCOL_NAME
    from XPtoXPRTdef_defn_mapping tm
    where tm.DisplayName = 'SYPH'If I remove the xmlagg clause along with the group by clause, the query runs fine and give me the output.
    But in that XML format of the output is incorrect for my application.
    Could someone help here?

    Hi,
    userAtoZ wrote:
    I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
    ... xmlagg(
    xmlelement("ParameterValues",
    xmlelement("m_szProtocolName",tmp.protocol_name),
    xmlelement("m_Time",xpsd.parameter_ntime_value))
    group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)Please don't post unformatted code. When posting any formatted text on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    If the code above were formatted well, so that you could match each '(' with its closing ')', it would look something like this:... xmlagg ( xmlelement ( "ParameterValues"
                        , xmlelement ( "m_szProtocolName"
                                       , tmp.protocol_name
                        , xmlelement ( "m_Time"
                                       , xpsd.parameter_ntime_value
    group by tmp.ccd_test_id
                        ,     tmp.intf_mtrl_prod_code
    This is exactly what you posted, only the whitespace has been changed.
    This makes it clear that the GROUP BY is inside the parentheses with the argument to XMLAGG.  You can have an ORDER BY clause there, but not a GROUP BY clause.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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)

  • 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.

  • Trying to use authorization schema but getting ORA-00907: missing right par

    Hi,
    I am fairly new to HMTLDB. I am busy going through the Issue Tracker Tutorial. I am on the last part of Tutorial. This part involves authorizing a user based on their roles in the company.
    I now keep getting the following when I load my pages
    ORA-00907: missing right parenthesis
    Error ERR-1082 Error in executing authorization scheme code.
    How do I go about debugging this error not sure where to start?

    if this helps I am using this PDF
    http://www.oracle.com/technology/products/database/application_express/pdf/issue_tracking_tutorial_1.6_0.pdf
    if you open the PDF file I am stuck on page 72-74. The page I am trying to open while i am logged on as FUNKYMONKEY is Page 4 which is in the documentation

  • ORA-00907 Missing right parenthesis? Buh?

    Alright, so I've got this bit of PL/SQL code....
    <i><font face="verdana" size="-1" color="#005F4B">declare
    popname_first VARCHAR2(4000);
    popname_second VARCHAR2(4000);
    poppage_first VARCHAR2(16);
    poppage_second VARCHAR2(16);
    begin
    select rname into popname_first from (select reportname rname from dms_occurances order by occurances desc) where rownum = 1;
    select rname into popname_second from (select reportname rname from dms_occurances order by occurances desc) where rownum = 2;
    select pn into poppage_first from (select pageno pn from dms_occurances order by occurances desc) where rownum = 1;
    select pn into poppage_second from (select pageno pn from dms_occurances order by occurances desc) where rownum = 2;
    </font></i>
    ....and a range of htp.print statements after that.
    The problem is that I'm getting a ORA-00907 error telling me I'm missing my right parenthesis on line 11 (the first of the select assignment lines). Obviously this is not the case. I suspect it has something to do with the way I'm doing the query, but I can't think of any other method for it.
    Please help!

    Are you aware that the predicate 'WHERE/AND ROWNUM = 2' will return exactly zero rows?

  • ROWNUM, ORDER BY, ORA-00907: missing right parenthesis

    M&ouml;chte man nur die ersten 3 Datenzeilen nach einer Sortierung haben, f&uuml;ttert man den SQL Server leicht und verst&auml;ndlich beispielsweise mit:
    SELECT * FROM (SELECT TOP 3 * FROM History ORDER BY Start DESC) AS query1 ORDER BY Start;
    Oracle, so habe ich festgestellt, kapiert das nicht und m&ouml;chte &uuml;berhaupt alles ganz anders. So habe ich herausbekommen, dass es bei Oracle kein TOP, sondern ein ROWNUM gibt. Erste Versuche scheiterten, weil ROWNUM vor ORDER BY ausgef&uuml;hrt wird, die Sortierung also erst nach ROWNUM erfolgt.
    Aber daf&uuml;r soll es eine L&ouml;sung geben, die auch &uuml;berall in Foren aufgef&uuml;hrt wird. Doch leider funktioniert auch die angebliche L&ouml;sung nicht:
    SELECT * FROM (SELECT * FROM History ORDER BY Start) WHERE ROWNUM &lt;= 3;
    {color:#ff0000}ORA-00907: missing right parenthesis{color}
    Was ist denn nun wieder falsch?

    You can check here ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.44
    satyaki>
    satyaki>
    satyaki>with History
      2  as
      3    (
      4      select to_date('14.07.06','DD.MM.YY') START_R, to_date('14.07.06','DD.MM.YY') ENDE, 'HZJ' GT_TYP, 2340 GT_ID, 4 SOLL, 0 ANFANGSIST, 4 ENDEIST, 2 STATUS from dual
      5      union all
      6      select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'JQA', 1234, 1, 0, 1, 2 from dual
      7      union all
      8      select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 1, 0, 1, 2 from dual
      9      union all
    10      select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'JQA', 1234, 1, 0, 1, 2 from dual
    11      union all
    12      select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 1, 0, 1, 2 from dual
    13      union all
    14      select to_date('17.07.06','DD.MM.YY'), to_date('17.07.06','DD.MM.YY'), 'HZJ', 2340, 4, 0, 4, 2 from dual
    15    )
    16  select *
    17  from (
    18          select *
    19          from History
    20          order by START_R desc
    21       )
    22  where rownum <= 3;
    START_R   ENDE      GT_      GT_ID       SOLL ANFANGSIST    ENDEIST     STATUS
    17-JUL-06 17-JUL-06 JQA       1234          1          0          1          2
    17-JUL-06 17-JUL-06 HZJ       2340          1          0          1          2
    17-JUL-06 17-JUL-06 JQA       1234          1          0          1          2
    Elapsed: 00:00:00.99
    satyaki>It is running smooth here.
    Regards.
    Satyaki De.

Maybe you are looking for

  • System Copy vs Client copy

    Hi, I have to choose between a copy with or whitout data from PRD system to DEV. I'm little confused about the difference between System Copy and Client Copy. Which is that includes a copy of data also? Then, System copy = Refresh system? Please, rep

  • My business is not appearing correctly and is taking customers to a completely different city.  Please help!

    My business is Almeria at Ocotillo Apartments and is located in Chandler Arizona.  When you use Apple Maps it takes my customers to Tempe, Arizona which is a completely different city.  Please help, address is below: 2471 W. Edgewater Way Chandler, A

  • Does apple make a black charging cable for a MacBook air?

    Hi All, I'm looking for a black charging cable for my new MacBook Air. I realize that this sounds like a ridiculous request, but my cat has an affinity for white cords. Anyone know where I can find one?

  • Error in a Proxy service

    Hi, I'm new to ALSB and created a weblogic webservice and imported it as a WSDL resource. This is then used for creating a business service. Now, I have a proxy service which take string as input (configured 2 proxy services, one takes from jms reque

  • DVD-9 - DVDSP v3 or v4?

    About to make my first DVD-9 and we are currently using DVDSP 3. But I've read about issues that DVDSP has had in the past with DVD-9s and I wondered if upgrading to v4 is worth while to save us some hassles? Thanks