Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dynamically change schema/user name in sql query

523902Jul 27 2007 — edited Jul 27 2007
I have tables with same name in different schema.
and Suppose I have query like:
select * from myHR.emp;

Now I want to pass variable in place of myHR, may be as follows:

Declare
vSH varchar2(10);
Begin
vSH := 'myHR';
select * from vSH.emp;
End;

But I got error with this query.
I want to pass variable as scheme_name/user.

So, please help me with this.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2007
Added on Jul 27 2007
17 comments
2,429 views