February 15, 2015

Select query to get Database owner and Get package name from the database in SQL

To get owner of all database in sql you can run following query in sql server query editor.
select suser_sname(owner_sid) from sys.databases

To get owner of particular database like Testdb is database name in sql you can run following query in sql server query editor.
select suser_sname(owner_sid) from sys.databases where name = 'Testdb'

 Get package name from the database query level

If you  have a front end application.When a button on that page is clicked, a package is called.If you  want to find that package name from from the db level. Db level means by writing a query.

How to find it?

use who called me function for example

OWA_UTIL.WHO_CALLED_ME(owner ,name, lineno ,caller_t );