Rename the column name of the view

Suppose I have an employee of the table with the column name. Now, I want to make a view of the employee to the table with the name of the First_name and Last_name column. Is this possible?

You can also use aliases in the view definition:

CREATE VIEW employee_view (
  first_name,
  last_name
) AS
  SELECT first,
         last
  FROM   employee;

However, you can rename a column in a view. You would have to DROP and CREATE or to CREATE or REPLACE.

Concerning
Peter

Tags: Database

Similar Questions

  • Need to have different BAM view column name to the dataobject fields

    Is it possible to give names of columns of different view in the BAM report. I'm getting a data object and display the data in the BAM view. View columns have default names similar to the data object fields. How can I customize the display of the report.

    Thank you

    Yes. This is possible.
    Go to the properties of the view tab.
    In the text and Align window
    Select the field you want to rename, and then type the position value visible report in the column header

    Concerning
    Poyard

  • need help on the name of the column in double materialized view ORA-00957

    I have a query, long enough and several (8ways) joins.

    When I run it as a SQL query, it is fine.

    When I add create materialized, view myViewName it errors with
    ORA-00957: duplicate column name.

    How is there is no problem when executing the SQL statement, and how to fix this?

    Thank you.

    Hello

    Columns in a query do not need a unique name:

    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    D D
    - -
    X X
    

    At least not in SQL * Plus; other front ends might oppose it.
    In previous versions of Oracle, subqueries (such as online views) does not need to have unique names, but you've got an error if you tried to reference a non-unique column (and it is unnecessary to have the column if never reference you).

    Columns in a table or a view need unique names:

    CREATE OR REPLACE VIEW view_x
    AS
    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    ,     dummy
          *
    ERROR at line 4:
    ORA-00957: duplicate column name
    
  • Need help query view with the 'Level' column name

    Hello world

    I use Oracle DB 10 g

    I have this request
    SELECT  count(per_id) 
    FROM    XXITS_EMP_MSTR_V
    WHERE   per_id = 213214 
    AND     Level='Technical Staff / Officer'
    XXITS_EMP_MSTR_V is a view created by someone else.

    I get the error "ORA-01788: CONNECT BY clause in this query block" for the the above statement.
    Is it possible that I can always get the result without changing the view?

    Any help is appreciated...

    Thank you
    Elmer

    Elmer says:
    Hello world

    I use Oracle DB 10 g

    I have this request

    SELECT  count(per_id)
    FROM    XXITS_EMP_MSTR_V
    WHERE   per_id = 213214
    AND     Level='Technical Staff / Officer'
    

    Place the level with quotes

    AND "Level" = 'Technical Staff / Officer'
    

    Make sure that the case is used correctly when using double quotes.

  • Rename the name of the connection Wireless in Windows 8

    In Windows 7, it was possible to change the name of the wireless connection to something meaningful (what a concept). For example my home wireless with ssid xxxxxxxx be named home wireless. When I connected to the Office Wireless (with a ssid of yyyyyyyy) he would be named Office Wireless.

    This seems to be is no longer possible in Windows 8. Microsoft is way too much fun playing silly blighters. They have really taken to a whole new level with this OS.

    After much research I found how to rename a wired connection, but not wireless. For the life of me I can't figure out how to do this.

    I'm * NOT * request your opinion on whether I should do this. I ask * HOW * to do this. (Futile attempt to ward off the unnecessary and inevitable "you shouldn't do" or answers "I don't see why you would want to...) »)

    Maybe what you are looking for requires you to access the registry to make the name change.

    HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles

    Browse the list of profiles to find the one that you need, and then change the value of string ProfileName.

    You can also do this when you change wireless cards and to reconnect to the same network and the connection then presents itself as 'name 2 Wireless' or ' wireless 3 "instead of just"wireless name' name, you can delete old profiles of the same name, and then rename the current without the number on the end. "

    After changes simply refresh your list of network connections to view the changes.

    As always, changes in the register are not advised, so with caution, take a backup before you change etc etc.

  • Cannot rename a column in the presentation layer 11.1.1.9

    Hello world

    I'm having a time difficult trying to rename a column in the presentation to 11.1.1.9 layer - even if I uncheck 'use the logical name Colmn' the "name" box does not become white, it remains grey. Am I missing something simple? I thought I could rename objects in the presentation layer to make them more user-friendly for some reason any?

    A quick search in this forum you will get the answer

    Cannot rename objects presentation

  • Get the value based on the column names for the custom of the Webcenter content metadata field

    University Complutense of MADRID, I created a custom text metadata field.  I then activated optlist this area.  I fill the optList values, I use a view.  The view has three columns.  Let us call their ID, Key, Value.  OptList shows keys in its list.  I then create content (Content ID: MyContent) Webcenter content and choose the OptList values for my new field of metadata (MyField).

    WebCenter portal, I'm filling a selectOneChoice with MyField values in the content ID: MyContent.  Remember the previous step, the values entered in selectOneChoice lists them selected values from the field MyField optList.  The optList is filled from view.  After the user selects a value in selectOneChoice, in Javascript, I need to alert a message in this format "selected value - matching value from the view of the optList that fills MyField.

    In my opinion, only an example will be useful:

    This is a view that I created in Configuration Manager applet in Webcenter content Admin cmdlets :

    ID | State | Capital

    1. North Carolina | Raleigh

    2. California | Sacramento

    3. Illinois | Chicago

    Then I create a custom field (name: MyField).  MyField is an optList values are filled with view created above.  Internal value and the display value are the two State.  Then I have a new content with Content Id Check-In: MyContent.  To MyContent, I select these values in OptList MyField: {North Carolina, Illinois}.

    In my portal Webcenter application, I create a Taskflow presenter content.  I have set up as single content item presenter.  I attribute as content ID MyContent.  Then, in templateView, I get all the values of MyField in MyContent and display as selectOneChoice.  I created a javascript function that would get the value that the user selected in selectOneChoice.  In the view created in the Webcenter content Configuration Manager (see above), there is a value corresponding to each displayed value.  So, for the selected value, I need to get the corresponding Capital and display in my alert message.

    Starting from Javascript, how can I get the value of the Capital, since I have the status value.

    Hello.

    The idea to reach your requirement is planned:

    • Create an Assistant manage bean that will appeal as access map: #{stateUtil ['Calofironia']} (it will return Raleigh). This value will get calling GET_SCHEMA_VIEW_VALUES IDC service using RIDC in your managed bean.
    • Pass the result of #{stateUtil ["statename"]} to your JavaScript function to help

    I hope this information help you.

    Kind regards

  • IN parameter is the string of column names I want to SELECT delimited

    Hi guys,.

    Please bare with me. Not a pro at writing stored procedures.

    What I try to do is to pass a parameter of 'IN' to the proc. The setting is a varchar2 which is a comma-delimited string.
    I want to put this string in the SELECT statement.

    This setting is called "P_SelectFields".

    The value in the passage in the proc is like:
    P_SelectFields = ' CUSTOMERS SUM (CLI_SERVED) AS SUM (EI_INTC) + SUM (NEI_INTC) AS INTERVENTIONS,
    SUM (TOT_EMPRTN) AS EMP_RETURN, SUM (TOTAL_RTS) AS SCHOOL_RETURN
    "


    That's what I've got and I know that it works, if I put the string instead of the parameter it works. !

    PROCEDURE GET_NATIONAL_TOTAL_RESULTS (P_SelectFields IN varchar2, P_AGREEMENT_TYPE_IND AGREEMENT_TYPE.agreement_type_ind%TYPE, io_cursor in SYS_REFCURSOR)
    IS
    BEGIN
    OPEN FOR Io_cursor

    SELECT year_desc,
    P_SelectFields - that's where I want my partameter go.

    OF SPF_RESULT_VW
    WHERE r_num = 1 - FILTER for the LAST PERIOD for EACH YEAR
    and agreement_type_ind = P_AGREEMENT_TYPE_IND - desired FILTER FOR Agreement_type_ind
    GROUP BY year_desc
    ORDER BY year_desc
    ;

    END GET_NATIONAL_TOTAL_RESULTS;


    That's what I'm after you run the proc.

    YEAR_DESC = 2011-2012
    : B2 = SUM (CLI_SERVED) ACE, SUM (EI_INTC) CUSTOMERS + EMP_RETURN SUM (NEI_INTC) AS OF THE INTERVENTIONS, SUCH AS SUM (TOT_EMPRTN), SUM (TOTAL_RTS) SCHOOL_RETURN

    Where is ': B2 = "come from?".

    What can I do to make my parameter is "picked up" by the proc?

    Thank you

    Firstly: in relational databases, there is no distinction between 'fields '. Tables is not 'fields', they have columns.
    It is my experience that that call columns 'fields' basically treats the database as a flat file system. It's a very bad idea!

    If you want to pass as a parameter column names, you need dynamic SQL.
    However, PL/SQL was invented to reduce the analysis and using of the dynamic SQL, you'll at least soft-parse each statement.

    Dynamic SQL is obviously in the documentation, but most people here think that they don't need to read the documentation.

    So, for once
    glance

    OPEN io_cursor FOR
    'SELECT year_desc,'||
    P_SelectColumns||
    ' FROM SPF_RESULT_VW '||
    'WHERE r_num = 1 '|| --FILTER FOR LATEST PERIOD FOR EACH YEAR
    'and agreement_type_ind = P_AGREEMENT_TYPE_IND '||-- FILTER FOR desired Agreement_type_ind
    'GROUP BY year_desc '||
    'ORDER BY year_desc'
    ;
    

    Please note that I have renamed the parameter.

  • How to find the column column_name from data_dictionary views

    Hi all.

    I have 60 + views, and I need to create a join based on those views.
    I'm looking for the name of the column of the data_dictionary so that I can write a script to write the SQL code to create the view to join?

    Something equivalent to user_tab_columns?

    I don't see that there is a user_view_columns?

    -Thanks for all the help

    View columns are user_tab_columns and all/dba_tab_columns.

  • How to propagate the column names in the file engineering reverse to db table?

    Hello

    I have successfully reverse engineered column about 100 names on the first line of a file flat .cvs in a data store of file (technology) using ODI 11.1.1.

    Now I would like to imitate what I used to do with OWB: simply propagate these column names from my data file store flat source to my table (in the meantime) target store empty db.

    How can I do?

    ---

    I tried as much as one can intuitively: drag the columns in my store of source (depending on model) to my target db table that is open in the main view, but ODI Studio just opens as Inspector tabs for columns.

    In my loading interface, if I choose 'Temporary target', it behaves exactly as I want (rigth click .cvs file to map the tab 'Add a column to the target'), even the chains are transformed into Varchar2...
    ... only, it will not implement target as a permanent store if I uncheck 'Temporary' and I can't select and copy the entire grid to export elsewhere.

    Generating the DDL to create a target table db and reverse would still be acceptable to me but generating the DDL for a store file does not make sense to ODI.

    Any help?

    Thank you

    2 quick ways to do:

    1.) copies the file according to the data store and then move it to the Oracle based model.
    2.) use CFD (designer of common Format) and create a diagram in your model of Oracle based. Drag and drop the file based model in there.

  • The date type of the column in the view

    Hello

    I would like to keep the start_date column type as a "date" type. But when create the view like below the type of the column is automatically set to varchar2 (11)

    {code}
    create table emp
    (digital emp_no
    , varchar2 (10) name
    start_date date);

    insert into the emp
    values
    (10, "Alan", January 1, 2010 "")
    insert into the emp
    values
    (20, 'Smith', may 12, 2000 ')

    create or replace view emp_v
    (emp_no
    first name
    start_date
    )
    as
    Select
    e.emp_no
    e.first_name
    , to_char (e.start_date, ' Mon-dd-yyyy "")
    from emp e
    {code}

    Thanks in advance
    Concerning
    Anna

    insert into the emp
    values
    (10, "Alan", January 1, 2010 "")
    insert into the emp
    values
    (20, 'Smith', may 12, 2000 ')

    you forcing oracle to convert string to date here - the best practice is to say explicitly what you mean with a to_date()

    the reason for which the view is created with a varchar column is that you explicitly convert a character with to_char() value, something you don't need as demonstrated above the column date.

  • Find the name of the view based on a sql query

    Can anyone suggest me how to find the name of the view based on a sql query? When I try to the following select statement:
    select view_name from user_views where text like '%SELECT * from TABLE%';
    but I get this error:
    SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    00932. 00000 -  "inconsistent datatypes: expected %s got %s"
    But as I notice that the TEXT column is really LONG to type... Are there any other table system that store information about the text using each view?

    See this example, using DBMS_METADATA. GET_DDL:

    Re: Search text in column

  • Add the string at the end of the column name

    Hi all

    I wonder whether it is possible or not. I created a similar table to another table to help-


    create table table_name in select * from table_name1;
    Now, I want to differentiate the name of the column of the previous table column names. I want to add E at the end of all column names. Is it possible using sql Command in sql or Toad workshop without doing it manually as I have more than 100 columns in this table?



    Thanks in advance.



    Kind regards



    Pascal M

    Hello

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL> create table test_1(col1 number, col2 varchar2(30));
    
    Table created
    
    SQL> create table test_2 as select * from test_1;
    
    Table created
    
    SQL> desc test_2;
    Name Type         Nullable Default Comments
    ---- ------------ -------- ------- --------
    COL1 NUMBER       Y
    COL2 VARCHAR2(30) Y                         
    
    SQL>
    SQL> DECLARE
      2     v_table_name USER_TAB_COLUMNS.TABLE_NAME%TYPE := 'TEST_2';
      3     c_column_suffix CONSTANT VARCHAR2(1) := 'E';
      4  BEGIN
      5     FOR REG IN (SELECT UTC.COLUMN_NAME
      6                   FROM USER_TAB_COLUMNS UTC
      7                  WHERE utc.TABLE_NAME = v_table_name) LOOP
      8        EXECUTE IMMEDIATE 'ALTER TABLE ' || v_table_name || ' RENAME COLUMN ' ||
      9                          reg.column_name || ' TO ' ||
     10                          substr(reg.column_name,
     11                                 1,
     12                                 29) || c_column_suffix;
     13     END LOOP;
     14  END;
     15  /
    
    PL/SQL procedure successfully completed
    
    SQL> desc test_2;
    Name  Type         Nullable Default Comments
    ----- ------------ -------- ------- --------
    COL1E NUMBER       Y
    COL2E VARCHAR2(30) Y                         
    
    SQL>
    

    Kind regards

  • I updated itunes to 12.4.0.119 and now find under the column of the view may not display the duplicate songs

    I have updated itunes to 12.4.0.119 and now impossible to find in the duplicate songs of column - the view

    I had the same problem, but a solution was found in another forum:

    Once more, Apple settled things. It is now at...

    file/library/show-duplicate-items

    These guys are worse with each update iTunes

  • How can I change the columns in File-> Open views program?

    I use El Capitan 10.11.3 on a MacBook Pro. I start with a clean system. I copied my files from my backup and reinstall my programs.

    This created a problem, seeking to resolve by changing the column headings in the views of program "file-> open.

    Whatever program I use, when I open a file, the window displays currently "Date added". It is of no use to me as the "Date added" to all my files is exactly the same - date, I have copied them on my own hard drive brilliant from my backup.

    In finder views, I can opt to display "update" instead of "added". So I order the files by date, whenever this is useful.

    However, whenever I try to open a file in a program, it is impossible to find things by date, because they all have the same "date added". I need to be able to see the "change date".

    I find anywhere that allows me to change this, either in the system preferences, or when opening a specific program. Don't I found clues to aid or the forum.

    Can someone tell me what I need to do?

    Thanks in advance.

    Mike

    Right click on the headers (if in list view) and select the headers you want to see.

    Alternatively, use the Arrangement to organize the desired date.

Maybe you are looking for

  • pop adds up to

    I have a new HP pc with firefox 27.0.1 installed. blockers of popups that are installed by default are active. I have my antivirus, avast, installed and up to date as well as spybot search and destroy. I win quite recent and 8.1 updates. What happens

  • lockout admin account?

    Hello, this is extremely important and I hope to get this resolved as soon as possible! I changed my iCloud email and password last night because I had to disable my old email address because it was full of spam and garbage. I changed it to a more re

  • How to create partitions

    Hello world... I just reformat my laptop (SA60-144) using my recovery dvd rom. now after that I have reformat I noticed that I don't have any partition more... for example I don't have my D DRIVE more I don't have DRIVE c... now I want to create two

  • Button of the camera - a big problem

    Is there anyway to cancel the camera button when on the standby or home screen. The phone is so big that my hand every time keep pressing the camera button. It's really a big problem.

  • Dynamic constraints on the functionality of the Application

    HelloI use Jdev 12.1.3 with MAF, I turn on the navigation bar, what I need to be able to hide/show the bar of navigation according to the java code feature, for example if (employee, Department) navigation bar include I want that in some cases, hide