ORA-00911 error

Hi.
I am developing a system which connects to an Oracle database, everything is set and working fine, but when I try to do a select in a table that contains a japanese name I get a ORA-00911 error. I've already done some research on the web and I found out that it's a invalid character problem and I have to set two things on windows registry (I don't remember exactly where, I am at home now). I followed the instructions but the problem is still happening.
has anyone here experienced a similar problem?

You didn't give us a version number nor did you provide the full text of the error message so we really can't help you much other than to suggest you enjoy your weekend.
I am currently working in SIMPLE_CHINESE and have not seen this specific issue but I make good use of the following two functions:
http://www.morganslibrary.org/reference/builtin_functions.html
Look up:
TO_SINGLE_BYTE and TO_MULTI_BYTE
This function may also be useful:
CREATE OR REPLACE FUNCTION IS_BYTE_VALID (str1 IN VARCHAR2, pos PLS_INTEGER, len PLS_INTEGER) RETURN BOOLEAN IS
BEGIN
  IF ASCII(SUBSTRB(str1, pos, len)) = 32 THEN
    RETURN FALSE;
  ELSE
    RETURN TRUE;
  END IF;
END is_byte_valid;

Similar Messages

  • 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

  • Creating Oracle table is giving ORA-00911 error

    Hi,
    I got a small code which I am trying to implement in order to create a table in Oracle 8i database. The code compiles fine. However, when I run, it is giving ORA-00911 error(invalid character). Any help is highly appreciated in advance. Thanks.
    CODE:
    import java.sql.*;
    import java.io.*;
    import sun.jdbc.odbc.*;
    public class createor {
    public static void main (String args[]) {
    try{
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
         Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@myserv:1521:cooler", "scott", "tiger");
    Statement stmt = conn.createStatement ();
         stmt.execute(     "create table JoltData ("+
                   "programmer varchar (32),"+
                   "day char (3),"+
                   "cups integer);"
    stmt.close();
    }catch (Exception e) {e.printStackTrace();}

    Try this code, it works for me.
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    class dbtestcreatetable {
        public static void main (String args []) throws SQLException {
            try {
                DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
                Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@myserver:1521:mysid",
                                                               "password",
                                                               "userid");
                String sql = "CREATE TABLE MYTABLE3 (COL1 VARCHAR(3))";
                Statement statement = conn.createStatement();
                int cnt = statement.executeUpdate(sql);
                statement.close();
                conn.close();
            catch (Exception e) {
                System.out.println("Java Exception caught, error message="+e.getMessage());
    }

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

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

  • 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

  • ORA-00911: Ungültiges Zeichen

    Hello developer fellows!
    I have a problem using Oracle in Java 1.5.
    I try to do some inserts with a single statement.executeUpdate call separated by ' ; ' but all I get is this ORA-00911 error refering to the semikolon as an invalid symbol.
    Is there any possibility to use a single call of the method executeUpdate with a String which contains more than one SQL statement?

    No. This does not work with normal JDBC (are you in the Oracle JVM?).
    You would have to use statement.addBatch() to group multiple insert statements but sending to the database only one statement.
    However, do note, that Oracle only supports batching when used with a PreparedStatement (even the syntax allows to use the JDBC Statement, you should not recognize any batching performance benefit).
    You can read more about Oracle Update Batching and JDBC Normal Batching support in Oracle JDBC developers guide and reference.
    Oracle Update Batching is best used with multiple of Inserts (5-30 and upwards).
    There is a Oreilly book, Oracle and JDBC which describes some very interesting facts about JDBC performance: http://www.oreilly.com/catalog/jorajdbc/chapter/ch19.html
    I have been implementing a JDBC interface which has to do inserts into three tables, whereas the last table will be at least 5-15 parameter inserts (key-value pairs).
    As our JDBC interface runs within BEA WebLogic and uses a Datasource JDBC 2.0 pool (PreparedStatement caching enabled), I choose to use Prepared Statement with Normal Batching (not Oracle Update Batching).
    Have fun :)
    Thomas

  • 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

  • Dynamic pl/sql - Error -911: ORA-00911: invalid character

    This is the first time I am using dynamic pl/sql for self education. I am getting
    Error -911: ORA-00911: invalid character
    Here is my code;
    PROCEDURE DYNAMIC_SQL (table_name in varchar2,
    column1 in varchar2,
    column2 in varchar2,
    v_no out number)
    is
    dyn_cur integer;
    v_table varchar2(2000);
    v_field1 varchar2(20);
    v_field2 varchar2(20);
    v_select varchar2(2000);
    v_cursor integer;
    begin
    DBMS_OUTPUT.enable;
    dyn_cur := DBMS_SQL.open_cursor;
    v_table := table_name;
    v_field1 := column1;
    v_field2 := column2;
    v_select := 'select '&#0124; &#0124;v_field1&#0124; &#0124;','&#0124; &#0124;
    v_field2&#0124; &#0124;' from '&#0124; &#0124;v_table;
    DBMS_SQL.parse(dyn_cur,v_select,DBMS_SQL.V7);
    v_no := DBMS_SQL.execute(dyn_cur);
    DBMS_OUTPUT.put_line(v_select);
    end;
    ANY IDEAS????
    Mayur
    Thanx
    null

    Hi Mayur,
    I don't exatly know your problem. It seems the syntax is correct. I too got the similar error when I was writing PL/SQL script few years ago. That time after few rounds of investigations, I found that I copied the code from some editor, due to which certain characters are not identified by Oracle. So just retype the code in any editor like (notepad, PF Editor) and compile.
    I think this may solve problem.
    Cheers!!
    r@m@

  • 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 error in the func ?

    CREATE OR REPLACE FUNCTION f_get_oibt_value(argin_rollent IN VARCHAR2,
    argin_rollsubent IN VARCHAR2,
    argin_legalORdervied IN CHAR,
    argin_year IN VARCHAR2,
    argin_currmtd IN VARCHAR2)
    RETURN NUMBER AS
    ln_oibt_value NUMBER;
    ln_oibt_l_value NUMBER;
    ls_acct_id VARCHAR2(10);
    sql_stmt VARCHAR2(2999);
    BEGIN
    -- dbms_output.enable(9999);
    IF UPPER(argin_legalOrdervied) = 'L' THEN
    ls_acct_id := 'OIBT-L';
    ELSE
    ls_acct_id := 'OIBT-D';
    END IF;
    sql_stmt := 'SELECT SUM (NVL (DECODE (yr, ''' || argin_year || ''', avg_ytd_' || argin_currmtd || ', 0), 0)) ';
    sql_stmt := sql_stmt || 'FROM ma_temp_local ';
    sql_stmt := sql_stmt || 'WHERE roll_ent = :argin_rollent '; --(Input argument)
    sql_stmt := sql_stmt || 'AND roll_sub_ent = :argin_rollsubent '; --(Input argument)
    sql_stmt := sql_stmt || 'AND ent NOT IN (''817'', ''PSP'') ';
    sql_stmt := sql_stmt || 'AND acct_id = ''legal'' '; --Fixed
    sql_stmt := sql_stmt || 'AND acct = :ls_acct_id '; --Fixed
    sql_stmt := sql_stmt || 'AND rel_type = '' '' '; --Fixed
    sql_stmt := sql_stmt || 'AND acct_lvl <= ''0'' '; --Fixed
    sql_stmt := sql_stmt || 'AND yr = :argin_year '; --(Input argument)
    sql_stmt := sql_stmt || 'AND rec_type = ''A'' '; -- Fixed
    sql_stmt := sql_stmt || 'AND product_code = ''ALL'' '; -- Fixed
    sql_stmt := sql_stmt || 'AND segment_code = ''ALL'' '; -- Fixed
    sql_stmt := sql_stmt || 'GROUP BY roll_ent, roll_sub_ent;';
    --dbms_output.put_line(sql_stmt);
    EXECUTE IMMEDIATE sql_stmt
    INTO ln_oibt_l_value
    USING argin_rollent, argin_rollsubent, ls_acct_id, argin_year;
    RETURN ln_oibt_value;
    END f_get_oibt_value;
    getting below errors..
    ORA-00911: invalid character
    ORA-06512: at "F_GET_OIBT_VALUE", line 36
    ORA-06512: at line 3

    Are You Getting the error while creating the function or while excuting it
    SQL>CREATE OR REPLACE FUNCTION f_get_oibt_value(argin_rollent IN VARCHAR2,
    2 argin_rollsubent IN VARCHAR2,
    3 argin_legalORdervied IN CHAR,
    4 argin_year IN VARCHAR2,
    5 argin_currmtd IN VARCHAR2)
    6 RETURN NUMBER AS
    7
    8 ln_oibt_value NUMBER;
    9
    10 ln_oibt_l_value NUMBER;
    11 ls_acct_id VARCHAR2(10);
    12 sql_stmt VARCHAR2(2999);
    13
    14 BEGIN
    15 -- dbms_output.enable(9999);
    16 IF UPPER(argin_legalOrdervied) = 'L' THEN
    17 ls_acct_id := 'OIBT-L';
    18 ELSE
    19 ls_acct_id := 'OIBT-D';
    20 END IF;
    21
    22 sql_stmt := 'SELECT SUM (NVL (DECODE (yr, ''' || argin_year || ''', avg_ytd_' || argin_currmtd || ', 0), 0)) ';
    23 sql_stmt := sql_stmt || 'FROM ma_temp_local ';
    24 sql_stmt := sql_stmt || 'WHERE roll_ent = :argin_rollent '; --(Input argument)
    25 sql_stmt := sql_stmt || 'AND roll_sub_ent = :argin_rollsubent '; --(Input argument)
    26 sql_stmt := sql_stmt || 'AND ent NOT IN (''817'', ''PSP'') ';
    27 sql_stmt := sql_stmt || 'AND acct_id = ''legal'' '; --Fixed
    28 sql_stmt := sql_stmt || 'AND acct = :ls_acct_id '; --Fixed
    29 sql_stmt := sql_stmt || 'AND rel_type = '' '' '; --Fixed
    30 sql_stmt := sql_stmt || 'AND acct_lvl <= ''0'' '; --Fixed
    31 sql_stmt := sql_stmt || 'AND yr = :argin_year '; --(Input argument)
    32 sql_stmt := sql_stmt || 'AND rec_type = ''A'' '; -- Fixed
    33 sql_stmt := sql_stmt || 'AND product_code = ''ALL'' '; -- Fixed
    34 sql_stmt := sql_stmt || 'AND segment_code = ''ALL'' '; -- Fixed
    35 sql_stmt := sql_stmt || 'GROUP BY roll_ent, roll_sub_ent;';
    36 --dbms_output.put_line(sql_stmt);
    37 EXECUTE IMMEDIATE sql_stmt
    38 INTO ln_oibt_l_value
    39 USING argin_rollent, argin_rollsubent, ls_acct_id, argin_year;
    40
    41
    42 RETURN ln_oibt_value;
    43
    44 END f_get_oibt_value;
    45 /
    Function created.
    SQL>drop function f_get_oibt_value;
    Function dropped.
    SQL>

  • 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 w/create table

    I'm trying to execute an SQL file with the following code:
    create table "t_ap_xml"
    "XML_ID" NUMBER,
    "XML_NAME" VARCHAR2(128),
    "XML_TYPE" VARCHAR(32),
    "XML_CONTENT" "SYS"."XML_TYPE",
    "XML_DESCRIPTION" VARCHAR2(4000)
    ..And i'm receiving the following error:
    ERROR at line 8:
    ORA-00911: invalid character
    It is pointing to the semicolon as the problem. If i remove the semicolon, it seems to work. But if I place that code in a DDL with other create table commands, it gives me a ORA-00922 error at the line with the next create statement. Any ideas? Thanks.

    I guess I should have been a bit more clear..
    I am using SQL*Plus, and GET-ing a text .sql file made in a text editor.
    It seems to work without the semicolon and only creating that single table. However, a problem occurs when trying to use multiple CREATE TABLE statements in the same sql file.
    So for example.. here is an excerpt:
    create table t_ap_xml
    create table another_table
    Generates the following error:
    ORA-00922: missing or invalid option
    ..That error occurs on the line in which the second CREATE TABLE statement was issued.
    Thanks for any help!

  • Calling SP results in ORA-00911: invalid character

    I am testing a supposedly very simple stored procedure in XE. It compiles with no errors but when I enter the following command in the SQL Command window I get an ORA-00911: invalid character.
    call get_all_customer_orgs;
    The get_all_customer_orgs procedure is defined as...
    create or replace procedure get_all_customer_orgs (p_recordset out sys_refcursor)
    is
    begin
    open p_recordset for
    select * from customerorgs;
    end get_all_customer_orgs;
    I don't understand what the invalid character could be. Guidance? Thanks.

    I don't have XE handy, but your procedure works from SQL Plus (changing the table to emp).
    SQL> create or replace procedure get_all_customer_orgs (p_recordset out sys_refcursor)
      2  is
      3  begin
      4  open p_recordset for
      5  select empno,ename from emp;
      6  end get_all_customer_orgs;
      7  /
    Procedure created.
    SQL> var allemps refcursor
    SQL> exec get_all_customer_orgs(:allemps);
    PL/SQL procedure successfully completed.
    SQL> print allemps
                   EMPNO ENAME
                    7369 SMITH
                    7499 ALLEN
                    7521 WARD
                    7566 JONES
                    7654 MARTIN
                    7698 BLAKE
                    7782 CLARK
                    7788 SCOTT
                    7839 KING
                    7844 TURNER
                    7876 ADAMS
                    7900 JAMES
                    7902 FORD
                    7934 MILLER
    14 rows selected.

  • 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

Maybe you are looking for