Home » SQL & PL/SQL » SQL & PL/SQL » Home Work Question - Updating View (Oracle 10g, Win XP)
Home Work Question - Updating View [message #410183] Thu, 25 June 2009 10:11 Go to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

Hi,

I have a table (EMPS) with 4 columns (1 Not null column). I have created a view(EMPS_VIEW) for this table as following,

SQL> desc emps;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPNO                                              NUMBER
 ENAME                                              VARCHAR2(20)
 SAL                                                NUMBER(10)
 DOB                                       NOT NULL DATE

SQL> desc emps_view;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPNO                                              NUMBER
 ENAME                                              VARCHAR2(20)
 SAL                                                NUMBER(10)


How do i Insert into emps_view ?

I don't know it sounds silly to others, That's why I mentioned it as a Home work Question

Regards,
Ashoka BL
Re: Home Work Question - Updating View [message #410190 is a reply to message #410183] Thu, 25 June 2009 10:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
How do i Insert into emps_view ?

You can't, you have to create an "instead of" trigger unless you have a default value for dob.

Always post a working Test case: create table (and insert statements along with the result you want with these data).


Regards
Michel

[Updated on: Thu, 25 June 2009 10:30]

Report message to a moderator

Re: Home Work Question - Updating View [message #410226 is a reply to message #410183] Thu, 25 June 2009 14:20 Go to previous message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
As a footnote, you can also obviously just insert directly into the table itself.

Depends a lot on what purpose you have in creating the view in the first place. Often the goal is something along the lines of creating a "data read layer", possibly to hide certain underlying table columns, possibly to hide more complex join logic, etc.
Previous Topic: how to use the new_value to pass the variable
Next Topic: Oracle "GLOBAL TEMPORARY" Tables
Goto Forum:
  


Current Time: Thu Dec 08 16:32:06 CST 2016

Total time taken to generate the page: 0.15376 seconds