How to Solve Ora-00911: Invalid Character Error

How can I solve ORA-00911: invalid character error?

The statement you're executing is valid. The error seems to mean that Toad is including the trailing semicolon as part of the command, which does cause an ORA-00911 when it's included as part of a statement - since it is a statement separator in the client, not part of the statement itself.

It may be the following commented-out line that is confusing Toad (as described here); or it might be because you're trying to run everything as a single statement, in which case you can try to use the run script command (F9) instead of run statement (F5).

Just removing the commented-out line makes the problem go away, but if you also saw this with an actual commit then it's likely to be that you're using the wrong method to run the statements.

There is a bit more information about how Toad parses the semicolons in a comment on this related question, but I'm not familiar enough with Toad to go into more detail.

ORA-00911: invalid character issue?

Remove the ; inside a query in EXECUTE IMMEDIATE:

CREATE OR REPLACE PROCEDURE MY_PROCEDURE
IS
BEGIN
EXECUTE IMMEDIATE 'ALTER TABLE CHILD_TABLE ADD CONSTRAINT FK_CHILD_TABLE_PARENT_TABLE FOREIGN KEY (PARENT_TABLE_ID) REFERENCES PARENT_TABLE(ID) ON DELETE CASCADE';
END;

Error: ORA-00911 invalid character

Going to guess it's this that's causing the problem:

where cust_id = c.cust_id and task_status = 'C'));commit;

You've got two SQL statements in the one query. Remove the ;commit;. Your insert statement should now work. Change your python and add this after you run the insert:

connection.commit()

Obviously change connection to fit the actual variable name you use.

ORA-00911: invalid character error while executing a query

An SQL statement does not include a trailing semicolon. That is used as a statement separator in SQL*Plus and other clients (though even there you can change that to a different character), and it is not part of the statement itself. (PL/SQL requires semicolons as separators, but that's off-topic).

When you're running the statement over JDBC you should not include the semicolon. You should just be running

"select salution||' '||firstname||' '||lastname as custName, "
+ "city as custCity, state as custState, zip as custZip, "
+ "dob as custDob, idhardtoken as custAdarNo from mstuser"

(split just to show it without sideways scrolling...)



Related Topics



Leave a reply



Submit