Click to See Complete Forum and Search --> : how to get the default schema name in stored procedure


Adwa,Liu
December 26th, 2003, 05:35 AM
One procedure returns a resultset, one column among the resultset is corresponding to the current user account(also as schema name for some dbms)

for example, if you logon with "some_db_user" account, and execute the procedure, then the column should be "some_db_user"


So here the problem is how stored procedure to figure out the current schema name

ITGURU
December 31st, 2003, 12:11 AM
In SQL Server you can get your Database and User Name using following functions:
1. DB_NAME() - Database Name
2. USER_NAME() - USER Name

and in Oracle you can schema/user name by using current_user function.