ORA-00900 Error Message “Invalid SQL Statement”
Error ORA-00900 occurs when the user tries to execute a statement that is not a valid SQL statement. This error occurs if the Procedural Option is not installed and a SQL statement is issued that requires this option.
Users have several options in resolving error ORA-00900. You may choose to install the Procedural Option or correct the actual syntax.
To determine if you have installed the Procedural Option, open a session in Oracle by typing SQL*Plus. If the PL/SQL banner does not display, this means that the Procedural Option has not been installed. Otherwise, the PL/SQL banner should appear in a display window and contain a message with the following information:
SQL*Plus: [Version of release] – [Date of production: Day of week, month, day]
Copyright © [Copyright date], Oracle Corporation. All Rights Reserved.
[Further information on the connection]
Users may see error ORA-00900 when attempting to use a database link or when querying fields that may have worked previously. If faced with this situation, users should take the following steps.
On the local database, change the init.ora parameter NLS _ DATE _ FORMAT and use double quotation marks for the value. Using single quotation marks will cause Oracle to throw error ORA-00900 as this is not properly read and will become invalid. Always use double quotation marks. The database should then be restarted. For example, the statement should read:
NLS _ DATE _ FORMAT = “Day – Month – Year”
Another method is to alter the parameter within the session. This is done by an “alter session set” statement. The following is an example of such a statement:
SQL> alter session set NLS _ DATE _ FORMAT = “Day – Month – Year”;
To avoid seeing error ORA-00900 in the future, double check the syntax and spelling of your PL/SQL statements. Look over your error statement to get more clues on how to solve your error. Minimize the possibility of errors by using indentations and a color-coded IDE. If you continue to see error ORA-00900, you may try posting your code to an Oracle help forum. Likely, another Oracle user has faced the same or similar problems and has already posted the question to a forum. You may consider consulting your database administrator for help or even an outside expert. With any outside Oracle expert, make sure to check their certifications and experience to ensure they are professionals. For reference, see the Online Oracle documentation.
How to resolve ORA-00900
Checklist to solve the ORA-00900 invalid SQL Statement
(1) This error commonly occurs when you are trying to create an Oracle procedure and the Procedural Option is not installed. To determine if the Procedural Option has been installed, open an Oracle session using SQL*Plus. If the PL/SQL banner does not display, then you know that the Procedural Option has not been installed.
(2) ORA-00900 can occurs while attempting to use a database link. Many users find that they are encountering ORA-00900 as they attempt to query fields that may have worked before 2000. To resolve ORA-00900, on the local database, try altering your init.ora parameter NLS_DATE_FORMAT, then use double quotes (instead of single) around the value
(3) Using execute statement on sql developer /JDBC connection
execute is sqlplus option, we should use either of the below options in application/other language programs
(4) Many times developers do mistakes in the plsql block and write statements like
The above code gives ORA-00900 as dbms_utility.analyze_schema(‘OKX’,’ESTIMATE’,30);
is not a valid statement
The fix is to use begin and end as given below
(5) If you want to describe a table in PLSQL
You cannot use desc here. we may want to select it based on query
(6) If you are trying to explain plan on create view statement
Hope you like the various ways to fix the ORA errors. Please do provide feedback on it
ORA-00900: invalid SQL statement
I got ” ORA-00900: invalid SQL statement ” error in Oracle database.
ORA-00900: invalid SQL statement
Details of error are as follows.
invalid SQL statement
This ORA-00900 error is related with the statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.
Oracle DBA by Example. Code samples, Scripts, Reference.
================================
ORA-02064 Example
================================
In this example, same DB_LINK named KUKU is created to the remote database.
The procedure now is a DML Procedre, performing an update, and a commit.
The remote procedure has these API:
PKG_TEST.setDate(v_date IN DATE,
v_result OUT NUMBER );
When calling the remote procedure in PL/SQL, it would be:
DECLARE
v_date DATE;
v_result NUMBER;
BEGIN
v_date := SYSDATE;
PKG_TEST.setDate(v_date, v_result );
EXCEPTION
WHEN OTHERS THEN
WRITE_LOG(v_module_name,’Error Running: ‘||v_sql_str||’ ‘||SQLERRM);
RAISE;
ORA-02064: distributed operation not supported
ORA-06512: at «REMOTE_USER.PKG_TEST», line 491
Per Oracle documentation,
Error Cause:
One of the following unsupported operations was attempted:
1. array execute of a remote update with a subquery that references a dblink, or
2. an update of a long column with bind variable and an update of a second column with a subquery that both references a dblink and a bind variable, or
3. a commit is issued in a coordinated session from an RPC procedure call with OUT parameters or function call.
Action:
Simplify remote update statement.