Database temporary tables alternative?

Hello!
I would like to know if ADF supports the use of temporary tables in Oracle database? I would probably have to use dedicated connections for every application user, but I can't find anything on this matter. Is it even possible? If not, what are the alternatives? Can someone point me to the right direction on what and where to start searching?
Thank you for any useful info!

I've used temporary tables in ADF applications, and it works, but it is very dangerous - you have to fully understand how ADF (and JEE in general) maintains state in what is essentially a stateless environment. The problem is if you load a temporary table on one database round-trip, you cannot depend that it will still contain the same data (or any data) on another round-trip. There is no guarantee that the session will use the same database session, or that some other user hasn't used the same database session in between. So about the only good use of a temporary table is for a temporary work area during the execution of a stored procedure where it will be re-loaded on every call.
In fact, I'm working on a new version of my ADF application that used temporary tables to get rid of them.

Similar Messages

  • Is there a way to create "temporary" tables in SAP database?

    Hello,
    Is there a way to create temporary tables in ABAP?
    Here is our scenario:
    1. Invoke a custom RFC that creates a temporary table and returns the name of the table.
    2. Invoke another custom RFC and pass this table name as parameter. This RFC internally does some INNER JOIN with the temporary table.
    3. Invoke the third RFC to delete the temporary table.
    Note that the name of the table cannot be static. We have many users using our application simultaneously and connecting to the SAP server.
    I would appreciate it if you could point me in the right direction.
    Thank you in advance for your help.
    Peter

    I just ran into a similar issue.  While only calling the select statement 2 times, each time had so many entries in the 'for all entries' list, that the compiler converted this into about 700 calls to the select.  Now since the select joined three real tables on the database, the trace shows this one select as being the slowest item in this application.
    I think that happened because 'for all entries' gets converted to an 'IN' clause, and then the total number of characters in any SQL statement has an upper limit.   So the compiler must make the select statement over and over until it covers all entries in the 'for all entries' list.  Is that correct?
    Since every database I ever saw has the concept of db temporary tables, I have used db temp tables many times for this sort of thing.
    The ABAP compiler could determine that more than one IN statement will be need, then use an alternate: write all the FOR ALL ENTRIES to a db temp table, then join on the db temp table, then drop db temp table.  Since the compiler does this sort of thing, no application code needs change to get the speed boost.

  • Alternative way to create temporary table with better performace?

    Hi guys,
    Do you happen to a better alternative way for creating a global temporary table with better performance?
    I am creating a table and then using it in a big query but is taking a lot of time.
    Thanks for any help you can provide.

    I am not very familiar with explains plans, but I believe it is ok.
    The first query I had was repeating part of it in every subquery that is why I decided to create the temporary table. I have also tried using the WITH but it seems to take the same amount of time. I also thought of creating indexed but was told that it would work in this case.
    I have another discussion named "SQL Query Having performance issues" in this discussion I have included the query just in case you want to look at it.
    Thanks

  • Create Temporary Tables

    Hi, there.
    Can anybody tell me what's the syntax for the SQL statements to create temporary tables?
    I'm developing a shopping cart, and at the end of every purchase (checkout) I want to organize the items of the Session Bean Hash Table that contains them, and group them by category, brand, price and show the serial number of each item. I was thinking to do SQL-style operations like GROUP BY on the Hash Table itself, but I am having a hard time with it, so that's why I thought that filling a temporary database table with the Hash Table data could be the solution to the problem of grouping and ordering the items contained in the Shopping cart Bean.
    I saw the following code in this same forum:
    stmt = con.createStatement();
    stmt.executeUpdate("create table temp (slno integer, first_name varchar(32), middle_name varchar(1), last_name varchar(32))");
    But I don't understand how the temporary table has a fixed name, isn't that going to create conflict with another user that creates a temporary table with the same name but in a different session?
    I hope my approach makes sense. If so, what's the SQL syntax to create temporary-session-like tables so I can include it in my JDBC code?
    Thank you in advance for any information or alternative suggestion.

    But I don't understand how the temporary table has a
    fixed name, isn't that going to create conflict with
    another user that creates a temporary table with the
    same name but in a different session?Yes, it is. That's one reason why people try to avoid creating temporary tables, I suppose. There are other reasons.
    I hope my approach makes sense. If so, what's the SQL
    syntax to create temporary-session-like tables so I
    can include it in my JDBC code?You already know the syntax for creating a table. Your only problem is finding a unique name for the table, one that no other user will use. You could have a one-row one-column table with a number in it, which you read and increment, then use that number for your table name, for example. Unless your database happens to have this as a feature -- you would have to read its documentation to find that out.
    However as I implied before, you should try to avoid creating temporary tables. Creating a table is a time-consuming operation, and if your program ends abnormally without dropping the temporary table, your database slowly fills up with useless tables.

  • Temporary Tables in Stored Procedure

    Hi,
    I am writing a stored procedure that will get data from different sources and generates a spreadsheet finally. Initial select gets the basic data and following selects merges data.
    For this I have created a table in the database, I am populating data into that table using same procedure and finally selecting data from that table to generate spreadsheet.
    Now I am planning to use TEMPORARY table instead of creating table in database. Can anyone tell me where I can view samples for temp tables?
    Which one is the better option in performance wise?
    or
    can I handle the whole scenario with cursor? any examples?

    Hi,
    Why can't you use a regular table?
    Look up [Global Temporary|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_7002.htm#sthref7247] in the diocumentation, including the SQL*Language manual, for an alternative.
    "Temporary" applies only to the data. A Global Temporary Table is created once, and stays until you DROP it, the same as any other table.
    The data in the table is temporary. If you create the table saying "ON COMMIT PRESERVE ROWS" (which sounds appropriate, based on your description) the the data will automatically be deleted when you end the database session.
    All data in Global Temporary Tables is session-specific. If two (or more) people are using the same table at the same time, each will only see the data they inserted themselves; they will never see rows inserted by the other session.
    Almost anything you can do with a regular table you can do with a Global Temporary Table. In particular, DML (such as MERGE) and cursors work exactly as they do on other tables.

  • Using temporary tables

    Hi,
    i've created a temporary table(session specific)
    and inserting records into it during a form's runtime
    (working on Oracle 9i,Forms/Reports 9i) that are
    to be again fetched while generating a report which is
    being called from the form itself.but nothing is
    being fetched once i called the report.but it's sure
    that the records are being inserted into it.
    so i want to know if any specific syntax should be
    followed while calling the report using
    web.showdocument(....) or else any other alternative
    in this case(but temporary table a must)
    Thanks,
    Suresh.

    How did you create the temporary table? Is it possible that you did not specify "ON COMMIT PRESERVE ROWS" and that you're issuing a commit after inserting the data?
    CREATE GLOBAL TEMPORARY TABLE tempTable (
      col1 number
    ) ON COMMIT PRESERVE ROWS;will keep the session's data in tempTable after a commit is issued. Otherwise, the data will be deleted when a commit is issued.
    If this isn't the problem, how are you sure that the records are being correctly inserted in the table? Are you able to query the table successfully?
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • Temporary table within a package

    I'm not sure this is the best way to achieve it, but I'm trying to use a temporary table within my package, but I failed!
    In my package, my procedure do receive 5 different phone numbers (vTel1 to vTel5) and I need to order them, using data from a table. Also, if 2 of them are the same, I need only the one with the highest rank.
    Let say my TelOrder table look likes:
    Reason
    Tel1
    Tel2
    Tel3
    Tel4
    Tel5
    Reason1
    2
    3
    1
    5
    4
    Reason2
    1
    2
    null
    3
    4
    And I receive those variable
    vTel1='5141111111'
    vTel2=null
    vTel3='5143333333'
    vTel4='5141111111'
    vTel5='5145555555'
    vReason='Reason1'
    Using the Reason1, I need to be able to get the result looking like:
    RowNum
    Phone
    Order
    1
    5143333333
    1
    2
    5141111111
    2
    3
    5145555555
    4
    And I need this code to be apart from the procedure, cause many procedures will use the same code, and I don't want to abuse the ctrl+c, ctrl+v at each update.
    I've come close by using something like:
    EXECUTE IMMEDIATE '
         INSERT INTO Table
         SELECT Rownum as RN, Ordre, contact_info, Contact_info_type
         FROM
           (SELECT a.contact_info, a.ordre, contact_info_type FROM
             (SELECT contact_info,min(ordre) as Ordre FROM
               (SELECT Tel1 as Ordre, ''' || vTel1 || ''' as contact_info, 1 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
               UNION ALL
               SELECT Tel2 as Ordre, ''' || vTel2 || ''' as contact_info, 2 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
               UNION ALL
               SELECT Tel3 as Ordre, ''' || vTel3 || ''' as contact_info, 4 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
               UNION ALL
               SELECT Tel4 as Ordre, ''' || vTel4 || ''' as contact_info, 4 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
               UNION ALL
               SELECT Tel5 as Ordre, ''' || vTel5 || ''' as contact_info, 1 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             WHERE Ordre is not null and contact_info is not null
             GROUP BY contact_info
             ) a
           JOIN
             (SELECT Tel1 as Ordre, ''' || vTel1 || ''' as contact_info, 1 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             UNION ALL
             SELECT Tel2 as Ordre, ''' || vTel2 || ''' as contact_info, 2 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             UNION ALL
             SELECT Tel3 as Ordre, ''' || vTel3 || ''' as contact_info, 4 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             UNION ALL
             SELECT Tel4 as Ordre, ''' || vTel4 || ''' as contact_info, 4 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             UNION ALL
             SELECT Tel5 as Ordre, ''' || vTel5 || ''' as contact_info, 1 as contact_info_type FROM TelOrder WHERE Reason=''' || vReason || '''
             ) b ON a.contact_info=b.contact_info AND a.ordre=b.ordre
           ORDER BY a.Ordre
    But when I try to remove this code and send it into another procedure/function, I can't make it work.
    PLEASE HELP!!!!  

    No Database to try it. Check at your own risk if this might work for you
    no version specified from your side, NOT TESTED from my side, so let's say we're even
    select row_number() over (order by the_order) "RowNum",
           the_val "Phone",
           the_order "Order"
      from (select v.the_val,t.the_order,
                   row_number() over (partition by v.the_val order by t.the_order) rn
              from (select reason,the_order,the_phone
                      from (select reason,tel1,tel2,tel3,tel4,tel5
                              from telorder
                             where reason = :the_reason
                    unpivot include nulls (the_order for the_phone in (tel1 as 'tel1',
                                                                       tel2 as 'tel2',
                                                                       tel3 as 'tel3',
                                                                       tel4 as 'tel4',
                                                                       tel5 as 'tel5'
                   ) t,
                   (select 'tel1' the_var,:v_tel1 the_val from dual union all
                    select 'tel2' the_var,:v_tel2 the_val from dual union all
                    select 'tel3' the_var,:v_tel3 the_val from dual union all
                    select 'tel4' the_var,:v_tel4 the_val from dual union all
                    select 'tel5' the_var,:v_tel5 the_val from dual
                   ) v
             where t.reason = :v_reason
               and t.the_phone = v.the_var
    where rn = 1
       and the_val is not null
    Regards
    Etbin

  • Report: sorting of data and temporary table sorting

    We have a report that runs a procedure, which inserts data into a temporary table using the supplied parameters. The report then selects data from this table.
    Previously the report has always displayed data in the same order in which it was inserted into the table, even though no sorting is specified by the report itself. I realize that the report itself ought to specify the sorting in order to guarantee it, but this has worked in the past.
    As part of an application/Oracle upgrade the report has been recompiled. Data is now displayed in a different order as before. However, each time we run it now, it IS the same (new) sorting. So it's still consistent, but consistent in a different way than before.
    Is there some way to go back to the old sorting (display in same order as inserted into table) - without having to re-code this (and all the other) reports in order to specify the sorting? We think that data is still inserted into the temporary table in the same order as before. We are using the same version of Crystal Reports.
    Edited by: user489847 on May 31, 2010 4:01 AM

    Crystal Reports.This is the Oracle Reports forum.
    Anyway, I have seen this in one of our applications too. Suddenly the ordering was different, because there was no explicit order by. There is never a guarantee of the ordering if you do not specify it.
    You should ask this in the database forum too, since this is not really Reports related.

  • Use of global temporary tables in Procedures

    Hi
    I am using global temporary tables in the procedures. Loading data in the same table through many procedures. I am fetching the data from the global temporary table in PRO-C by a cursor. Will this degrade performance?
    Please help me..
    Thanks in Advance...

    Will this degrade performance?That depends... in comparison to what?
    Loading data into temporary tables will generally be more efficient than loading data into permanent tables because Oracle needs to do less to protect this data since it is inherently transient. On the other hand, loading the data into a table in the first place tends to be more expensive than alternatives like using a single SQL statement, a pipelined table function, or an in memory collection.
    Justin

  • How to Use Temporary table on report builder

    Hi community!
    Well, i'm trying to build a temporary table based report in Oracle Report Builder. in "After Parameter Form Trigger" I've placed a stored procedure that populate a temporary table and I've based my report on it. The problem is Report shows no data. When i execute this procedure directly on database and i perform a select on my temporary table, it show all inserted data.
    I hope somebody can to help me because I tried many ways to build this report with my temporary table and always looks blank.

    Temporary tables are session specific.
    If particular session is closed then no data will be found on your temporary table in an another session.
    My suggestion is, on "After parameter form" trigger you directly populate the GTT without using procedure.
    Hope this will help.

  • How to Create a Temporary Table with SQL Server

    I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
    I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs.  Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
    I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets.  Employees who are no longer employed, don't match, and don't display.  Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server.  Preferably in a temporary table.
    I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
    I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
    This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options.  That starts the queries, which creates the report.  So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
    If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source.  I'm trying the following, but getting an error:
    <CFQUERY name="ITE_Temp" datasource="SkynetSQL">
    CREATE TABLE #MyTemp
    (   INSERT INTO #MyTemp
    ITE2.TrueFile char (7) NOT NULL,
    ITE2.CountOfEmployee int NULL,
    ITE2.DTL_SUBTOT decimal NULL,
    ITE2.EMPTYPE char (3) NULL,
    ITE2.ARPT_CD char (3) NULL
    </CFQUERY>
    So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table.  I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
    <CFQUERY datasource="SkynetSQL">
    <CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
    INSERT INTO ITE_Temp
       (FullFile,
       EmployeeCount,
       DTL_Amount,
       EmployeeType,
       station)
    VALUES  ('#ITE2.TrueFile[i]#',
       #ITE2.CountOfEmployee[i]#,
       #ITE2.DTL_SUBTOT[i]#,
       '#ITE2.EMPTYPE[i]#',
       '#ITE2.ARPT_CD[i]#')
    </CFLOOP>
    </CFQUERY>
    But, I hate to have to create a table and physically write to it.  For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct?  Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE?   If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
    Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server.  Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer).  Thanks for any advice/help.  Much appreciated.
    Gary

    While waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work.  That was with this syntax:
    <CFQUERY name="AddTableRecords" datasource="MyTable">
    TRUNCATE TABLE ITE_Temp
    <CFOUTPUT query="ITE2">
    INSERT INTO ITE_Temp
    (FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
    VALUES
    ('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
    </CFOUTPUT>
    </CFQUERY>
    However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table.  But when I tried to read and output the results from the temp table, I got an error.  Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax.  Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
    <CFQUERY name="ITE_Temp2" datasource="MyTable">
    DROP TABLE ##MyTemp2
    CREATE TABLE ##MyTemp2
    FullFile char (7) NOT NULL,
    EmployeeCount int NULL,
    DTL_Amount decimal NULL,
    EmployeeType char (3) NULL,
    station char (3) NULL
    <CFOUTPUT query="ITE2">
    INSERT INTO ##MyTemp2 VALUES
    '#ITE2.TrueFile#',
    #ITE2.CountOfEmployee#,
    #ITE2.DTL_SUBTOT#,
    '#ITE2.EMPTYPE#',
    '#ITE2.ARPT_CD#'
    </CFOUTPUT>
    </CFQUERY>
    So even though the above works, I could use some help in reading/writing the output.  I've tried several things similar to below, but they don't work.  It't telling me ITE_Temp2 does not exist.  It's not easy to find good examples of creating temporary tables in SQL Server.
    <CFQUERY name="QueryTest2" datasource="SkynetSQL">
    SELECT *
    FROM ITE_Temp2
    </CFQUERY>
    <CFOUTPUT query="ITE_Temp2">
    Output from Temp Table<br>
    <p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
    </CFOUTPUT>
    Thanks for any help/advice.
    Gary.

  • Life time of data in a Global Temporary Table.

    Dear Friends,
    I have a global temporary table in which I insert some values via a backend package, when forms start up and accessing it via the same package when user performs some changes in it - storing the value and during exit saving it in the master table. My problem is the data is not accessible while processing. I'm using Oracle9i Enterprise Edition Release 9.2.0.1.0 database and Forms [32 Bit] Version 6.0.8.8.0. I also give you the script in using which I created the temporary table.
    CREATE GLOBAL TEMPORARY TABLE GTT_PRA
    A1 VARCHAR2(10 BYTE) NOT NULL,
    A2 VARCHAR2(15 BYTE) NOT NULL,
    A3 VARCHAR2(10 BYTE) NOT NULL
    ON COMMIT DELETE ROWS;
    Why is that so? Please help me.
    With Regards,
    Senthil .A. Perumal.

    Dear Arun,
    Thank you for your script. But I'm accessing a large table, so for each and every process, the table get populated and grows very large giving some space problem, that is why I'm deleting rows when commiting. I would appreciate your help.
    Dear Yogesh,
    From the same forms I'm calling the backend package - will that be a different session. Once I'm calling to populate the table and next time I'm calling to store the user modified data and finally calling to store the data to master table. I think all are in the same sessions. Please reply me.
    Thank you dear friends fr your immediate response. I would really appreciate it.
    Regards,
    Senthil .A. Perumal.

  • How to purge data in a global temporary table from another session

    I've got a problem with vendor-delivered web-based software (jdbc) that periodically "hangs." When that happens, I have to kill the database session before retrying the process. This "workaround" does NOT clean up the temporary tablespace. Is there anyway (outside of bouncing the database) to truncate temporary tables regardless of sessionid? Thanks.

    In 8i the space used by temporary segments is not dropped in a temporary tablespace. The space is available for other queries or temporary tables. This avoids the costs of allocating and releasing space for temporary segments.

  • Creating and Dropping a temporary table in Bi publisher?

    Hi all.
    My database is sybase.
    I created a new data set in BI publisher where it creates a temporary table,
    uses that temp table in a select query and then I dropped the temporary table.
    I wrote all these 3 SQL statements in a single dataset.
    This is executed for the first time with out any errors.
    The second time I am tryiong to run the report..It says It cannot create temp table as it has one temp table with the same name.
    When I execute the same query in my database (SQL developer) this works. But not working in BI publisher.
    Please suggest.

    I came across this thread...in this forum while looking for a solution..
    Can i create temporary table with BI Publisher ?
    If we have to use a data template...Does the function in data trigger necessarily needs to be a PL/SQL function? because..we donot use oracle database. we use T-SQL to write queries..

  • Loading Flat File and Temporary Table question

    I am new to ODI. Is there a method to load a flat file directly in to the target table and not have ODI create a temporary file? I am asking this in trying to find out how efficient ODI is in bulk loading a very large set of data.

    You can always modify the KM to skip the loading of the temporary table and load the target table directly. Another option would be to use the SUNOPSIS MEMORY ENGINE as your staging database. But, this option has some drawbacks, as it relies on available memory for the JVM and is not suitable for large datasets (which you mention you have).
    http://odiexperts.com/11g-oracle-data-integrator-%E2%80%93-part-711g-%E2%80%93-sunopsis-memory-engine/
    Regards,
    Michael Rainey
    Edited by: Michael R on Oct 15, 2012 2:44 PM

Maybe you are looking for

  • 975x PUE issues with memory

    Hi guys, I have my old 975x running with no problems with 2GB OCZ since a really long time, everything worked smoothly and i never did any OC of any type in the board. But nowdays 2GB is really few to keep the system and games running with no issues

  • New power adapter for old macbook - It doesn't work!

    Hello! My MacBook is 3 years old. My power adapter got broken at the end where you put it into the socket. Now I bought a new power adapter. The adapters have changed now. The end where you put it into the computer looks now a little bit different. B

  • JAPI/Hyperion Planning

    Hello;At the organization where I'm at, we have several departments. We have users from each of these departments inputting data and we like them to be able to aggregate the results from their input as necessary.I've created a small app using the Vis

  • WL60 can't see servlet

    nt4.0           I've spent the last 2 days trying to get a simple servlet to           work and I failing miserably. Here's the web.xml:           <?xml version="1.0" ?>           <!DOCTYPE web-app           PUBLIC "-//Sun Microsystems, Inc.//DTD Web

  • Function  giving numeric overflow

    When i call this function with parameter- 6244628707 i get this error-numeric overflow. CREATE OR REPLACE FUNCTION TATA_ICR.isprime (p_number NUMBER) RETURN NUMBER IS BEGIN IF p_number = 3 or p_number=1 THEN RETURN 1; END IF; FOR i IN 3 .. p_number -