dynamic sql

hi is it posible to create dynamic sql to create a select statement

for example i have table with 50 rows i need to contract a select statemnt for all column how can i do that dynamic
chalie001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John TsioumprisSoftware & Systems EngineerCommented:
Have you seen this
0
Alexander Eßer [Alex140181]Software DeveloperCommented:
hi is it posible to create dynamic sql to create a select statement

Short answer: yes ;-)

BUT: what exactly do you want to do?! you provide little information about your "problem"...
0
chalie001Author Commented:
i have table employee which got col1.co3,col2 etc until 50 columns

i what to write select for those 50 columns is there a dynamic way i can do that
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

Alexander Eßer [Alex140181]Software DeveloperCommented:
Thanks, but this is still insufficient. I have no idea what you want to do?!? Where do you want to create/use/execute that SQL statement?! You should tell us some more ;-)

There are ways to build a SELECT statement dynamically (e.g. via 'execute immediate' or dbms_sql), BUT if we don't know what you're supposed to do, then there can't be an adequate solution...
0
chalie001Author Commented:
something like this
select 'select '
    || LISTAGG(column_name, ', ') within GROUP (ORDER BY COLUMN_ID )
    || ' from ' || table_name || ';' as "-- select statement"
  from user_tab_columns
 where table_name like upper ( '&1' )
 group by table_name;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alexander Eßer [Alex140181]Software DeveloperCommented:
Whether this is good or not, you gave half of the answer yourself ;-)
Now you may select this value into a variable and do an "execute immediate..." from within PL/SQL for instance...
0
chalie001Author Commented:
correct
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.