What are Global Temporary tables

Answers were Sorted based on User's Feedback



What are Global Temporary tables..

Answer / vivek

Global Temporary tables are session dependant tables which
could be used as temporary storage for calculations, sorting
etc. What I mean by Session dependant is, the data being
stored in the Global Temporary table is not written into the
database or stored anywhere. Once the session ends (in which
the Global Temporary table is used), the data also vanishes.



However the structure would still be available even after
the Session is logged out. Also, the structure is available
to other sessions even when one session is using it, but not
the data. i.e multiple sessions could use the same Global
Temporary table without interfering the data. Each session
could insert/update/delete their own data into the same
Global Temporary table as if the table is available to only
that session. Any data inserted in one session is not
available to another.



Now, why do we need Global Temporary tables? Well, imagine a
requirement where you need to fetch some data from the
database, do some kind of calculations, aggregations and
provide the Result Set (many records) to a Front End. Again,
in the Front End, you need to fetch the Result set may
times, for some purpose. Then you could make use of the
Global Temporary table. Until the user gets disconnected
from that Database session, the data is available for him in
the memory.

Is This Answer Correct ?    22 Yes 0 No

What are Global Temporary tables..

Answer / subbu

Global temporary tables belongs to that session only

create global temporary table test_gbl
( l_number_no number,
l_char_vc varchar2(100)
) [on commit delete rows]

ON COMMIT DELETE ROWS:- It's a default one
If any commit will issued that total data of a table will
losses. But table is exit

To overcome this we have option
ON COMMIT PRESERVE ROWS:-
means, If commit will issue the data of a table willn't loss
up to end of the session. Is session ends the data will losses.

Regards
Subbu

Is This Answer Correct ?    5 Yes 0 No

What are Global Temporary tables..

Answer / subbu

Global temporary tables belongs to that session only

create global temporary table test_gbl
( l_number_no number,
l_char_vc varchar2(100)
) [on commit delete rows]

ON COMMIT DELETE ROWS:- It's a default one
If any commit will issued that total data of a table will
losses. But table is exit

To overcome this we have option
ON COMMIT PRESERVE ROWS:-
means, If commit will issue the data of a table willn't loss
up to end of the session. Is session ends the data will losses.

Regards
Subbu

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

i declare 4 procedure in package specification but in package body i write only 3 procedure. is it complie??//w

4 Answers   Scope International,


Can a select statement fire a trigger?

0 Answers  


How do I add a database to sql?

0 Answers  


need to split a string into separate values. eg. col1 col2 ---------- 100 - 'a,b,c' 200 - 'a,x,d,e' 300 - 'c' result: value count ------------- a - 2 b - 1 c - 2 etc.

2 Answers  


What is sql query limit?

0 Answers  






How do you display "13th of November, 17 days left for month end" without hardcoding the date.

3 Answers  


I have a package in which a table was used in a procedure and compiled later i have dropped the table used in the package what would be the status of package specification and body

1 Answers   TCS,


How to create a view on a table which does not exists

4 Answers   Oracle, TCS,


what are the different tables present in mysql? : Sql dba

0 Answers  


what is definer rights invoke rights?

1 Answers  


Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 all the emp which does not have any dept? Q4 get all the emply detais with the dept details it dept is exit otherwise any emp details? Q5 how to debugg the dynamic sql and packages?

4 Answers   KPIT,


What is difference between table and view?

0 Answers  


Categories