Sort causing ORA-00911

I have a query that works fine, when I add sorting to it, I get failed to parse SQL query:
ORA-00911: invalid character. The report displays an office, county, state, type1, type2, cost. I need it to sort: state, county, type1, type2 in that order. Nothing seems to be working properly with any of these sorts. These fields only contain text data. Using HTMLDB 1.61
Thanks,
Scott

Did you get anywhere with your ORA-00911? Just wondering, as I received a bunch of them the other day when running scripts on htmldb.oracle.com - it seems a special (hidden) character was being appended to my file whenever I uploaded (I had to edit each file after the upload and delete what appeared to be a blank line, at the end of the file).
On another note, did you ever do anything with Crystal Reports and HTMLDB (I see you were asking questions last year - if so write to me at [email protected] )

Similar Messages

  • Can't figure out why: ORA-00911 on dynamic SQL

    Hi everyone,
    I have a report that is generated with the HTMLDB_ITEM toolkit. The report generates a checkbox, a hidden field, a text field, two select lists, and a select field.
    There is a button in the region that activates a process to update two tables with the values in the fields. I have simplified the generated code by putting in variables that allow me to print a meaningful debug statement. The generated statement causes an ORA-00911; invalid character error. However, running the generated statement in the SQL Workshop works fine.
    Here is the code (only slightly sanitized):
    DECLARE
    v_update_string varchar2(2000);
    v_project_name  varchar2(2000);
    v_IT_dependant varchar2(1);
    v_gxp_relevant  varchar2(1);
    v_project_id    varchar2(10);
    v_pm_id         varchar2(10);
    BEGIN
    for i in 1..HTMLDB_APPLICATION.G_F01.COUNT
    loop
    v_update_string := null;
    v_project_name  := HTMLDB_APPLICATION.G_F03(HTMLDB_APPLICATION.G_F01(i));
    v_IT_dependant := HTMLDB_APPLICATION.G_F04(HTMLDB_APPLICATION.G_F01(i));
    v_gxp_relevant   := HTMLDB_APPLICATION.G_F05(HTMLDB_APPLICATION.G_F01(i));
    v_project_id    := HTMLDB_APPLICATION.G_F02(HTMLDB_APPLICATION.G_F01(i));
    v_pm_id         := HTMLDB_APPLICATION.G_F06(HTMLDB_APPLICATION.G_F01(i));
    v_update_string := 'update abc_project set ';
    v_update_string := v_update_string || 'project_name = '''   || v_project_name || ''',';
    v_update_string := v_update_string || ' it_dependant = '''  || v_IT_dependant|| ''',';
    v_update_string := v_update_string || ' gxp_relevant = '''  || v_gxp_relevant|| '''';
    v_update_string := v_update_string || ' where id = '      || v_project_id || ';' ;
    -- This statement is debug output.
    wwv_flow.debug('UPDATE_PROJECT_DATA v_update_string for ABC_PROJECT:' || v_update_string);
    execute immediate v_update_string;
    v_update_string := null;
    v_update_string := 'update abc_project_monthly set ';
    v_update_string := v_update_string || 'project_manager = ' || v_pm_id;
    v_update_string := v_update_string || ' where project_id = ' || v_project_id || ' and ';
    v_update_string := v_update_string || 'trunc(record_date, ''MON'') = trunc(SYSDATE, ''MON'');';
    -- This statement is debug output.
    wwv_flow.debug('UPDATE_PROJECT_DATA v_update_string contents for
    ABC_PROJECT_MONTHLY:' || v_update_string);
    execute immediate v_update_string;
    end loop;
    END;Here is the generated statement from the wwv_flow.debug statement:
    0.05: UPDATE_PROJECT_DATA v_update_string for ABC_PROJECT:update abc_project set project_name = 'Test Project 4', it_dependant = 'N', gxp_relevant = 'N' where id = 425;
    The next statement is "SHOW ERROR page..."
    I have the feeling that I'm barking up the wrong tree. I've not been able to find anything helpful regarding the ORA-00911 error and wonder if I've been mislead and am looking in the wrong place.
    As mentioned, running the generated SQL works fine in the SQL Worksop and in SQL Developer, just cut and paste. Could this have something to do with the "execute immedate"? You might have noticed that two statements should be generated, but we never get past the first one.
    I would greatly appreciate any thoughts.
    Thanks,
    Petie
    Message was edited by:
    Petie

    Hi Vikas and Vishal,
    Thanks so much for your time in responding to my question.
    Removing the extraneous semicolon indeed solved the problem. It was clear, with only a little thought, that with the semicolon in the generated statement the result was something like:
    execute immediate update this set that = the_other;;which clearly is a problem.
    I will look at the bind variables, Vikas, and start migrating the code in that direction. Thanks for your suggestion.
    Yours,
    Petie

  • SQLException : query java.sql.SQLException: ORA-00911: invalid character

    Hi folks
    I am not sure why this is happening. Only thing I can think of is field table_name has spaces then when I tried trim it does not like it.
    Please help
    Thanks a lot!
    --------Here's the code ---------------
    I have simple query (oracle database table names to extract and count the number of rows in each table) . This is the code snippet.
    try {  // creating a table in the database
    // querying mytable
    String query;
    query = "select table_name from user_tables;";
    ResultSet rs = stmt1.executeQuery(query);
    ResultSet rs1 =null;
    Statement stmt2 = null;
    while (rs.next())
    System.out.println("table name : " + rs.getString(1) );
    rs1 = stmt2.executeQuery("select count(*) from " + rs.getString(1));
    } catch (SQLException e)
    { System.out.println("SQLException : query " + e);
    }

    ORA-00911 invalid character
    Cause: Special characters are valid only in certain places. If special characters other than $, _, and # are used in a name and the name is not enclosed in double quotation marks (�), this message will be issued. One exception to this rule is for database names; in this case, double quotes are stripped out and ignored.
    Action: Remove the invalid character from the statement or enclose the object name in double quotation marks.
    So, I think you problem is a semicolon at then end of your query.
    Hope this helps,
    Boris

  • BC4J VSM on OC4J 10.1.2 - jdbc error ORA-00911: invalid character

    Hello,
    I have been trying to run the Virtual Shopping Mall application on OC4J Standalone 10.1.2. I have deployed the application from a JDeveloper 10.1.2 release. When i try to login the OC4J log presents the following information and login fails:
    C:\oracle\oc4j_1012\j2ee\home>java -jar oc4j.jar
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation.
    Statement: SELECT Users.USER_NAME, Users.FIRST_NAME, Users.LAST
    NAME,          Users.EMAIL, Users.ADDRESS, Users.CITY,
    Users.STATE, Users.COUNTRY, Users.ZIP, Users.PHONE,
    Users.ROLE, Users.PASSWORD, Users.CARD_PROVIDER,
    Users.CARD_NUMBER, Users.CARD_EXPIRY_DATE FROM USERS Users WHERE (USER
    _NAME=?)
    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java...
    which has a root cause of:
    ## Detail 0 ##
    java.sql.SQLException: ORA-00911: invalid character
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :137)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:625)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
    java:181)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPrepa
    redStatement.java:661)
    I've read some posts that suggest it could be the jdbc driver or the 'use ? style variables' option on the view definition. Your assistance is appreciated.
    Thanks
    David

    Thanks Luke,
    I changed
    vo.setWhereClause(" USER_NAME=?");
    to
    vo.setWhereClause(" USER_NAME=:0");
    And that particular segment worked as expected.
    Thanks
    David

  • ORA-00911: invalid character

    I am trying to create a Table of Contents within Crystal Reports 9 from a query and tables in PeopleSoft. I have read many posts about ways to make this possible but I have not yet succeeded. I am currently trying to create a subreport thru the Add Command feature on the database connection. The SQL statement is as follows:
    INSERT INTO <table> VALUES ('x', #, sysdate);
    SELECT * FROM <table>
    or
    DELETE FROM <table>
    WHERE <table>.<field> <> <paramter>;
    SELECT * FROM <table>
    Both of the Add Command SQL statements within Crystal result in the same error. See Below.
    Failed to open a rowset.
    Details: HY000:Oracle ODBC Ora ORA-00911: invalid character
    Please advise.

    Hi -
    In case you haven't figured out a resolution yet, here's the Oracle description of that error:
    >> oerr ora 911
    00911, 00000, "invalid character"
    // *Cause: identifiers may not start with any ASCII character other than
    //         letters and numbers.  $#_ are also allowed after the first
    //         character.  Identifiers enclosed by doublequotes may contain
    //         any character other than a doublequote.  Alternative quotes
    //         (q'#...#') cannot use spaces, tabs, or carriage returns as
    //         delimiters.  For all other contexts, consult the SQL Language
    //         Reference Manual.
    Tim

  • Error when executing statement for table/stored proc.  : ORA-00911

    Hi All,
    I am posting IDOC->XI->JDBC, approx 5000 Idocs.
    But few messages are giving following error in XI-_SXMB_MONI
    Can any one guide me what is the cause of error? I check whole Idoc data I am not able to see bad character? can any once guide me what are the bad character in XML to post data in oracle? so that i can search in XML and how to avoide this error.
    "com.sap.aii.af.ra.ms.api.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'HRP1001' (structure 'INSERT_PAD34'): java.sql.SQLException: ORA-00911: invalid character"

    > I am talking about following IDOC.<ZRMD_A06> ->
    > <E1PLOGI SEGMENT="1">-> <E1PITYP SEGMENT="1"> ->
    > <E1PAD34 SEGMENT="1"> -><PROZT>0.00 #</PROZT>.
    > Can we remove this # during message mapping in XI??
    sure you can remove it using Replace function or by writing UDF.
    as I am seing # is last character..<b>so remove # with " " (single space) and then use the TRIM fucntion.</b>
    Thanks
    Farooq.
    *<b>Rewards points if you find it useful*</b>

  • Getting ORA-00911: invalid character

    I've '?' as a bind variable in my sql query. When i try to execute this in java, i'm getting the following error:
    ORA-00911: invalid character
    Is this related to some specific jdbc drivers/version or oracle's version?

    ORA-00911: invalid character
    Is this related to some specific jdbc drivers/version
    or oracle's version?The error code is Oracle specific, but the cause is code-specific.
    http://ora-00911.ora-code.com/

  • ORA-00911:invalid character when loading an XML doc to the XMLType column

    We have followed this code snippet: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/Example_Code.html#createclob
    using the CLOB object to load an XML Document which has more 4000 characters to the XMLType column, we got the error -- ORA-00911:invalid character.
    Sound likes an encoding issue? any suggestions would be appreciated.
    BTW, we're able to use the TopLink's mapping -- Direct-to-Field to insert an XML String (<4000 characters) to the XMLType column.
    Thanks!

    Try removing the semi-colon at the end of your statement. That is the cause of ORA-911 with DBMS_SQL.PARSE and EXECUTE IMMEDIATE, I don't see why ADO should be any different.
    Cheers, APC

  • ExecuteBatch ORA-00911 error

    Hi ,
    I have 2 statements which I am trying to execute in a batch mode :
    PreparedStement ps = conn.prepareStatement(
    "delete t1 where group_id =? and int_table = 'table1'; " +
    "insert into t1" +
    " (name,status,id,set,t_name,group,t_code) " +
    " values(?,'S',?,?,'XXPRUEAF.EAF_GL_INTERFACE',?,'D');");
    ps.setInt(111);
    ps.setString('John');
    etc.
    ps.addBatch();
    ps.executeBatch();
    At ps.executeBatch my program throws SQL Exception :
    Exception : java.sql.BatchUpdateException: ORA-00911: invalid character
    Any ideas?
    thanks in advance.

    That can't be the real code, the ps.set.... statements are incorrect. Please show the real code, as you are probably doing an addBatch without having set all the parameters, thereby leaving a ? in the statement, which is usually what causes this error in a PreparedStatement.

  • Ora-00911 can someone help me

    SELECT
    (to_char(RLT.DATEFR,'DD-Mon-YYYY') || CHR(13) || ' To ' || CHR(13) || to_char(RLT.DATETO,'DD-Mon-YYYY') ) AS DATECOVERED,
    RLT.CHKNO,
    RLT.CHKDT,
    RLT.RECEIVEDDT,
    RLT.AMOUNT,
    GEOL.PRO_NAME,
    (SELECT nvl(LGUNAME,'') FROM CSRIS_LGUPROF_M WHERE
    MUN=BGY.MUN AND PROV=BGY.PROV AND BRGY=BGY.BRGY AND REG=BGY.REG AND ROWNUM='1') AS BRGYDESC,
    (SELECT nvl(LGUNAME,'') FROM CSRIS_LGUPROF_M WHERE
    MUN=BGY.MUN AND PROV=BGY.PROV AND BRGY IS NULL AND REG=BGY.REG AND ROWNUM='1') AS MUNDESC,
    (SELECT nvl(LGUNAME,'') FROM CSRIS_LGUPROF_M WHERE
    MUN IS NULL AND PROV=BGY.PROV AND BRGY IS NULL AND REG=BGY.REG AND ROWNUM='1') AS PROVDESC,
    (SELECT nvl(LGUNAME,'') FROM CSRIS_LGUPROF_M WHERE
    MUN IS NULL AND PROV IS NULL AND BRGY IS NULL AND REG=BGY.REG AND ROWNUM='1') AS REGDESC
    FROM CSRIS_RLT_M RLT
    JOIN CSRIS_BGYPRF_M BGY ON RLT.BGYPRFID=BGY.BGYPRFID
    JOIN CSRIS_PRJ_M PRJ ON BGY.BGYPRFID=PRJ.BGYPRFID
    JOIN CSRIS_PROGMON_M PROG ON PRJ.PROGMONID=PROG.PROGMONID
    JOIN GEOL_PROJECT_M GEOL ON PROG.PRO_CODE=GEOL.PRO_CODE
    where RLT.RECEIVEDDT BETWEEN '01-JAN-2010' and '08-SEP-2010'
    and geol.pro_code='BGPF';

    ORA-00911:
         invalid character
    Cause:      identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual.
    Action:      none
    Not quite sure why you're getting that error as your identifiers look ok to me.
    However, I would question a couple of things in your query...
    e.g. the following types of statements do nothing...
    nvl(LGUNAME,'')because an empty string is NULL, so you're just saying "if it's null then make it null"
    Also, rownum is a number so:
    ROWNUM='1'should be:
    ROWNUM=1Don't make oracle have to do extra work by implicitly converting values.

  • ORA-00911: invalid character using multiple select statements

    I am getting an ORA-00911: invalid character error when trying to execute 2 select statements using ODP.NET.
    cmd.CommandText = "select sysdate from dual;select sysdate from dual;";
    cmd.Connection = conn;
    cmd.CommandType = System.Data.CommandType.Text;
    conn.Open();
    OracleDataReader dr = cmd.ExecuteReader();
    This works in SQL server but for some reason it appears this does not work in Oracle?
    If this is the case what is a vaiable workaround? Wrapping the 2 statements in a transaction?
    Seems strange that you can't return multiple result sets using in-line sql statements.

    Oracle doesn't support passing multiple statements like that, and this is unrelated to ODP.NET.
    SQL> select * from emp;select * from dept;
    select * from emp;select * from dept
    ERROR at line 1:
    ORA-00911: invalid character
    You could do it via an anonymous block and ref cursors though if you dont want to do it via a stored procedure..
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    public class test
    public static void Main()
        using (OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;"))
            con.Open();
            string strSql = "begin open :refcur1 for select * from emp;" +
                "open :refcur2 for select * from dept;" +
                "open :refcur3 for select * from salgrade;end;";
            using (OracleCommand cmd = new OracleCommand(strSql, con))
                cmd.Parameters.Add("refcur1", OracleDbType.RefCursor, ParameterDirection.Output);
                cmd.Parameters.Add("refcur2", OracleDbType.RefCursor, ParameterDirection.Output);
                cmd.Parameters.Add("refcur3", OracleDbType.RefCursor, ParameterDirection.Output);
                OracleDataAdapter da = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);
                cmd.Parameters["refcur1"].Dispose();
                cmd.Parameters["refcur2"].Dispose();
                cmd.Parameters["refcur3"].Dispose();
                foreach (DataTable dt in ds.Tables)
                    Console.WriteLine("\nProcessing {0} resultset...", dt.ToString());
                    foreach (DataRow row in dt.Rows)
                        Console.WriteLine("column 1: {0}", row[0]);
    }Hope it helps,
    Greg

  • ORA-00911 Error code in JDBC where no special character is used - Oracle 10

    Hi,
    I am using Oracle 10G and Tomcat 5.5. I am trying to update a the CONFIRMED column of a table called LISTSERV_WAITING_LIST_TABLE. Please see my code below.
    public void doPost(HttpServletRequest request, HttpServletResponse response){
         String resRef = getServletContext().getInitParameter("java.comp.env");
         String jdbcDbRef = getServletContext().getInitParameter("jdbc.database");
         Context dbInitContext = null;
         Context dbEnvContext = null;
         DataSource dbSource = null;
         Connection conn = null;
    PreparedStatement prepStatement = null;
    String uemail = request.getParameter("email").toUpperCase();
         String userId = request.getParameter("userId");
         String waitingListTable = getServletContext().getInitParameter("db.waiting.list.table.name");
         try{ 
              dbInitContext = new InitialContext();
              dbEnvContext = (Context)dbInitContext.lookup(resRef);
              dbSource = (DataSource)dbEnvContext.lookup(jdbcDbRef);
              conn = dbSource.getConnection();
    String sqlcmd = "update " + waitingListTable + " SET CONFIRMED = 'YES' WHERE UEMAIL = '" + uemail + "' and USERID = '" + userId + "';";
    prepStatement = conn.prepareStatement(sqlcmd);
    prepStatement.executeUpdate();
         }catch(NamingException e){
              log("Area 4A: NamingException occured");
         }catch( SQLException e){
         log("Area 4B: Exception occured", e);
    When I run the code, I receive the following error message:
    SEVERE: FinalSubscriber: Area 4B: Exception occured
    java.sql.SQLException: ORA-00911: invalid character
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
         at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
         at com.sainc.nsb.FinalSubscriber.doPost(FinalSubscriber.java:40)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:831)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203)
         at java.lang.Thread.run(Unknown Source)
    However, when I type the value of the string sqlcmd (used in the PreparedStatement) directly into Oracle, the update works. An example of that string is:
    update listserv_waiting_list SET CONFIRMED = 'YES' WHERE UEMAIL = '[email protected]' and USERID = '1142369642862';
    It contains no stange character and rows are inserted successfully in another class of the program that uses the same mechanism. The problem comes when I update the table.
    Any idea as to what is wrong? Your help will be appreciated.
    Thanks,
    Nguessan

    buddy, why don't you use a stored procedure and make your update, i hate that upkeeping.
    callablestatement and the power of Plsql are ur saviours.
    regards, djoudi.

  • ORA-00911 error creating a view with PL/SQL

    Hello. Working with SQL Developer, I'm trying to write a procedure that creates a view.
    After a successful compilation, each time I try to execute it I get an ORA-00911 error and I'm not able to find the reason.
    Here's my code. Thanks in advance.
      CREATE OR REPLACE PROCEDURE "DWH_STAR"."STORICO_DATA" (
      DATA_INPUT IN VARCHAR2
    )AS
    BEGIN
      EXECUTE IMMEDIATE '
        CREATE OR REPLACE FORCE VIEW DWH_STAR.V_PORT_STOR_DATA (DATA_DESC, CLIENTE_KEY, PRODOTTO_KEY, AGENTE_KEY, TIPOLOGIA_KEY,
        NUM_ORDINE, NUM_UNITA, RICAVO_LORDO, RICAVO_NETTO, COSTO_STD_TOTALE, GROSS_PROFIT) AS
        SELECT
          dt.DATA_DESC,
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE,
          SUM (NUM_UNITA) NUM_UNITA,
          SUM (RICAVO_LORDO) RICAVO_LORDO,
          SUM (RICAVO_NETTO) RICAVO_NETTO,
          SUM (COSTO_STD_TOTALE) COSTO_STD_TOTALE,
          SUM (GROSS_PROFIT) GROSS_PROFIT
        FROM
          F_VENDUTO fv, D_TEMPO dt
        WHERE
          fv.TEMPO_KEY = dt.TEMPO_KEY
          AND TO_NUMBER(TO_CHAR(dt.DATA_DESC,''YYYYMMDD'')) <=' || DATA_INPUT ||'
        GROUP BY
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE,
          dt.DATA_DESC
        ORDER BY
          dt.DATA_DESC,
          fv.CLIENTE_KEY,
          fv.PRODOTTO_KEY,
          fv.AGENTE_KEY,
          fv.TIPOLOGIA_KEY,
          fv.NUM_ORDINE;
        UNION
        SELECT
          dt.DATA_DESC,
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE,
          - SUM (NUM_UNITA) NUM_UNITA,
          - SUM (RICAVO_LORDO) RICAVO_LORDO,
          - SUM (RICAVO_NETTO) RICAVO_NETTO,
          - SUM (COSTO_STD_TOTALE) COSTO_STD_TOTALE,
          - SUM (GROSSO_PROFIT) GROSS_PROFIT
        FROM
          F_SPEDITO fs, D_TEMPO dt
        WHERE
          (fs.CAUSA_RESO_KEY = 0
           AND fs.TEMPO_KEY = dt.TEMPO_KEY
           AND TO_NUMBER(TO_CHAR(dt.DATA_DESC,''YYYYMMDD'')) <=' || DATA_INPUT ||'
        GROUP BY
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE,
          dt.DATA_DESC
        ORDER BY
          dt.DATA_DESC,
          fs.CLIENTE_KEY,
          fs.PRODOTTO_KEY,
          fs.AGENTE_KEY,
          fs.TIPOLOGIA_KEY,
          fs.NUM_ORDINE
    END;

    remove the order by and semi-colon (;) from the first select. I hope you know that union operator needs the same set of columns to be selected.
    But try avoid creating objects on the fly unless and until it's absolutely necessary and unavoidable.
    Regards
    Raj
    Edited by: R.Subramanian on Jun 21, 2010 7:52 AM
    Edited by: R.Subramanian on Jun 21, 2010 7:53 AM

  • SQL Developer 2.1.1 ORA-00911: invalid character in Data Grid

    Hi,
    When I try to view data in Data Grid from table that has column name in format underscoreNAMEunderscore I get ORA-00911: invalid character.
    As far as I can tell the problem is same with all 2.x versions. Version 1.5.5 works OK.
    Is there a way around the problem?
    Thank you for your help.
    Silvio

    I see no answers :-(
    Is there a chance this gets listed as a bug and fixed?
    Thank you

  • ORA-00911: invalid character - Calling a function from Java..

    Hi to all.. I have an issue when calling an oracle function from Java..
    This is my Java code:
    final StringBuffer strSql = new StringBuffer();
    strSql.append("SELECT GET_TBL('II_2_1_6_5') AS TABLA FROM DUAL;");
    st = conexion.createStatement();
    rs = st.executeQuery(strSql.toString());
    and in the executeQuery a SQLException is throwed:
    java.sql.SQLException: ORA-00911: invalid character
    I paste the query in TOAD and it works.. :S
    anybody knows how can I solve this?

    Remove the Semicolon after Dual.
    strSql.append("SELECT GET_TBL('II_2_1_6_5') AS TABLA FROM DUAL");
    Sushant

Maybe you are looking for

  • Video Card and PSU upgrade for HP pavilion p6310y?

    Hello, I am a mild gamer and I would like to upgrade my video card so I could play games like minecraft and maplestory without my frame rate dropping every 5-10 min.  When this happens it sounds like the fan in my computer is working really hard and

  • How can I make background objects in a template selectable

    I have a Pages template with my signature embedded. It should move with the text but I cannot select it to make it do so. Does anyone know how this can be done in the new Pages 5?

  • Question about SSO (for Java Dialog instance) for Portal EP 6.0 SP 20

    Hi All I have following question. We are running Portal 6.0 SP 20. We have JAVA (Portal) CI+DB running on single host SAPQP1 and Two JAVA Dialog Instances (J2EE Application servers) running on separate host namely SAPAP35 and SAPAP36. I was able to c

  • Calendar + Badges

    Is there any way of getting a badge to show up on the calendar icon when there is something scheduled for today? For example a birthday, I don't want to set an alarm, just have a visual cue to check the calendar today... Any ideas? Or any apps that w

  • Difference MBRL - ME21N with items specified as return items

    Hi Gurus, can you please help me to understand the difference of these two return processes. We are using ECC 6.0 and want to implement a "standard" process for returning goods to the supplier if they don't meet our expectations. So now i have implem