ORA-06546: DDL statement is executed in an illegal context
Cause : DDL statement is executed dynamically in illegal PL/SQL context. - Dynamic OPEN cursor for a DDL in PL/SQL - Bind variable's used in USING clause to EXECUTE IMMEDIATE a DDL - Define variable's used in INTO clause to EXECUTE IMMEDIATE a DDL
Action - How to fix it : DBA Scripts :: www.high-oracle.com/scripts
Use EXECUTE IMMEDIATE without USING and INTO clauses to execute the DDL statement.
Well, the reason for above error is that i have taken the above script from a 11g database and running it on 10g database. 11g has bring some changes in password management. Below code is executed on 11g and user created successfully, which is expected result.