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!

How to use dynamic table name in a select statement in a cursor?

user8701328Apr 2 2019 — edited Apr 13 2019

How to use a variable name that contains the name of a table in Pl/Sql?

This code does not work:

myTable := 'Employees';                               -- The table name will vary

for aRow in ('select * from ' || myTable)

loop

...

end loop;  

Thank you!

Comments
Post Details
Added on Apr 2 2019
25 comments
17,512 views