Pivotth table in a view in Oracle

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
Rafael Bertoco
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Wed, 17 Aug 2016 9:41 am

Good morning, friends.
I need to create a view in Oracle, which contains the table in Select Dynamics. Example: Select * from usina2016;

This 2016 from the end of the table name, I have to pick up from the sysdate the current year and concatenate with the plant.

Do you know how to help me?
User avatar
stcoutinho
Moderador
Moderador
Posts: 850
Joined: Wed, 11 May 2011 5:15 pm
Location: são Paulo - SP

Rafael,

I may be wrong, but I do not think you could create a "dynamic view" as you want.

Try to resolve your need through "Dynamic SQL". Below are some links that will give you an idea of ??the potential of this feature:
[[0] http://www.devmedia.com.br/sql-dinamico ... rte-2/6273 https://docs.oracle.com/cd/B10501_01/ap ... g09dyn.htm
Hugs,

Sergio
souldeath
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 48
Joined: Wed, 25 Aug 2010 9:39 am
Location: Limeira

rafael bertooc , complementing the response of stcoutinho , you could put the dynamic SQL logic in a function that returns a cursor and the view you put the select command by calling the result of this FUNCTION.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests