Table temporary global vs create and drop an ordinary table in pl/sql proc

Hello!

I currently have these statements in a pl/sql procedure:

EXECUTE IMMEDIATE 'drop table tmp_deal;

RUN IMMEDIATELY.
create the table tmp_deal as
Select deal_tracking_num, ins_num, tran_status
ab_tran t, part p
where 1 = 1
AND t.internal = p.PARTY_ID
AND p.sname in ("SXXX - YY", "ZZZNE - TT","FG - RT")
and t.MAT_DATE > sysdate - 15 * 31
AND t.status IN (1,3,4,11)';

EXECUTE IMMEDIATE 'create index tmp_deal_idx1 on statistics calculation in line of tmp_deal (status, tracking_num);
EXECUTE IMMEDIATE 'create index tmp_deal_idx2 on statistics calculation in line of tmp_deal (tracking_num, status);
EXECUTE IMMEDIATE 'create index tmp_deal_idx3 on statistics calculation in line of tmp_deal (ins_num);


As you can see I am falling and re-creating a table. The table is used as an intermediate storage for a larger SQL following further in my procedure (not shown in this post).

My question is:
Y at - it an advantage or a drawback in using global temporary tables (gtt) instead of the create and drop an ordinary table? The table contains about 7000 records and is not needed more once the procedure is complete. The procedure runs once per day, every day of the year

We are running Oracle 9iR2.

And finally, please do not look to find errors in SQL statements above. They are slightly darkened and still developing. The basic question is if TWG's benefit to the common way to do it.


Thank you in advance for your help!

user7066552, the use of temporary tables may be a necessity in SQL Server and mySQL, but with Oracle and its authors do not block readers reading model consistency using temporary tables as part of the treatment is generally unnecessary.

A valid use for a table of work could be where you create an operating table that is used to generate reports that are run on demand and several different users need access to the same data. However, you create the work only one table and truncate it prior to restocking rather than drop and it dynamically create. When only the current process will use the data a TWG is the way to go if you must have a table that is "temporary".

HTH - Mark D Powell.

Tags: Database

Similar Questions

  • grant, create and drop objects on the diagram to a role/user

    Generic question for Oracle RDBMS:

    As far as I know, there is no way for the owner of a schema privileges such as create objects, or drop objects in this schema to a user or a role.

    I know that a lot of people always asked if it is possible, and I hope Oracle will provide this capability, but as far as I know, it is not possible, even in 12.1.0.2.

    Does anyone have ideas on this?

    I considered to have developers to create programs to create tables, views, packages, etc. and then grant execute on them to the users/roles, but it would be a huge amount of work.

    Did someone come up with an easier way to do this?  Or know of a way that this can be done?

    Obviously, I can not grant create any table, index, package, view, etc., or to delete any table, view, etc., and of course we grant the DBA role.

    I thought that the 'become a user"was a solution, but it is apparently far from able to do such things.

    In our case, apparently, we have users log in with account of the owner of the schema and create objects, modify objects, etc.  (Change the objects is not a problem, because we can give everything on the object to someone.)   The problem is that we need to prevent people to connect to shared group accounts (or as the owner of the schema record) to create objects, drop objects, etc.).  We all have as their own user name and will not be able to create and delete objects in patterns of selection.

    Why must everyone CREATE and DROP of objects within the framework or the processing of information on the day the day?

    I feel a serious design flaw & conversion Orace DB.

  • How can I create and drop a directory

    I have a program that will create and remove a directory. This is my code

    I don't you can create an Active Directory like this

    create or replace the Signature directory as ' / images/sig/oo1 "; It works very well

    now I want to do it in the code

    Declare a variable
    strDir as Varchar2 (100);

    strDir: = ' / images/sig/oo1. "

    create or replace directory Signature as strDir
    is it possible

    kama021 wrote:
    I have a directory not created by me. I copied the image there and used this directory which worked without any errors. the file has been copied successfully. but I use mine it get invalid error even of file operations. some can tell me why it is so

    UTL_FILE, than any package aside server runs under oracle user OS (OS user oracle is installed, to be precise). Therefore, you must make sure oracle user OS can read/write the directory.

    SY.

  • How to create the Table using the column Drag and Drop feature

    Hello:
    I'm new to Data Modeler tool Oracle SQL dev and would like to know if there is a way to create a new table by reusing existing columns or groups of columns. The idea is to maintain consistency and save time of table design. If the columns created previously can be reused and require, drag and drop column in the right pane, then only new columns must be created manually.

    Any thoughts on this will be appreciated.

    Thank you!

    Yes - just change the name of the model table in the script (t_name = "table_template") then save this new transformation for later use.

    I don't know how to apply only some of the tables. Seems like something you could do to a secondary view level?

    Perhaps someone else on the forum can advise how to change the script to work on a subview only instead of the whole model.

  • open cursor and drop table

    Hello

    How does this work?

    Session 1: Session 2:


    SQL > create table t (x number);

    Table created.

    SQL > insert into t values (1);

    1 line of creation.

    SQL > insert into t values (2);

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > start

    2 for f in (select * from t) loop

    3 dbms_output.put_line(sysdate||) e '|| f.x);

    4 dbms_lock.sleep (60);

    5 end of loop;

    6 end;

    7.


    SQL > drop table t;

    Deleted table.

    SQL > select sysdate to double;

    13:58:45

    13:58:34 1

    13:59:34 2


    The table has been deleted, but the line is always returned once the table is deleted. With the help of OPEN and FETCH has the same


    declare
    cursor c is select * from t;
    r t % rowtype;
    Start
    Open c;
    extract the c in r;
    dbms_output.put_line(sysdate||) e '|| r.x);
    DBMS_LOCK. Sleep (60);
    extract the c in r;
    dbms_output.put_line(sysdate||) e '|| r.x);
    end;
    /

    Is this a bug? I could even reproduce it with 1 million rows. Shouldn't this ORA-01001 invalid cursor return?


    Start
    for f in (select * from t) loop
    If f.x in (1,10,100,1000,10000,100000,1000000) then

    dbms_output.put_line(sysdate||) e '|| f.x);

    DBMS_LOCK. Sleep (5);

    end if;
    end loop;
    end;
    /

    Thank you

    Laurent

    PS: It boils down to having no consistency to the DICTIONARY level... which is ugly

    Huh? The dictionary makes perfect sense.

    Any query cursor / who uses the data dictionary will get the correct results.

    If the cursor that you use should the data dictionary, it will get the correct results - he'll notice the table disappeared and will throw an exception.

    Your 'problem' manifests only for a SELECT query. Change the cursor in UPDATES and you can't delete the table.

    SQL > drop table t;

    drop table t

    *

    ERROR on line 1:

    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

    Even if you remove a line in this loop.

    https://docs.Oracle.com/CD/B28359_01/server.111/b28318/consist.htm#i8841

    As a request enters the implementation phase, change current system (SNA) number is determined. Figure 13-1, this system change number is 10023. As data blocks are read in the name of the query, only the blocks that are written with the observed SNA are used.

    When the cursor is opened that the SNA is determined, the data file header is read and Oracle knows where the first measure.

    The cursor can read this measure without the need of the data dictionary. So if you drop the table in another session your cursor can continue to read this measure.

    It is ONLY when the next measurement is necessary that Oracle uses the dictionary of data and notice that the table has been deleted.

    https://docs.Oracle.com/CD/B28359_01/server.111/b28318/logical.htm

    A scope is a number of blocks of contiguous data allocated for storing a specific type of information.

    The cursor can keep accessing the measure, and all these "contiguous data blocks" because he knows where the measurement begins and how many blocks there.

    So if 'million' lines fits into this extent (s) the query will keep trucking.

    It may take even more to see the missing table if a path to the index is used as the index blocks are pointers to the previous index block. These pointers can span extensions - you can read an entire table once it has been abandoned if the cursor is using the index to find all data or all the blocks table as long as the extensions/blocks being read have not been replaced or reallocated.

    It is therefore a problem for SOME ONLY.

  • CREATE/ALTER/DROP instructions and alerts log

    In the Oracle (12 c) Administrator's Guide under "monitoring errors with Trace files and alert newspaper ' is the following:

    Alerts log is a chronological record of the messages and errors, and includes the following items:

    -Any internal (ORA-00600), errors (ORA-01578) block and corruption blocking errors (ORA-00060) that occur

    - Administrative, operations such as CREATE, ALTER, and DROP statements and instructions STARTUP, SHUTDOWN and ARCHIVELOG

    -Messages and shared server process and dispatcher functions errors

    -The errors that occur when automatic refreshing a materialized view

    -The values of all initialization parameters that have default values at the time where the departure of the database and instance

    My question is about the second point (in bold).  I might be accused of not followed my journal to alert as closely as I should, but I have not noticed the CREATE/ALTER/DROP instructions in there.  I went to one of my test cases and created a table. No message was written for the journal of alerts.  I did a logfile switch just to make sure I was looking at the right file.  Yep - the switch is in the newspaper.  I dropped my test table - once again, no alert log entry was created.

    So my question is if the above is a documentation error or am miss me a piece of the puzzle?

    Hello

    It would really help if you posted a link to the document you are referencing, such as

    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/monitoring001.htm#ADMIN11242

    The ball before the one you pointed out said «All the internal errors...» »

    The ball that you pointed out does not say "All", so I interpret that as meaning only some of the most remarkable commands CREATE, ALTER, and DROP are recorded, for example CREATE TABLESPACE or ALTER SYSTEM.

    Like you, I think that literature should be clearer on this point.

    Below is the article you cited, there is a link:

    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/diag001.htm#CHDHEGBH

    which goes into a little more detail on this stuff is saved.  They are mostly all systemically important things, not things like creating a package, or editing a table individual users.  When the part you highlighted speaks of 'administrative operations, such as CREATE, ALTER, and DROP statements ', I think they're trying to distinguish certain types of CREATE, ALTER, and DROP statements, for example, things that only highly privileged users such as SYS or SYSTEM can do other, more frequent, CREATE, ALTER, and DROP statements.  Again, this is largely what I read in the literature, based on my experience.  Would be nice if the documentation is more explicit on this subject.

  • Questions about the reorganization of the rows in the table by drag-and - drop feature

    I am referring to the demo: 106. Drag-and-drop the reorganization of the rows of the table in aCorner of Code DF to implement my case.

    I am facing some problems:

    1. the view object (bound to the table) is read only and it is created directly by very complex SQL queries, without entity objects. When it is run the code: dragRow.removeAndRetain () in the method: DnDAction processDrop (DropEvent dropEvent), it throws the error so that a guest view object is read-only. I want to know if there is another way to delete the moved collection line?

     public DnDAction processDrop(DropEvent dropEvent) {
    ...       
           CollectionModel collectionModel = (CollectionModel) table.getValue();        
            JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) collectionModel.getWrappedData();
            
            //get access to the ADF iterator binding used by the table and the underlying RowSetIterator.
            //The RowSetIterator allows us to remove and re-instert the dragged row
            DCIteratorBinding departmentsIterator = treeBinding.getDCIteratorBinding();               
            RowSetIterator rsi = departmentsIterator.getRowSetIterator(); 
    
            int indexOfDropRow= rsi.getRangeIndexOf(dropRow);
           //get access to the oracle.jbo.Row instance represneting this table row
           Row dragRow = (ViewRowImpl)table.getRowData(draggedRowKey);
           //remove dragged row from collection so it can be added back
           dragRow.removeAndRetain();
           rsi.insertRowAtRangeIndex(indexOfDropRow, dragRow);
          ...
    }
    

    2. When you click on a button, I need to save the command results in the database using the command update # of each rank. Here it is the handler method for the event of the action (in MB) button.

    I want to use RowSetIterator table for encode it from all ranks and update the value # order of each rank.   I call a data control method to run sql update. is it ok? any suggestion?

        public void processSaveOrder(ActionEvent actionEvent) {
            CollectionModel collectionModel = (CollectionModel) mytable.getValue();        
            JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) collectionModel.getWrappedData();
            
            //get access to the ADF iterator binding used by the table and the underlying RowSetIterator.
            //The RowSetIterator allows us to remove and re-instert the dragged row
            DCIteratorBinding iterator = treeBinding.getDCIteratorBinding();               
            RowSetIterator rsi = iterator.getRowSetIterator();
            Row row =rsi.first();
            System.out.println(0+"="+ row);
            int i = 1;
            while(rsi.hasNext()){
                row = rsi.next();
                System.out.println(i+"="+ row.getKey());
                i++;
            }
    
        }
    

    A workaround solution was found:

    In ADF 12 c, it can be solved by changing Updatable "Always" in the details tab of each attributes to read-only view object without entity object.

  • Adobe Presenter 10 Drag and Drop questions - grey area only when you try to create

    Hello

    I try to create drag and drop questions in presenter 10 and after clicking on Add Question-> drag-and - drop, the new window opens but where I should be able to define the questions etc., the screen is just gray. Have the same problem on the three other systems as well.

    Flash is updated to the latest version as well as presenter 10.

    Oddly the Flash version installed is 15, but a right click in the grey box shows me version 11.

    Any ideas?

    Thank you

    Chris

    Just in case someone else has the same problem, a cat with Adobe brought the solution:

    On the gray screen, right click and go to global settings

    Go to the Advanced tab

    Scroll down and click on "trusted location settings.

    In the window 'Trusted location settings', click on 'Add' at the bottom

    Click on "Add a folder" and select "Local disk c".

    Click "Ok" and confirm on the "Trusted location settings" window

    Worked for me (on three different machines) like a charm!

  • Dag and drop in the table

    I would like to move a row of one table to another with drag and drop of components.

    I ve tried the dragsource to the first table, but I get the error:

    < af:table... >
    < af:column... >
    < / af:column >
    < af:dragSource actions discriminant = 'COPY' = "fileModel" / >
    < / af:table >

    can someone help me with the dragSource and dragTarget components?

    Published by: josefuente on October 7, 2010 01:39

    Hello

    If you want to move the lines, then you use


    <>
    actions = discriminant 'MOVE' = "rowmove" / >
    ...



    discriminant = "rowmove" / >

    ...

    You then create a managed bean method

    public DnDAction drophandler (DropEvent dropEvent) {}
    Transferable t = dropEvent.getTransferable ();
    DataFlavor df = DataFlavor.getDataFlavor (RowKeySet.class, "rowmove");
    RKS RowKeySet = t.getData (df);

    ... iterate on rowKeySet to get the key line of moved data path...
    ... look in the table for source and copy entire lines on another table...
    ... then remove the row of the table in the original array.

    Return DnDAction.MOVE;

    }

    Frank

  • Table and drop shadow

    I have two questions about the development on this page: http://www.orled.com/newnav.htm

    1. why can I get my table aligned to the top? I have this big white space along the top that is not part of my table.
    2. can I apply a shadow to a table cell in dw? I want a shadow on white blood cells that contains the logo.

    Be nice to me, this is my 1st site. Thank you all for helping me.

    1] white space in the upper part is because there is a set of margin of 24 PX homepage
    in the P7exp.css style sheet. Change this:
    {body
    do-family: Arial, Helvetica, without serif.
    do-size: 11px;
    background-color: #ffffff;
    margin: 24 PX 0;
    padding: 0;

    }

    To do this:
    {body
    do-family: Arial, Helvetica, without serif.
    do-size: 11px;
    background-color: #ffffff;
    margin: 0 24 0 PX 0;
    padding: 0;

    }

    Note that only the MARGIN line has been changed. This will keep your background
    margin, but zero in on the top margin.

    [2] to create a drop shadow, you must create an image of the shadow
    (Photoshop) and use it as a cell background, which you define in
    CSS. For example, to create a white square with a shadow through the
    top of the page, and then save it as shadow.gif. Next, create a custom as CSS class:
    {.cellshadow}
    background-image: url (.. / img/shadow.gif);
    background-repeat: repeat-x;
    }

    The path of the URL in the value above assumes that your style sheet is located in a folder
    (like 'css') and the image is in another folder ("img") - and the two
    These files are at the root of the site.

    Apply the class to your cell:

    --
    Alec Fehl, MCSE, A +, ACE, ACI
    Adobe Community Expert

    AUTHOR:
    Microsoft Office PowerPoint 2007: Full course (maze
    Publications)
    Welcome to the design of websites and HTML (labyrinth Publications)

    CO-AUTHOR:
    Microsoft Office 2007: Essentials (labyrinth Publications)
    Concepts of computer and Vista (labyrinth Publications)
    Mike Meyers A + Guide to managing and troubleshooting the PC (McGraw-Hill)
    Internet and Applications (EMC paradigm) systems

  • SELECT the data inserted into a global temporary Table in a stored proc

    A stored procedure is run from Oracle SQL Developer to insert data into a global temporary table. A SQL (in Oracle SQL Developer) worksheet is open to run a SELECT query to retrieve the data from the temporary table overall which was populated in the stored procedure. No row is returned. I guess it's because the stored procedure and the SELECT statement executed in different sessions.

    Is it possible to run the stored procedure in Oracle SQL Developer and then execute a select statement on the temporary table overall which was filled in the stored procedure by using the same connection so that the data can be extracted?

    I use version 1.5.1 build HAND-5440 of Oracle SQL Developer.

    In a worksheet, do something like

    Start
    insert_proc;
    end;

    Select * from my_temp_table;

    Place the cursor on each statement in turn and Press f9 (where it all began... the end is a single statement.

  • Cannot resize firefox so I can drag and drop to create a shortcut

    I can't make my Firefox page smaller so I can drag and drop a web site to create a shortcut. I use windows 7. I have no flu when I point at the bottom right. When I use zoom the page itself re sizes but not the window. I just need to see a bit of my office, so I can create a shortcut.

    Hi limomitch, Firefox will remember the last 'normal' window size by saving in this file you deleted (which Firefox creates new). To switch between the normal and maximized window styles, you usually just double-click the title bar of the window, or you can use the middle (the one between minimize and close) button in the upper right corner.

    If you find that the 'normal' window size has increased too, and if the lower right corner is not visible, you can try Alt + SPACEBAR. It is a convention of Windows on the scale to display the window control menu. If the size is not gray, press arrow down once, then the up arrow key repeatedly until the lower edge of the window is in view. Repeat with the left if necessary and right keys. (If the size is dimmed, choose restore and that might be all you need).

  • Drag and drop to create a custom step

    Hello

    I have an insert in my custom user interface palette. I want to allow the user to drag the step of the palette of insertion in the original designer of the sequence, as the Insert palette. The insert custom palette is in WPF.

    The data format for the object slide - déposer is

    e.Data.GetFormats)
    {string [1]}
    [0]: "SeqEditor new Step binary.

    The data is actually a MemoryStream:

    e.Data.GetData (e.Data.GetFormats () [0])
    {System.IO.MemoryStream}
    Base {System.IO.Stream}: {System.IO.MemoryStream}
    CanRead: true
    CanSeek: true
    CanWrite: true
    Capacity: 6936
    Length: 6936
    Position: 0

    So, it's actually a Unicode text if I read it with StreamReader:

    new StreamReader ((Stream) e.Data.GetData (e.Data.GetFormats () [0]), Encoding.Unicode). ReadToEnd()
    ' E@=3@JKZ100h\\L] JDYcLO7e9@FLU:h9iM] > 5Uf16W > Hii091DHkYGJKJHMd [].<>

    What is the right way for me to implement operation drag and drop my palette to insert custom options? I think to create a MemoryStream similar but I do not understand the format of the data.

    Thank you.

    Please note that the Clipboard format is not something that we intend to create directly and they may change in a future version of TestStand. So if you do this, keep in mind that it is possible, it may not work in a future version of TestStand (i.e. we do not support creating Clipboard elements directly).

    That said, it would be possible to operate in the current versions of TestStand as follows (I did not do exactly what you do, but here's how our format is currently produced):

    PropertyObject [] stepPropObjects = new PropertyObject [1];
    Step newStep = templateOfStep.AsPropertyObject (). Clone ("", PropertyOptions.PropOption_CopyAllFlags |) PropertyOptions.PropOption_DoNotShareProperties) as a step;
    newStep.CreateNewUniqueStepId ();
    stepPropObjects [0] = newStep as PropertyObject;

    DataObject dataObject = new DataObject();
    StepFormat = DataFormats.GetFormat DataFormats.Format ("SeqEditor new binary stage");
    String serializedPropertyObject = this. Engine.SerializeObjects (stepPropObjects, SerializationOptions.SerializationOption_UseBinary);
    serializedPropertyObject += 'F'; False to isEditCut (so unique ID will be created on the dough).
    System.Text.UnicodeEncoding encodingForStrConv = new System.Text.UnicodeEncoding ();
    ubyte [] buffer = encodingForStrConv.GetBytes (serializedPropertyObject);
    VvClipData of MemoryStream = new MemoryStream (buffer);
    dataObject.SetData (stepFormat.Name, vvClipData, false);

    Hope this helps,

    -Doug

  • Why creates shortcuts for Moving files when drag and drop the folder or file in another folder?

    I am using Windows XP SP3, just before I drag and drop the file into another folder in my windows explore. Suddenly, he is creating shortcuts for moving file. I'm not able to move the file by drag / move the mouse, it is possible that by cutting and Paste(Ctrl+X) using the keyboard. Why?

    Maybe your 'Alt' key is stuck.
    See exchanging the keyboard with another makes all the difference.

    HTH,
    JW

  • When I drag and drop a file, it creates a shortcut does not copy the file. I want to copy the file instead create shortcut.

    • Drag
    • drop
    • Drag / move
    • copy
    • short cut
    • create

    If you want to make a COPY of the file you drag (leaving the original where it is and make a copy in the place that you drop the file), and then hold down the control (Ctrl) key on your keyboard while you drag and drop, and she must make a copy in the new location.

    Hold down the ALT key should make a link/shortcut to the original.  Now does no key should MOVE the file from the original location to the new location.

Maybe you are looking for

  • Problem with driver sound on Satellite A200 under Win XP SP3

    Hi guys I recently bought a Satellite A 200 PSAE7. I had downgraded it to Win XP. Everything worked perfectly until last night. I restarted the laptop and I got no sound. I tried to reinstall the Realtek audio drivers, he succeeds, ask for a restart,

  • Satellite A30: BIOS password persists after removing

    Hi all I am using a Satellite A30, I set this password on the Bios "youandme" so after I decided to remove this password, I delete it properly, but after restard the laptop, the bios ask for the password, what can I do? Thank you for your support.Ome

  • Microsoft Server 2003 Causing me Problems

    OK, I used to use internet connection sharing on my laptop through a router connected to my computer through the modem Ethernet to my computer but now after the update to Microsoft Server 2003 he doesn't share not the internet EACH THING of ANOTHER I

  • Officejet 8000 Wireless: color printing

    Diagnosis page shows all the ink cartridges are half full.  The page also shows that magenta/cyan and black/yellow printheads are good.  Yet when in a trial in which I tried to print each color separately (yellow, magenta and cyan) only yellow printe

  • Cannot run the MDS Simulator

    I'm testing the demo of HTTP... everything is workin fine but it return an error after tried to connect for awhile (workin...) "java.io.InterruptedIOException: connection Local expired after 120000. The problem seems to be that the Services of MDS Si