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.

ORA-00900 invalid SQL statement
Cause: 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.

Action: Correct the syntax or install the Procedural Option.

 

 

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.

Correct the syntax or install the Procedural Option.

 

To solve this error, you need to use nls_date_format as follows.

alter session nls_date_format='DD/MM/YYYY HH:MM:SS AM';

 

Or use the TO_DATE function as follows.

insert into test values (TO_DATE('2008-12-23T17:28:44','YYYY-MM-DD"T"HH24:MI:SS'));

 

 

OR

 

EXECUTE IMMEDIATE failed when calling PL/SQL object:

SQL>  set serveroutput on
SQL>  declare
  2   v_sql_cmd varchar2(1100);
  3   v_userid varchar2(10):='scott';
  4    v_TEMP_PASSWORD varchar2(10):='testuser';
  5   begin
  6     v_sql_cmd := 'DBMS_UTILITY.EXEC_DDL_STATEMENT(''alter user '|| v_userid|| ' identified by '|| v_TEMP_PASSWORD|| ' password expire'')';
  7              DBMS_OUTPUT.put_line (v_sql_cmd);
  8             execute immediate v_sql_cmd;
  9  end;
 10  /
DBMS_UTILITY.EXEC_DDL_STATEMENT('alter user testuser identified by testuser
password expire')
 declare
*
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 8
When using EXECUTE IMMEDIATE to call PL/SQL objects without using BEGIN ..END

Put PL/SQL call inside BEGIN..END in EXECUTE IMMEDIATE.

SQL>  declare
  2   v_sql_cmd varchar2(1100);
  3   v_userid varchar2(10):='scott';
  4    v_TEMP_PASSWORD varchar2(10):='tiger';
  5   begin
  6     v_sql_cmd := 'BEGIN DBMS_UTILITY.EXEC_DDL_STATEMENT(''alter user '|| v_userid|| ' identified by '|| v_TEMP_PASSWORD|| ' password expire''); END;';
  7              DBMS_OUTPUT.put_line (v_sql_cmd);
  8             execute immediate v_sql_cmd;
  9  end;
 10  /
BEGIN DBMS_UTILITY.EXEC_DDL_STATEMENT('alter user testuser identified by tiger
password expire'); END;

PL/SQL procedure successfully completed.

 

 

If you want to learn more details , Read the following post.

 

 

 

 

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *