February 28, 2025

Oracle Dynamic query creation

 

How to create oracle SQL statement from a select query

In this post, a simple yet very powerful query is written. If anytime we need to create large number of insert/update/alter statements from existing SQL statement, we can utilize the below operator to create it successfully.


Dynamic Create kill session example:


select 'alter system kill session ('||sid||','||serial#||');' from v$session where sid in (
select lo.SESSION_ID
from gv$locked_object lo, dba_objects do
where lo.object_id = do.object_id);


Best Wishes!! 

No comments:

Post a Comment

If you have any queries/ any suggestion please do comment and let me know.

Recent Post

Oracle Memory usage Queries

Some Important Oracle database Memory management queries. SGA usage by Oracle Instance: select  round(sum(bytes)/1024/1024,2)||' MB'...