Column Name in Select :: Change

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Post Reply
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP

Guys, good afternoon.

I would like to give a Select on a table, and the result of the column be her name?
Ex:

Table Cars (1 line)

Description COD
001 monza

(today leaves):
Select Cod, description and from cars
COD description
001 monza

99] (I would like this):
Select Cod, description from cars
COD monza
001 monza

Thank you.

embrace,
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Why do you want this?
And if the table has two lines? (Monza and Fusca) How would the name be?

I did not understand ..: roll:
User avatar
MuLtAnI
Moderador
Moderador
Posts: 90
Joined: Tue, 01 Jun 2004 9:21 am
Location: Videira - SC
Contact:

The only way I know of doing something similar is with hash table where the index name could be equal to the value of the index

what you could do was create something dynamic and pass something like the execute immediate and ride the string of sql and pass a variable with the nickname of the column ... dae when you run the name will be that ... but also I do not know if it works .... the version of the Oracle I have At the moment does not support the Immediate execute ... otherwise I would try to make an example ... but if you want to see how it works,
http://www.oracle.com/technology/docume ... h_901.html
Low the PL / SQL guide and Take a look at the Dynamic SQL part .... I think it will help you ...
[] 's
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests