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
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 -
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 '| |v_field1| |','| |
v_field2| |' from '| |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
nullHi 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@ -
Hello,
I have a ten relational data modeler. When I export a reporting scheme I get the following error:
java.sql.BatchUpdateException: ORA-01722: invalid number
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10296)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216)
at oracle.dbtools.crest.exports.reports.RSTables.export(RSTables.java:108)
at oracle.dbtools.crest.exports.reports.RSRelationalModel.export(RSRelationalModel.java:28)
at oracle.dbtools.crest.exports.reports.ReportsHandler.export(ReportsHandler.java:123)
at oracle.dbtools.crest.swingui.ControllerApplication$ExportToReportsSchema$1.run(ControllerApplication.java:2055)
Will I could help with the error?
Logical data modeler is exported correctly
Thanks.Hi,
I've logged a bug on this.
It seems likely that the problem has arisen because one of your tables has a non-integer value for one of its volumetric properties (Minimum, Expected or Maximum volume).
(If this is the case, then the problem will probably still occur with the DM 4.1 EA1 version.)
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.
SilvioI see no answers :-(
Is there a chance this gets listed as a bug and fixed?
Thank you -
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
DavidThanks Luke,
I changed
vo.setWhereClause(" USER_NAME=?");
to
vo.setWhereClause(" USER_NAME=:0");
And that particular segment worked as expected.
Thanks
David -
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
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 -
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 -
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. -
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 3Are 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 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 -
Error on Expression Query - java.sql.SQLException: DSRA9420E
We are getting the below error when we execute an Expression query. Other queries seem to be working fine.
Has anyone seen this error?
Any help or suggestions are welcome.
Thanks
ERROR -
java.sql.SQLException: DSRA9420E: Connection cannot be reassociated because child objects are still open.
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1376)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java:2201)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:2070)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:2039)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1295)
at oracle.toplink.queryframework.SQLCall.prepareStatement(SQLCall.java:185)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:635)
at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:506)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:134)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115)
at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(CallQueryMechanism.java:197)
at oracle.toplink.internal.queryframework.CallQueryMechanism.selectAllRows(CallQueryMechanism.java:567)
at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:732)
at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:707)
at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:447)
Edited by: amehta5 on Apr 12, 2012 12:13 PMIt seems like your connection pool is having issues. How have you configured your connections?
It seems that WebSphere connection pool is performing some sort of statement cache, and the cache statement it is trying to use is still in use. -
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. -
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
SSHello,
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
Maybe you are looking for
-
Cost Assignment Change on Header Level
This User changed the cost assignment at the top level to an internal order; however, it did not apply to one of the hotel charges. The other charge on the same date for the same vendor did change. What caused the one transaction to remain with a cos
-
Problem removing child at end game screen
Hi everyone I am creating an android app for my university corusework and it is based on shooting alien spaceships as they fly in from the right side of the screen. When my gun is shot enough times the game should go to the end screen, the problem is
-
i am running my application on oracle817. Because of issues the software has with the windowsOs...the application automatically churns out unnecessary data into the database. So my question is how do i know or tell how to keep track of the bad data b
-
Error opening MPEG-2 in FCP and QuickTime
I have an MPEG-2 elementary stream file created with Digital Rapids Stream under Windows. I get an error, "file unrecognized" when attempting to open the file with QuickTime Pro 7 and Final Cut 5. The error code was -2048. I have the MPEG-2 player co
-
After patching disk free no loger work in a sub-zone
I just patched(Generic_142900-06) a Solaris 10 global zone, which contains three sub-zones. Now, within two of the three sub-zones, "df -k" returned absolutely nothing: # truss -f df -k 7068: execve("/usr/sbin/df", 0xFFBFFEDC, 0xFFBFFEE8) argc = 2 70