# SQL to drop user from oracle database

**URL:** <https://forum.ansible.com/t/sql-to-drop-user-from-oracle-database/37690>\
**Category:** Ansible Developer\
**Created:** [February 23, 2023, 12:17pm UTC](https://forum.ansible.com/t/sql-to-drop-user-from-oracle-database/37690 "2023-02-23T12:17:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asad](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@Asad](https://forum.ansible.com/u/Asad)\
**Post date:** [February 23, 2023, 12:17pm UTC](https://forum.ansible.com/t/sql-to-drop-user-from-oracle-database/37690/1 "2023-02-23T12:17:54Z")

</div>

Hi All ,

I want to write a task which does the following logs in to oracle database using sqlplus

`SQL> select ``'drop user '``||username||``' cascade ;'` `from dba_users where username like ``'abc_%'``;`

`Execute the Drop queries Generated from the above query.`

how to save output from dynamic sql and execute the in ansible playbook ?

Thanks,
