Views and Tables

  • I have table with column code char(2). The value in that column is either "EM" or "PM" and ofcourse we do have views based on this table.

    Now i want to make all records to EM in place of PM but dont want to change in the table, is there a way i can handle this in the view without changing the base table.

    thanks

  • If theres only two values you could create a view with static text.

    create view newtable as

    select column1, column2, 'EM' column3, column4

    from table1

    or you could translate it

    create view newtable as

    select column1, column2,

    CASE WHEN column3 = 'PM' then 'EM' else column3 end column3,

    column4

    from table1

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply