declare begin for c1 in (select count(1) cnt from dba_users where username='RAMAMOHAN') loop begin if (c1.cnt = 0) then execute immediate 'create user ramamohan identified by abc123 account unlock password expire'; else execute immediate 'drop user ramamohan'; execute immediate 'create user ramamohan identified by abc123 account unlock password expire'; end if; exception when others then dbms_output.put_line(sqlerrm); end; end loop; end; / select username, to_char(created,'mm-dd-yyyy hh24:mi:ss') from dba_users where username='RAMAMOHAN'; USERNAME TO_CHAR(CREATED,'MM ------------------------------ ------------------- RAMAMOHAN 05-22-2009 15:29:58 This script also does the same job as the above script, without cursor loop and if condition. whenever sqlerror continue --whenever sqlerror exit begin begin execute immediate 'create user ramamohan identified by abc123 account unlock password expire'; exception when others then dbms_output.put_line(sqlerrm); end; execute immediate 'drop user ramamohan'; execute immediate 'create user ramamohan identified by abc123 account unlock password expire'; exception when others then dbms_output.put_line(sqlerrm); end; / PL/SQL procedure successfully completed. select username, to_char(created,'mm-dd-yyyy hh24:mi:ss') from dba_users where username='RAMAMOHAN'; USERNAME TO_CHAR(CREATED,'MM ------------------------------ ------------------- RAMAMOHAN 05-22-2009 15:18:00 Happy scripting References: http://sqlanywhere.blogspot.com/2009/03/ddl-meets-if-not-exists.html