Possible, yes. Advisable, probably not. Tables are not things that should
be created on the fly in 99.9% of the applications out there...
If you are coming from another database, like SQL Server, make sure you
understand how Oracle temp tables work. The definition of a temporary table
is visible to everyone, the data within the table, however, is visible only
to the session or to the transaction that inserted the data, depending on
how you've defined the table. In SQL Server, definitions are visible only
to the session that created the table, so it makes sense to create temp
tables on the fly there. It does not make sense to do the same thing in
Oracle.
If you really, really need to create tables on the fly, you can use dynamic
SQL
DECLARE
sqlStmt VARCHAR2(1000);
BEGIN
sqlStmt := 'CREATE GLOBAL TEMPORARY TABLE temp_emp( empno NUMBER )';
EXECUTE IMMEDIATE sqlStmt;
END;
Justin Cave <[Email address protected]
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
-----Original Message-----
From: Sarita
[mailto:oracledba-ezmlmshield-x17881710.[Email address protected]
Sent: Friday, October 08, 2004 4:46 AM
To: LazyDBA Discussion
Subject: Global Temp Table
Hi,
Can a global temporary table be made through Pl/SQL blocks? If yes, Can
anyone please provide example for the same.
Thanks & Regards,
Sarita Miranda
DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended recipient
you should not disseminate,distribute,store,print, copy or deliver this
message.Please notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or
contain viruses.The sender therefore does not accept liability for any
errors or omissions in the contents of this message which arise as a result
of e-mail transmission. If verification is required please request a
hard-copy version.
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page