Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Global Temporary Table

Re: Global Temporary Table

From: Howard J. Rogers <hjr_at_dizwell.com>
Date: Sat, 18 Oct 2003 18:03:01 +1000
Message-ID: <3f90f444$0$24515$afc38c87@news.optusnet.com.au>

Raj wrote:

> Hello Oraclegurus,
>
> I would like to know if i am doing the right thing or not??
>
> I've created a global temporary table "tempcomp".
>
> "create global temporary table tempcomp (col1 number,col2
> char,col3varchar2)" .
>
> I looked into these groups and it was mentioned somewhere
> that default is "on commit delete rows"... I am assuming that the rows
> are being deleted after commit and not stored .
>
> We have a web application which would be calling a stored
> procedure which inserts into a global temporary some values we need
> the values only for temporary time i.e., till user wants to study
> those values .
>
> The web client users could be many and they all connect the
> application with their respective id but the database connectivity is
> using only one database userid "scott" and accessing the schema and
> shcema procedures.
>
> The procedure call does inserts into the temporary global
> table.
>
> The data that would be inserted could be like this 'bike'
> 'big' 'bum' etc
>
> question: If one web user queries the table .... "where col2
> like 'b%'
>
> will he get the data which was inserted on execution of
> procedure by the first user who caused the inserts 'bike' 'bum'etc
> ..????
>
> or each web user is a seperate session and the select query
> will be unique for each user ...?????
>
> Please let me know if i am using the right thing by using
> global temporary table !
>
> Thanks in advance.
> Regards,
> Raj.

The data that is inserted into a global temporary table is private to the session that put it there. If I insert 'bum', and you insert 'big', and fred does a select, fred sees no rows whatsoever. If I do a select, I see 'bum'; if you do a select, you see 'big'. No-one, under any circumstances, sees the entire set of rows that happen to be present at any one nano-second.

Regards
HJR

-- 
--------------------------------------------
See my brand new website, soon to be full of 
new articles: www.dizwell.com.
Nothing much there yet, but give it time!!
--------------------------------------------
Received on Sat Oct 18 2003 - 03:03:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US