Temp tables left behind by SDO_PC_PKG methods?

I have a bunch of MDPCE tables after playing with SDO_PC_PKG last week.
Are these temp tables left behind by SDO_PC_PKG methods? Is it safe to drop them?
What circumstances could have left them behind, and why were they committed when the call to the PL/SQL method crashed the client program? (copy/paste error in my OCI code).
Thanks, --DD
SQL> select table_name from user_tables;
TABLE_NAME
MDPCE_1_12565$$$
MDPCP_1_12565$$$
MDPCE_1_125BC$$$
MDPCP_1_125BC$$$
MDPCE_1_12653$$$
MDPCP_1_12653$$$
MDPCE_1_1266A$$$
MDPCP_1_1266A$$$
MDPCE_1_12681$$$
MDPCP_1_12681$$$
MDPCE_1_12698$$$
MDPCP_1_12698$$$
MDPCE_1_126AF$$$
MDPCP_1_126AF$$$
MDPCE_1_126C6$$$
MDPCP_1_126C6$$$
MDPCE_1_126DD$$$
MDPCP_1_126DD$$$
MDPCE_1_126F4$$$
MDPCP_1_126F4$$$
MDPCE_1_1270B$$$
MDPCP_1_1270B$$$
VSET_TAB
VSET_TAB$BLK
VSET_POINT_TAB
MDRT_136E4$
SQL> desc MDPCE_1_12565$$$
Name                                            Null?    Type
PTN_ID                                                   NUMBER
MIN_D1                                                   NUMBER
MAX_D1                                                   NUMBER
MIN_D2                                                   NUMBER
MAX_D2                                                   NUMBER
MIN_D3                                                   NUMBER
MAX_D3                                                   NUMBER
SQL>

I tried the test on 11.2.0.4.  On that release I get an error during a rename:
ERROR at line 1:
ORA-13199: Invalid Parameters for Partition_Table
ORA-13199: Invalid Parameters for Partition_Table
ORA-13249: Stmt-Execute Failure: RENAME "MDPCI_a_26062$$$" TO "M3_A_26062$$"
ORA-29400: data cartridge error
ORA-04043: object MDPCI_a_26062$$$ does not exist
ORA-06512: at "MDSYS.PRVT_PC", line 3
ORA-06512: at "MDSYS.PRVT_PC", line 157
ORA-06512: at "MDSYS.SDO_PC_PKG", line 74
ORA-06512: at line 17

Similar Messages

  • Z@R temp files left behind with roaming profiles removal

    See previous old post: Acrobat/Reader: [email protected] files left behind in Temp folder after printing
    It states that the issue is resolved with Windows 7 and Server 2008 ang higher, however i'm running multiple Windows 2008 R2 servers and this problem is killing me.
    A simple terminal server with only 5-6 users working on it, but abou 200 (left behind) user profiles.
    What can i do yo fix this? Already tried the options in the article. Not working. Running multiple versions of Adobe Reader 11.0.xx
    Please help.

    Can anyone help me? In the meantime we have multiple servers, with multiple customers. And it is really getting fustrating?
    I can't imagen Adobe does not care about this bug?

  • Global Temp Table or Permanent Temp Tables

    I have been doing research for a few weeks and trying to comfirm theories with bench tests concerning which is more performant... GTTs or permanent temp tables. I was curious as to what others felt on this topic.
    I used FOR loops to test out the performance on inserting and at times with high number of rows the permanent temp table seemed to be much faster than the GTTs; contrary to many white papers and case studies that have read that GTTs are much faster.
    All I did was FOR loops which iterated INSERT/VALUES up to 10 million records. And for 10 mil records, the permanent temp table was over 500k milliseconds faster...
    Anyone have an useful tips or info that can help me determine which will be best in certain cases? The tables will be used for staging for ETL Batch processing into a Data Warehouse. Rows within my fact and detail tables can reach to the millions before being moved to archives. Thanks so much in advance.
    -Tim

    > Do you have any specific experiences you would like to share?
    I use both - GTTs and plain normal tables. The problem dictates the tools. :-)
    I do have an exception though that does not use GTTs and still support "restartability".
    I need to to continuously roll up (aggregate) data. Raw data collected for an hour gets aggregated into an hourly partition. Hourly partitions gets rolled up into a daily partition. Several billion rows are processed like this monthly.
    The eventual method I've implemented is a cross between materialised views and GTTs. Instead of dropping or truncating the source partition and running an insert to repopulate it with the latest aggregated data, I wrote an API that allows you to give it the name of the destination table, the name of the partition to "refresh", and a SQL (that does the aggregation - kind of like the select part of a MV).
    It creates a brand new staging table using a CTAS, inspects the partitioned table, slaps the same indexes on the staging table, and then performs a partition exchange to replace the stale contents of the partition with that of the freshly build staging table.
    No expensive delete. No truncate that results in an empty and query-useless partition for several minutes while the data is refreshed.
    And any number of these partition refreshes can run in parallel.
    Why not use a GTT? Because they cannot be used in a partition exchange. And the cost of writing data into a GTT has to be weighed against the cost of using that data by writing it (or some of it) into permanent tables. Ideally one wants to plough through a data set once.
    Oracle has a fairly rich feature set - and these can be employed in all kinds of ways to get the job done.

  • Global temp table and edit

    Hi all,
    Can someone tell me why when I create a GTT and insert the data like the followijng ,I get insert 14 rows msg. But when I do a select statement from sqlwork shop , sometimes i get the data sometimes I don't. my understanding is this data is supposed to stay during my logon session then got cleaned out when I exit session.
    I am developing a screen in apex and will use this temp table for user to do some editing work. Once ithe editing is done then I save the data into a static table. Can this be done ? So far my every attempt to update the temp table always result to 0 rows updated and the temp table reversed back to 0 rows. CAn you help me ?
    CREATE GLOBAL TEMPORARY TABLE "EMP_SESSION"
    (     "EMPNO" NUMBER NOT NULL ENABLE,
         "ENAME" VARCHAR2(10),
         "JOB" VARCHAR2(9),
         "MGR" NUMBER,
         "HIREDATE" DATE,
         "SAL" NUMBER,
         "COMM" NUMBER,
         "DEPTNO" NUMBER
    ) ON COMMIT PRESERVE ROWS
    insert into emp_session( EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    select * from emp
    select * from emp_session
    -- sometimes I get 14 rows, sometimes 0 rows
    Thanks.
    Tai

    Tai,
    To say that Apex doesn't support GTT's is not quite correct. In order to understand why it is not working for you and how they may be of use in an Apex application, you have to understand the concept of a session in Apex as opposed to a conventional database session.
    In a conventional database session, as when you are connected with sqlplus then you have what is known as a dedicated session, or a synchronous connection. Temporary objects such as GTTs and packaged variables can persist across calls to the database. A session in Apex however is asynchronous by nature and a connection to the database is done through some sort of a server such as the Oracle HTTP server or the Apex Listener, which in effect maintains a pool of connections to the database and calls by your application aren't guaranteed to get the same connection for each call.
    To get over this, the guys who developed Apex came up with various methods to maintain session state and global objects that are persistent within the context of an Apex session. One of these is Apex collections, which are a device for maintaining collection like (array like) data that is persistent within an Apex session. These are Apex session specific objects in that they are local to the session that creates and maintains them.
    With this knowledge, you can then see why the GTT is not working for you and also how a GTT may be of use in an Apex application, provided you don't expect the data to persist across a call, as in a PL/SQL procedure. You should note though, that unless you are dealing with very large datasets, then a regular Oracle collection is preferable.
    I hope this explains your issue.
    Regards
    Andre

  • Global Temp table with BLOB causing session crash

    Hi,
    i have a table as follows:
    create global temporary table spg_file_import (
    name varchar2 (128) constraint sfi_nam_ck not null,
    mime_type varchar2 (128),
    doc_size number,
    dad_charset varchar2 (128),
    last_updated date,
    content_type varchar2 (128),
    content long raw,
    blob_content blob
    on commit delete rows
    this is my 9ias 'document' table thats used to receive uploaded files which i modified to be global temporary.
    what i want to do is:
    a)upload a text file (xml)
    b) convert that file to clob
    c) store that file in new permanent table as clob
    d) commit (hence delete temp table rows as they are no longer necessary)
    to test it i have:
    CREATE OR REPLACE procedure daz_html
    as
    begin
    htp.p(' <FORM enctype="multipart/form-data" action="daz_fu" method="POST">');
    htp.p(' <p>');
    htp.p(' File to upload: <INPUT type="file" name="p_file_in"><br>');
    htp.p(' <p><INPUT type="submit">');
    htp.p(' </form>');
    htp.p('</body>');
    htp.p('</html>');
    end;
    CREATE OR REPLACE procedure daz_fu (
    p_file_in varchar2
    as
    -- BLOB Stream locator
    v_raw blob;
    v_clob clob;
    v_blob_length number;
    v_length number;
    v_buffer varchar2(32767);
    v_pos number := 1;
    begin
    -- Get xml document from transient 9iAs data store.
    select blob_content
    into v_raw
    from spg_file_import
    where name = p_file_in;
    -- create temp LOB
    dbms_lob.createtemporary(v_clob, false);
    -- get BLOB length
    v_blob_length := dbms_lob.getlength(v_raw);
    loop
    -- get length to read. this is set as a max length of 32767
    v_length := least((v_blob_length - (v_pos-1)),32767);
    -- assign BLOB to a varchar2 buffer in preparation to convert to CLOB
    v_buffer := utl_raw.cast_to_varchar2(dbms_lob.substr(v_raw, v_length, v_pos));
    -- now write out to the CLOB
    dbms_lob.writeappend(v_clob, v_length, v_buffer);
    -- increment our position.
    v_pos := v_pos + v_length;
    -- exit when we are done.
    exit when v_pos >= v_blob_length;
    end loop;
    commit;
    htp.p('commit done!');
    end;
    now if i upload a small text file (about 5kb) it works with no problem.
    however if I upload a large text file (say about 1Mb) it crashes oracle with:
    Fri, 26 Jul 2002 11:49:24 GMT
    ORA-03113: end-of-file on communication channel
    DAD name: spgd1
    PROCEDURE : daz_fu
    USER : spg
    URL : http://www.bracknell.bt.co.uk/pls/spgd1/daz_fu
    PARAMETERS :
    ============
    p_file_in:
    F22210/Document.txt
    this produces a large trc file.. the trace file indicates the crash occured on the commit; line
    Current RBA:[0x4eb0.117.10]
    *** 2002-07-26 12:35:11.857
    ksedmp: internal or fatal error
    ORA-00600: internal error code, arguments: [kcblibr_user_found], [4294967295], [2], [12583564], [65], [], [], []
    Current SQL statement for this session:
    declare
    rc__ number;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 255;
    null;
    daz_fu(p_ref_in=>:p_ref_in,p_type_in=>:p_type_in,p_file_in=>:p_file_in);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    commit;
    else
    rc__ := 0; null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    :rc__ := rc__;
    end;
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    812b1998 42 procedure SPG.DAZ_FU
    819dff90 7 anonymous block
    ----- Call Stack Trace -----
    If i reaplce the temporary table with a non-temp table of the same structure i get no problems what-so-ever. Am I doing something that I shouldnt be with global temporary tables?
    Thanks.

    This is on Oracle 8.1.7.2

  • Best options to use in Temp Table

    Hello,
    I was just trying to figure out the best options we can choose with when we come across a scenario where we need to use a  Temp Table/Table Variable/Create
    a Temp Table on the fly.
    However, I could not see any big difference in using those options. As per my understanding using a table variable is more convenient if the query logic is
    small and the result set also will be comparatively small.Creating a temp table is also an easy option but it takes much time and we can not create any indexes on it. I am working on a query optimization task where in plenty of temp tables are used
    and the query takes more than five minutes to execute. We have created few indexes and all in few tables and reduced the query execution time up to 2 mnts.Can anyone give me more suggestions on it. I have gone through various articles about it and came to
    know that there is no one solution for this and I am aware of the basic criteria like  use Set No count on, Order the table in which the indexes are created, Do not use Select * instead use only columns which are really required, Create Indexes
    and all. Other than these I am stuck with the usage of temp tables. There are some limitations where I can convert all the Temp table logic to CTE (I am not saying its not possible, I really dont have time to spend for the conversion). Any suggestions are
    welcome.
    Actual Query
    select Code,dbo.GetTranslatedText(Name,'en-US')
    as Name from ProductionResponse.ProductionResponse
    00.00.02
    5225 rows
    With Table Variable
    DECLARE  @General
    TABLE(Code
    NVarchar(Max),Name
    NVarchar(Max)
    INSERT
    INTO @General
    select Code,dbo.GetTranslatedText(Name,'en-US')
    AS Name  from ProductionResponse.ProductionResponse
    select
    * from @General
    00.00.03
    5225 rows
    With an Identity Column
    DECLARE  @General
    TABLE(Id
    INT IDENTITY(1,1)
    ,Code NVarchar(Max),Name
    NVarchar(Max)
    INSERT
    INTO @General
    select Code,dbo.GetTranslatedText(Name,'en-US')
    AS Number  from ProductionResponse.ProductionResponse
    select
    * from @General
    00.00.04
    5225 rows
    With Temp Table:
    CREATE
    TABLE #General (Id
    INT IDENTITY(1,1)
    PRIMARY KEY,Code
    NVarchar(Max),Name
    NVarchar(Max)
    INSERT
    INTO #General
    select Code,dbo.GetTranslatedText(Name,'en-US')
    as Name from ProductionResponse.ProductionResponse
    select
    * from #General
    DROP
    TABLE #General
    00.00.04
    5225 rows
    With Temp Table on the Fly
    SELECT G.Code,G.Name
    INTO #General  
    FROM
    select Code,dbo.GetTranslatedText(Name,'en-US')
    as Name from ProductionResponse.ProductionResponse
    )G
    select
    * from #General
    00.00.04
    5225 rows

    >> I was just trying to figure out the best options we can choose with when we come across a scenario where we need to use a Temp Table/Table Variable/Create a Temp Table on the fly. <<
    Actually, we want to avoid all of those things in a declarative/functional language. The goal is to write the solution in a single statement. What you are doing is mimicking a scratch tape in a 1950's tape file system. 
    Another non-declarative technique is to use UDFs, to mimic 1950's procedural code or OO style methods. Your sample code is full of COBOL-isms! In RDBMS we follow ISO-11179 rules, so we have “<something in particular>_code” rather than just “code” like
    a field within a COBOL record. The hierarchical record structure provides context, but in RDBMS, data elements are global.  Or better, they are universal names. 
    >> I am aware of the basic criteria like use SET NO COUNT ON, Order the table in which the indexes are created, Do not use SELECT * instead use only columns which are really required, CREATE INDEXes and all.<<
    All good, but you missed others. Never use the same name for a data element (scalars) and a table (sets). Think about what things like “ProductionResponse.production_response” means. A set with one element is a bit weird, but that is what you said. Also, what
    is this response? A code? A count? It lacks what we call an attribute property. 
    This was one of the flaws we inherited when ANSI standardized SQL and we should have fixed it. Oh well, too late now. 
    Never use NVARCHAR(MAX). Why do you need to put all of the Soto Zen sutras in Chinese Unicode? When you use over-sized data elements, you eventually get garbage data. 
    >> Other than these I am stuck with the usage of temp tables. There are some limitations where I can convert all the Temp table logic to CTE (I am not saying its not possible, I really do not have time to spend for the conversion). Any suggestions are
    welcome.<<
    Yes! This is how we do declarative/functional programming! Make the effort, so the optimizer can work, so you can use parallelism and so you can port your code out of T-SQL dialect. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Query is taking too much time for inserting into a temp table and for spooling

    Hi,
    I am working on a query optimization project where I have found a query which takes hell lot of time to execute.
    Temp table is defined as follows:
    DECLARE @CastSummary TABLE (CastID INT, SalesOrderID INT, ProductionOrderID INT, Actual FLOAT,
    ProductionOrderNo NVARCHAR(50), SalesOrderNo NVARCHAR(50), Customer NVARCHAR(MAX), Targets FLOAT)
    SELECT
    C.CastID,
    SO.SalesOrderID,
    PO.ProductionOrderID,
    F.CalculatedWeight,
    PO.ProductionOrderNo,
    SO.SalesOrderNo,
    SC.Name,
    SO.OrderQty
    FROM
    CastCast C
    JOIN Sales.Production PO ON PO.ProductionOrderID = C.ProductionOrderID
    join Sales.ProductionDetail d on d.ProductionOrderID = PO.ProductionOrderID
    LEFT JOIN Sales.SalesOrder SO ON d.SalesOrderID = SO.SalesOrderID
    LEFT JOIN FinishedGoods.Equipment F ON F.CastID = C.CastID
    JOIN Sales.Customer SC ON SC.CustomerID = SO.CustomerID
    WHERE
    (C.CreatedDate >= @StartDate AND C.CreatedDate < @EndDate)
    It takes almost 33% for Table Insert when I insert the data in a temp table and then 67% for Spooling. I had removed 2 LEFT joins and made it as JOIN from the above query and then tried. Query execution became bit fast. But still needs improvement.
    How I can improve further. Will it be good enough if I create Indexes on the columns for the temp table and try.or what If I use derived tables?? Please suggest.
    -Pep

    How I can improve further. Will it be good enough if I create Indexes on the columns for the temp table and try.or what If I use derived tables??
    I suggest you start with index tuning.  Specifically, make sure columns specified in the WHERE and JOIN columns are properly indexed (ideally clustered or covering, and unique when possible).  Changing outer joins to inner joins is appropriate
    if you don't need outer joins in the first place.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Temp Table in view

    I Know we cannot use Temp table,table variable in View but i want to know the reason behind it

    Assuming the second batch is executed from a 2nd connection, there is no doubt that the query should return 46 on that 2nd connection. If the 1st connection would run the same SELECT statement, it should return 33.
    And if the definition of the temp tables are
    CREATE TABLE #temp(a int NOT NULL)
    CREATE TABLE #temp(b float NOT NULL)
    Keep in mind how view definitions are stored in SQL Server.
    I don't know exactly why the original poster wanted this, but what does make sense is of course a temporary view, and preferrably one that does not require a batch of its own. A couple of years ago, I wrote a stored procedure where I found that I repeated
    the same conditions all over again. This made me year for something like a module-level CTE and I submitted this Connect item:
    http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=343067
    Erland Sommarskog, SQL Server MVP, [email protected]

  • MySQL temp tables or Calling Stored procedures in CS4

    I need to filter a result set by username before performing a LEFT JOIN and including OR IS NULL rows. The SQL works from from the mysqli client, by either creating a temp table using  "create temporary table temp_appts select * from..."  Or by creating a stored procedure which contains the same "create temp table" statement, then running my LEFT JOIN statement against the temp table.
    I have tried both in CS4, it accepts the code in "code view" without errors but the page in a browser loads as a blank or a 500 error in IE. In my experience, this is caused by exiting before reaching the html header.
    Is it possible to do either in CS4?  Below is the code I am using.
    $varU_temp_appts = "-1";
    if (isset(<?php $_SESSION['MM_Username'])){
    $varU_temp_appts =$_SESSION['MM_Username'];
    mysql_select_db($database_ess, $ess);
    $query_temp_appts = sprintf("CREATE TEMPORARY TABLE temp_appts SELECT * FROM appts WHERE username=%s", /GetSQLValueString($varU_temp_appts, "text"));
    $temp_appts = mysql_query($query_temp_appts, $ess) or die(mysql_error());
    $row_temp_appts = mysql_fetch_assoc($temp_appts);
    $totalRows_temp_appts = mysql_num_rows($temp_appts);
    mysql_select_db($database_ess, $ess);
    $query_todays_appts = "SELECT *  FROM appt_tm LEFT JOIN (temp_appts) ON appt_tm.appt_time=temp_appts.appt_hr WHERE(appt_date=CURDATE() OR appt_date IS NULL)";
    $todays_appts = mysql_query($query_todays_appts, $ess) or die(mysql_error());
    $row_todays_appts = mysql_fetch_assoc($todays_appts);
    $totalRows_todays_appts = mysql_num_rows($todays_appts);
    Any help is appreciated!

    chuck8 wrote:
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'appt_tm LEFT JOIN (temp_appts) ON appt_tm.appt_time=temp_appts.appt_hr where tem' at line 1
    I'm no expert on joins, but I know there were changes in MySQL 5.0.12 that resulted in queries that had previously worked failing. Go to http://dev.mysql.com/doc/refman/5.0/en/join.html, and scroll down to the section labelled Join Processing Changes in MySQL 5.0.12.

  • Can i create temp tables in command?

    I need to create 5 temp tables and then use in CR for display. can this be done in Command?

    p.s. if this is regarding the same report that you've been dealing with for a couple of weeks now, please let us know exactly how you want the data to come back:
    a)  do you want 5 rows of data from 5 queries each returning one value, or
    b) do you want 1 row of data from queries with 5 columns
    e.g.
    a)
    field1
    1.6
    2.1
    3.1
    1.8
    2.6
    or
    b)
    field1     field2     field3     field4     field5
    1.6          2.1      3.1          1.8     2.6
    the a) or b) choice will determine what methods you can use to retrieve the data.
    if you don't want either a) or b) please describe how you want the data returned.
    -jamie

  • Uninstall Bootcamp, What's left behind?

    Okay I know this may sound weird but I'm wondering if anyone knows an answer to this. About 8 months ago I used the Boot Camp beta to run WinXP on my MacBook Pro 2,2. I ended up deciding I didn't want it and used the Boot Camp Assistant to remove it. All ways fine. I have since did an Erase and Install of Leopard, all is still fine. But I was messing around with rEFIt (never installing it) but I ran its Partition Inspector and got this:
    Current GPT partition table:
    # Start LBA End LBA Type
    1 40 409639 EFI System (FAT)
    2 409640 312319623 Mac OS X HFS+
    Current MBR partition table:
    # A Start LBA End LBA Type
    1 1 312581800 ee EFI Protective
    MBR contents:
    Boot Code: Unknown, but bootable
    Partition at LBA 40:
    Boot Code: None (Non-system disk message)
    File System: FAT32
    Listed in GPT as partition 1, type EFI System (FAT)
    Partition at LBA 409640:
    Boot Code: None
    File System: HFS Extended (HFS+)
    Listed in GPT as partition 2, type Mac OS X HFS+
    Whats up with these FAT and FAT32 partitions? Was something left over from Boot Camp and I've never realized it? I ran diskutil list in Terminal and got this:
    /dev/disk0
    #: TYPE NAME SIZE IDENTIFIER
    0: GUIDpartitionscheme *149.1 Gi disk0
    1: EFI 200.0 Mi disk0s1
    2: Apple_HFS MacBook Pro 148.7 Gi disk0s2
    /dev/disk1
    #: TYPE NAME SIZE IDENTIFIER
    0: Applepartitionscheme *297.5 Gi disk1
    1: Applepartitionmap 31.5 Ki disk1s1
    2: Apple_HFS rob 297.5 Gi disk1s2
    I don't see anything there mentioning FAT or FAT32 but EFI is there. By the way /dev/disk1 is my File Vault Disk Image, I know that.
    If I run rEFIT on a thumb drive, by holding down option on boot, my Mac of course asks to boot from my internal drive or the thumb drive running rEFIt, once rEFIt is loaded it asks to boot into my OSX partition or a Windows partition.... huh!? I thought it was gone! If I run it I get a usual looking white text on black screen saying there is nothing to boot to. So how is there any windows-type partition still there?
    So does anyone know? Is something left behind from those partitions that Boot Camp made that not even an Erase and Install of OS X Leopard got rid of? I know this is a little OSD of me, but I'm dying to know. And would love to know how to remove all traces of it. Thanks!

    No. Firefox keeps all session data (incl. cookies) in memory in PB mode and doesn't store any data on disk. Only the memory cache is used and not the disk cache (see the about:cache page).

  • Dropping Temp Tables

    We are currently converting our student information system from Sybase to Oracle. My task is to convert our existing sql scripts. A number of them use temp tables and I have successfully got them to run except that I cannot drop the tables at the end of the script because they are still in use *[Error Code: 14452, SQL State: 72000] ORA-14452: attempt to create, alter or drop an index on temporary table already in use*. For example:
    /* Oracle Version */
    -- Select Cactus ID ------------------------------------------------------------
    CREATE GLOBAL TEMPORARY TABLE tch1
    (name Varchar(45), tid Int, CactusID Varchar(12))
    ON COMMIT PRESERVE ROWS;
    INSERT INTO tch1
    SELECT
    t.lastfirst,
    t.id teacherid,
    c.value
    FROM
    teachers t
    INNER JOIN customvarchars c ON t.id = c.KeyNo
    AND fieldno = 148;
    -- Select Core Codes ---------------------------------------------------------------
    CREATE GLOBAL TEMPORARY TABLE crs1
    (name Varchar(45), cid Int, CactusCd Varchar(12))
    ON COMMIT PRESERVE ROWS;
    INSERT INTO crs1
    SELECT
    cs.course_name,
    cs.id courseid,
    c.value
    FROM
    Courses cs
    INNER JOIN customvarchars c ON cs.id = c.KeyNo
    AND fieldno = 146;
    -- Put it all together ---------------------------------------------------------
    SELECT
    t.lastfirst AS Teacher,
    ct.CactusID,
    s.schoolid AS Sch#,
    s.TermID,
    c.course_number AS Crs#,
    s.section_number AS Sec#,
    c.course_name AS Course,
    cr.CactusCd,
    COUNT(*) AS Enroll
    FROM
    cc
    INNER JOIN sections s ON cc.sectionid = s.id
    INNER JOIN courses c ON s.course_number = c.course_number
    LEFT JOIN crs1 cr ON c.id = cr.cid
    INNER JOIN teachers t ON s.teacher = t.id
    LEFT JOIN tch1 ct ON t.id = ct.tid
    WHERE s.schoolid NOT IN (701,711)
    GROUP BY
    s.schoolid,
    t.lastfirst,
    ct.CactusID,
    c.course_number,
    s.section_number,
    c.course_name,
    cr.CactusCd,
    s.TermID
    ORDER BY
    s.schoolid,
    t.lastfirst,
    ct.CactusID,
    c.course_number,
    s.section_number,
    c.course_name,
    cr.CactusCd,
    s.TermID;
    -- Drop Tables -----------------------
    DROP TABLE tch1;
    DROP TABLE crs1;
    I have an Oracle PL/SQL reference guide at hand, but I don't see any mention of dropping the tables when completed. I'm also curious if I'm using the terminator (;) correctly. MS SQL Server and Sybase did not require one.
    Thanks.

    Christopher Soza wrote:
    you need to issue a
    COMMIT;
    prior to issueing the drop table commands
    COMMIT will not help since GTT is ON COMMIT PRESERVE ROWS:
    Session 1:
    SQL> CREATE GLOBAL TEMPORARY TABLE tch1
      2  (name Varchar(45), tid Int, CactusID Varchar(12))
      3  ON COMMIT PRESERVE ROWS;
    Table created.
    SQL> insert into tch1 values('A',1,'B');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> Session 2:
    SQL> drop table tch1;
    drop table tch1
    ERROR at line 1:
    ORA-14452: attempt to create, alter or drop an index on temporary table already
    in use
    SQL> SY.

  • 8i temp tables

    We are converting from Informix 7 to Oracle 8i. We are trying to emulate the Informix version as much as possible, using sql create global temporary table for a large number of temp tables in the app. Since the created table name spans sessions for a userid (even though the data doesn't), we are thinking of adding the sessionid to the name:
    sql create global temporary table <tablename>:(sessionid).
    Is this a good solution, has anyone used this?

    I've seen this technique before (common code used by two different databases), and my advice is DON'T USE IT!
    You will end up with code that performs poorly on both platforms, and whatever time is saved from only writing code once is easily lost again in trying to devise "platform neutral" techniques.
    If necessary, use a language that's independent of the specific database in use, then call stored procedures to perform selects, inserts, updates and deletes as necessary. These stored procedures should provide a common external interface, but should utilise whatever methods are appropriate for the DB in question to actually perform the work.
    For example, write a Java class to perform the database access against Informix, and one that does likewise for Oracle. Your main application can than instantiate the appropriate class for the DB in question without worrying HOW the work is done. Providing the two classes each provide a common interface, your application is insulated from the detailed differences between Oracle and Informix.

  • Temp tables in procedure

    Hi,
    I am trying to develop a procedure in which i have to create four tables to improve the performance of the procedure.
    is there any other way in which i can do this? i don't want to create four table objects. if i use global temporary table. then also it will create structure in DB. i tried with table of records method. that is getting too complicated since its a very big procedure.
    can anyone suggest me other ways of achieving this?

    user12288167 wrote:
    this procedure is called at the same time by 10 different interfaces. the procedure has 4 temp tables now, which are required to improve the performance. after all the processing is done it will insert the result into a final table. Temp tables are not required to improve performance. In fact, it slows things down and make performance worse.
    What db operation has the single largest performance impact? I/O.
    What does your so-called "+improvment+" do with temp tables? Generate more I/O for creating data in the temp tables and manipulate data in the temp tables.
    So, how can generating more I/O be a performance improvement??
    so we need separate tables for all these interfaces.i.e. 5*10=50 tables in all which is not acceptable by our project.
    or is there any way to implement wait in the procedure while it is being accessed somewhere else?You need to scrap that procedure entirely. It is pretty much junk and will perform like junk.
    There is very seldom a need for temp tables in Oracle. Very Important: The reasons for using temp tables in SQL-Server/Informix/etc DOES NOT exist in Oracle.
    In Oracle, readers of data NEVER blocks writers of data. And writers of data NEVER blocks readers of data. Oracle provides and guarantees read consistency. There is no need for temp tables to deal with the lack of data consistency or (unwarranted) read/write serialisation.
    Read up on Oracle read consistency - and use that, correctly. Without resorting to hacks like you had to do with temp tables in other (inferior) database products.

  • Temp Tables conversion

    Hi
    Can anyone help me with the exact syntax to create temp table in
    Oracle 8i in Stored Proc. Eg.
    CREATE PROCEDURE MROSiteNoVendors
    @IDCustomer INT
    AS
    SELECT DISTINCT s.IDCustomer, SiteName, Address , AddressII,
    City, State, Zip, s.IDSite
    INTO #TempTbl
    FROM Sites s LEFT JOIN rSiteVendors rSV ON s.IDSite =
    rSV.IDSite
    WHERE (s.IDCustomer = @IDCustomer)
    ORDER BY SiteName
    Update #TempTbl Set Address = '' WHERE Address Is Null
    Update #TempTbl Set City = '' WHERE City Is Null
    Update #TempTbl Set State = '' WHERE State Is Null
    Update #TempTbl Set Zip = '' WHERE Zip Is Null
    SELECT * FROM #TempTbl
    DROP TABLE #TempTbl
    null

    Hello Krish,
    See this document for Upgrade specific tasks
    [SAP NetWeaver 7.0 Business Intelligence Upgrade Specifics|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10564d5c-cf00-2a10-7b87-c94e38267742]
    Also see this thread [Upgradation from BW 3.5 to BI 7.0|Upgradation from BW 3.5 to BI 7.0;
    Thanks
    Chandran
    Edited by: Chandran Ganesan on Mar 3, 2008 10:00 PM

Maybe you are looking for