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
Similar Messages
-
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 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 -
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
DavidThanks 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.
SilvioI 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 '| |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@ -
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 -
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 -
HI!
What's the best way (and simple) to call DLL function from JAVA.
DLL function (developed in C) has two input parameters (string) and return an integer.
Could you help with an example?
Thanks a lot.Do a google search for 'JNI tutorial' and it will turn up hundreds of examples.
-
Calling c function from java!!
hi all,
I want to call c function from java . I have gone through the link http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html for JNI.
According to this link we need to write the native method implementation in such a way that the method signature should exactly match the method signature created in the header file.
My problem is that i have a c application which i cannot modify in any ways i.e., i cannot change its code. But i want to call its function from my java code.
Please suggest me appropriate solution for this. Please let me know whether it can be done using JNI or is there any other method for this.
thanksThis link is amazing since those sources were wrote in 1998 and I started to develop JNative in 2004. I did not found them when I started.
Since JNative can deal with callbacks and probably COM in a near future, I expect to see it living to Dolphin at least.
--Marc (http://jnative.sf.net) -
Calling OCI functions from Java
Is it possible to call OCI's API functions from Java and create a Lightweight Session ?
Please help me out.I too would like to know how this can be accomplished. I have
seen several posts that claim it is possible with Oracle91. -
ADF: Can i call javascript function from java clsss method in ADF?
Hi,
I want to call javascript function in Java class method, is it possible in ADF? , if yes then how?
or I need to use Java 6 feature directely?
Regards,
Deepakprivate void writeJavaScriptToClient(String script)
FacesContext fctx = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
erks.addScript(fctx, script);
}usage
StringBuilder script = new StringBuilder();
script.append( "var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');");
script.append("if(popup != null){"); script.append("popup.show();"); script.append("}");
writeJavaScriptToClient(script.toString());Timo
Maybe you are looking for
-
Solution Design questions/suggestions/help needed
Hi, I would appreciate any inputs regarding this. I am thinking of designing Solutions in Solman for our landscape which consists of ECC 6 and PI 7.1; each having a 3 system landscape D-Q-P. Is there an issue if I create Solutions Dev, QA and Prod vs
-
10.5.7 and Macbook Pro won't reboot!!
I've updated to 10.5.7 this morning and my system is just sitting here rebooting over and over. It brings up the Apple logo without the spinning wheel, sits for 5 minutes, then reboots again... just does it over and over again. Can anyone tell me wha
-
Can I purchase and download Snow Leopard online
Can I purchase and download Snow Leopard Online?
-
Eventcreate remotely gives network path was not found (sort of)
I am trying to make a Windows Server 2012 write to a Win 7 computer using eventcreate. When I do eventcreate to my computer it works. When I specify a different computer it fails saying the network path was not found. It is the same subnet so no f
-
End user releasing own emails based on Policy/Content
Hiya all, New to this forum and my first post so hello to all We recently installed a couple of C360 and an M series and they all are working well. We have also setup Profanity based filtering and as a result many swear words are being rejected. This