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.

Similar Messages

  • 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

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

  • 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

  • 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

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

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

  • 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

  • XSQL ORA-00911: invalid character

    A function returns VARCHAR2 (around 25000 in size).
    However,
    select myfunction from dual;
    from SQLPLUS returns ORA-06502
    while
    the XSQL servlet returns ORA-00911
    What shall I do in order to get the matter to work ?
    Support APPRECIATED !!

    Problem solved.
    The problem was in the XSQL, it contained a ";" at the end.

  • ORA-00911: invalid character in Oralce 10g on Ubuntu 8.04

    When i tried to run these commands, an error came in.
    -- DEPT
    Insert into DEPT values(10, 'Headquater', 'R101' );
    Insert into DEPT values(20, 'Maketing', 'R102' );
    Insert into DEPT values(30, 'Sales', 'R103' );
    And these are my tables
    CREATE TABLE DEPT
    DeptNo NUMBER(2) NOT NULL,
    DName CHAR(14),
    Loc CHAR(13),
    PRIMARY KEY (DeptNo));
    CREATE TABLE SALGRADE
    Grade NUMBER,
    LoSal NUMBER,
    HiSal NUMBER,
    PRIMARY KEY(Grade));
    CREATE TABLE EMP
    EmpNo NUMBER(4) NOT NULL,
    EName CHAR(10),
    Job CHAR(9),
    Mgr NUMBER(4),
    HireDate DATE,
    Sal NUMBER(7,2),
    Comm NUMBER(7,2),
    DeptNo NUMBER(4) NOT NULL,
    PRIMARY KEY(EmpNo),
    FOREIGN KEY(Mgr) REFERENCES EMP(EmpNo),
    FOREIGN KEY(DeptNo) REFERENCES DEPT(DeptNo),
    Edited by: user10997671 on Apr 14, 2009 7:13 AM

    I have found the problem.
    You can write like this:
    CREATE TABLE EMP
    EmpNo NUMBER(4) NOT NULL,
    EName CHAR(10),
    Job CHAR(9),
    Mgr NUMBER(4),
    HireDate DATE,
    Sal NUMBER(7,2),
    Comm NUMBER(7,2),
    DeptNo NUMBER(4) NOT NULL,
    PRIMARY KEY(EmpNo),
    FOREIGN KEY(Mgr) REFERENCES EMP(EmpNo),
    FOREIGN KEY(DeptNo) REFERENCES DEPT(DeptNo),
    It must like this:
    CREATE TABLE EMP
    EmpNo NUMBER(4) NOT NULL,
    EName CHAR(10),
    Job CHAR(9),
    Mgr NUMBER(4),
    HireDate DATE,
    Sal NUMBER(7,2),
    Comm NUMBER(7,2),
    DeptNo NUMBER(4) NOT NULL,
    PRIMARY KEY(EmpNo),
    FOREIGN KEY(Mgr) REFERENCES EMP(EmpNo),
    FOREIGN KEY(DeptNo) REFERENCES DEPT(DeptNo),);
    I'm using ISQL*plus on Firefox browser.

  • Dynamic SQL yielding a '911:0: ORA-00911: invalid character ORA-06512:

    Hi folks
    I'm getting the above error when I run the sql command using EXECUTE IMMEDIATE command with the following query. The query is attached as follows.
    UPDATE ACTIVE_ORDERS AC set AC.STATUS = 'CANCEL' WHERE AC.REQ_NUM IN (SELECT P.REQ_NUM FROM PROC_TIMES P WHERE AC.REQ_NUM = P.REQ_NUM AND AC.REQ_SUFFIX = P.REQ_SUFFIX AND P.NEW_TIME <= (TRUNC(sysdate-30)) AND (AC.STATUS='NEW' or AC.STATUS='IMPORTERROR') AND AC.ORDER_ORIGIN_NUM IN (1,2) AND AC.ORIGIN_RIC = 'RAM');
    any suggestions?
    thanks
    SS

    Hello,
    Two suggestions:
    - Make sure all quotes are escaped properly in your query string when passing to EXECUTE IMMEDIATE.
    - Don't include the semicolon at the end of the query.
    You could also post the exact string you are passing to EXECUTE IMMEDIATE so we can have a look at it...
    cheers,
    Anthony

  • Ora-00911 invalid chara...

    What does this mean? I am using sql in a select statement. Then this comes up and says the ; is invalaid???

    I have a similar problem. I am using SQLPLUS (sqlplusw.exe) on Windows NT.
    I have the following when entering data via a script:
    SQL> @c:\implant.sql
    insert into catalogue_xref (catalogue_code, xref_type, xref) values ('AS000001','SUBGROUP','IMP01');
    FEHLER in Zeile 1:
    ORA-00911: invalid character
    insert into catalogue_xref (catalogue_code, xref_type, xref) values ('AS000002','SUBGROUP','IMP01');
    FEHLER in Zeile 1:
    ORA-00911: invalid character
    insert into catalogue_xref (catalogue_code, xref_type, xref) values ('AS000003','SUBGROUP','IMP01');
    FEHLER in Zeile 1:
    ORA-00911: invalid character
    SQL>
    1* insert into catalogue_xref (catalogue_code, xref_type, xref) values ('AS000003','SUBGROUP','IMP01');
    insert into catalogue_xref (catalogue_code, xref_type, xref) values ('AS000003','SUBGROUP','IMP01');
    FEHLER in Zeile 1:
    ORA-00911: invalid character
    If I type the commands in directly they work !!!

Maybe you are looking for

  • Sharepoint 2013 - Error while applying custom master page.

    I am getting following error on my sharepoint 2013 site on applying a custom master page. System.ArgumentNullException: Value cannot be null.  Parameter name: ribbon    at Microsoft.SharePoint.WebControls.RibbonTrimmer..ctor(SPRibbon ribbon)     at M

  • Any fix for action cancelled?

    All of the sudden with an upgrade to Acrobat Reader 8, I'm getting an action cancelled error when opening PDFs or Docs with getURL from Flash. I've seen this topic posted in the forum, but didn't see where there was ever a fix addressed. I realize th

  • The SAP SSO authentication will fail because the current user doesn't...

    Hi Experts! I am facing an issue and I have tried to do all the tips on answers of topics under same subject. Once I enter on my report and refresh, it prompts me a message that I don't have acess on one or more data providers, asking me if I want to

  • Auto-starting dependencies with SMF

    I'm developing installers for an app that needs to be installed on Solaris 10, but I am not a Solaris administrator. My installer installs 2 server apps, App A and App B. App A depends on App B to be up and running when App A starts, but I'd prefer n

  • How to refer to BDOCS

    can abybody tell me , how to refer to BDOCS or TCode used to BDOCS\ how different it is from IDOCS ?? points guaranteed Aryan.