Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

More info about DB2 VIEWS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 09, 2007 2:44 pm    Post subject: More info about DB2 VIEWS
Reply with quote

Hi All,

Am aware of what views are and their use; And about views, i can find -
1) View is a virtual table residing in temporary memory.
2) Only the view definition itself is actually stored in the database.

Please help me to know something more than that...
----> Suppose we are creating view DEPT_VIEW for DEPARTMENT table as below, what would be the content of DEPT_VIEW?

CREATE VIEW DEPT_VIEW
AS SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25

Would it be holding all the rows (data) that statifies WHERE clause? If so where these data will be stored (as views are not stored in physical storage)? Also how does the data gets updated when rows are processed (inserted/deleted) in the table?

---> Please let me know whether my understanding is correct - Views will NOT hold data and each time DEPT_VIEW is referred (For eg. SELECT * FROM DEPT_VIEW), the query defined in CREATE VIEW statement (SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25) will be executed and resultant temporary table would be used for further processing. Hence Views contains or refer ONLY the Query we have defined in CREATE VIEW statement and is not directly related to holding table data.

Please correct me if am wrong. Thanks in advance!!!
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 2:49 pm    Post subject:
Reply with quote

I think (if I understand you correctly) you are right....
In you example, just picture DEPT_VIEW as a shorthand way of saying
SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 09, 2007 3:11 pm    Post subject:
Reply with quote

Thanks William.
Then why all the notes i have referred are not pointing out this but simply saying as "Views look like and often behaves like base table". If it is referring just the query, then its behavior is unrelated with table behavior. Only the resulatant temporary table created through view would behave like a table. Also no one are projecting these points. Anyway thanks. icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 3:18 pm    Post subject:
Reply with quote

Shobana Bhaskar wrote:
Then why all the notes i have referred are not pointing out this but simply saying as "Views look like and often behaves like base table". If it is referring just the query, then its behavior is unrelated with table behavior. Only the resulatant temporary table created through view would behave like a table. Also no one are projecting these points.
William Thompson wrote:
I think (if I understand you correctly) you are right....
Well, I guess I didn't... What is your question?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS Database backup info ashek15 IMS DB/DC 14 Wed Nov 16, 2016 5:29 am
No new posts Utility to extract dsn info from conc... Lynne Schuler PL/I & Assembler 11 Tue Jan 26, 2016 6:36 am
No new posts print out the correct info in LOOP? jackzhang75 CLIST & REXX 7 Wed Dec 23, 2015 10:39 pm
No new posts Need info on SELECT statement subratarec DB2 7 Tue Jun 23, 2015 11:02 pm
No new posts Need info on QUIESCE utility in DB2 subratarec DB2 4 Fri May 22, 2015 12:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us