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
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 )