Can i store the Result set values as a Session variable

hai,
I want the result set values of a query to be used many times and I want the same resultset between different page calls.
I want all those records fetched from the database to be available in the next page with out refetching from the database.
can any one help me out. its very urgent.....
Thanks and regards,
Ravikiran
mail to me at : [email protected]

"can i store the Result set values as a Session variable "
Practically Yes u can
but u want be able to accesses it in other pages
u can try it and see
the other thing u can do is store the values from the resultset in a object say vector and put vector in seesion and u can use this any where
for e.g
Vector v=new Vector();
While(rs.next())
v.addElement(rs.getString(1));
v.addElement(rs.getString(2));
session.putValue("myVector",v);
now where u want to get it do this
Vector myvec=(Vector)session.getValue("myVector");
do do futher

Similar Messages

  • How can I store the result of a Web service in a page or application item?

    Apex 3.1 Database 10.g release 2
    I have successfully created and tested a web service.
    I have created a web service process on the page and I can see that it is being run by setting the debug flag.
    I want to return the results of this to a page or application item.

    Well I'm not storing anything. But the Web service has the information I require.
    (So then I will always show the same build number on the java application and the reports application).
    We currently have a jsp page which gets the build number and this is displayed on the main application. I need to show the same build number on the apex application, so I thought that since this information is supplied by the web service I may as well call it.
    So far, the options appear to be:
    i) Change the web service so that it uses parameters (well at least one just for me)
    ii) call the web service with JavaScript and parse the response file.

  • How can I store the results of a report in an Oracle table ?

    In OBIEE 11g, we need the records resulting from the execution of a report, to be stored in an Oracle table.
    Is this possible ?. Thanks.
    F r a n c o . -

    GSR Hi, first of all thanks for your response.
    What I'm wanting to do is not exactly what you're proposing.
    What I want is that an end user can run a report and that the results be automatically stored in an Oracle table. Without manual intervention. Other BI products perform this action, and I need to do it with OBIEE. Thanks.
    F r a n c o . -

  • How to Store the result sets of a stored procedure that is returning more that one result set in two different table ?

    Hi Experts,
       I have on stored procedure which returns mote than one resultset i want that to store in two different temp table how can achieve this in SQL server.
     following is the stored procedure and table that i need to create.
    create procedure GetData as begin select * from Empselect * from Deptend 
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    exec GetData
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    exec GetData
    Niraj Sevalkar

    You cant get two resultsets out of SP like this. The workaround is to merge and bring the resultsets.
    For this number of columns as well as corresponding datatypes have to be compatible. Also you will need one additional column which indicates resultset value. Then use this as filter to get your desired resultset out
    create procedure GetData as
    begin
    select 'resultset1' as Cat,*,.. N columns from Emp
    union all
    select 'resultset2' as Cat,*,.. N columns from Dept
    end
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    Select column1,column2,column3
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset1'
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    Select column1,column2,column3, column4
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset2'
    also see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
    Another method is to populate table with relevant resultset within procedure itself and then select from the table directly outside.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • SQL Query - store the result for optimization?

    Good day experts,
    I am looking for advice on a report. I did a lot of analytic functions to get core data that I need to make my report and its takes around 50 min for SQL to complete. Now with this data I need to create 3 different reports and I cant use the same SQL since there is a lot of agregation (example would be group by product in one case and by client in 2nd). For each of those different group bys I need a different report.
    So how to create 3 reports from 1 SQL query without running the query 3 times?
    First thing that comes to mind is to store the result set into a dummy table and then query the table since the core data I get is around 300 rows and then do different group bys.
    Best regards,
    Igor

    So how to create 3 reports from 1 SQL query without running the query 3 times?
    You already know the obvious answer - store the data 'somewhere'.
    The appropriate 'somewhere' depends on your actual business requirements and you did not provide ALL of them.
    MV - if the query is always the same you could use an MV and do a complete refresh when you want new data. The data is permanent and can be queried by other sessions but the query that accesses the data will be frozen into the MV definition.
    GTT (global temp table) - if a NEW data load AND the three reports will ALWAYS be executed by a single session and then the data is NOT needed anymore then a GTT can work. The query that loads the GTT can be different for each run but the data will only be available for a single session and ONLY for the life of that session. So if anything goes wrong and the session terminates the data is gone.
    First thing that comes to mind is to store the result set into a dummy table and then query the table since the core data I get is around 300 rows and then do different group bys.
    That is commonly referred to as a 'REPORT-READY table'. Those are useful when the data needs to be permanent and available to multiple sessions/users. Typically there is a batch process (e.g. package procedure) that periodically refreshes/updates the data during an outage window. Or the table can have a column (e.g. AS_OF) that lets it contain multiple sets of data and the update process leaves existing data alone and creates a new set of data.
    If your core data is around 300 rows you may want to consider a report-ready table and even using it to contain multiple sets of data. Then the reports can be written to query the data using an AS_OF value that rolls up and returns the proper data. You don't need an outage window since older data is always available (but can be deleted when you no longer need it.
    If you only need one set of data you could use a partitioned work table (with only one partition) to gather the new set of data and then an EXCHANGE PARTITION to 'swap' in the new data. That 'exchange' only takes a fraction of a second and avoids an outage window. Once the swap is done any user query will get the new data.

  • Saving the result set in a Search page

    Hi ,
    We have a manual search page where the results are displayed in the form of 10 columns. The first 5 are read only fields whereas rest 5 are editable checkboxes.
    There is no Query region created in our page.
    Suppose, fields a, b, c are search parameters and the results are as :
    | A | B | C| D |E | F | G | H | I | J |
    1
    2
    3
    4
    5
    6
    7
    7 records are retrieved. Columns A to E are read only text fields whereas columns F to J are check boxes. The user can update the checkboxes.  We have a Save button below the result set region. This button on being pressed invokes a stored PL/SQL Procedure which does some validations on the result set so obtained.
    Our requirement is to dump all the 7 records (after the modifications are made to any number of result records) into a temporary table . The procedure will then pick the records from this temporary table and do the required validations.
    Question is :
    1. How to store the result set so obtained into a table after some (or all) records are modified once Save is pressed ?
    We do not have any EO created in our page. The VO for obtaining the Result set is a combination of many tables.
    Any help would be greatly appreciated.
    Thanks,
    Neha

    River_Plate wrote:
    root cause
    java.lang.NullPointerException
    org.apache.jsp.tablasUF_jsp._jspService(tablasUF_jsp.java:68)Do you understand anyway when a NullPointerException would be thrown? Those kind of RuntimeExceptions are basic Java knowledge.
    If an object is null while you want to access it, then a NPE would be thrown. Check the line of the cause which objects could be null and fix it accordingly.

  • Limiting the result set?

    How can I limit the result set of query without inventing a cursor, e.g. Select * from foo order by date desc LIMIT TO 5 rows
    Is there a statment in Oracle 8i enabling such a query (like in Oracle RDB)?

    To limit the result set use rownum. Here is an example:
    select * from tab where rownum <=5;
    I found this on another technet forum when I search on limiting query rows returned.

  • Can we pass temporary result set to the  procedure?

    Hi,
    The result set is stored in a temporary storage. Can we pass that resultset to the procedure?
    Thanks and regards
    Gowtham Sen.

    I'm still unclear just what this result set is... Is is a table or a cursor or something else?
    If you imply the physical result set of a SQL query, there is no such thing in Oracle. Oracle does not create and store a result set in memory containing the rows of the SQL SELECT. Creating such sets in memory does not scale. A single SELECT on such a database can kill the performance of the entire database by exhasuting all memory with a single large physical result set.
    Oracle "results" live in the database cache (residing in the SGA). Rows (as data blocks) are paged into and out of this case as demand dictates. When PL/SQL code, for example, fetches a row, the SQL engine grabs the row from the db cache (SGA) and copies it to the PGA (the private memory area of the PL/SQL process). The row also may not yet exist in the db cache - in which case it needs a physical read from disk to get the data block containing that row into the db cache (after which it is copied to the PGA).
    A PL/SQL process can do a bulk fetch - e.g. fetch a 100 rows from the SQL query/cursor at a time. In that case, a 100 rows are copied from the SGA db cache to the PGA.
    At no time is there are single large unique and dedicated memory struct in the SGA that contains the complete "result set" of a SQL query.
    Once you have fetched that row, that is it. Deal is done. You cannot reverse the cursor and fetch the row again. After you have fetched the last row in that cursor, you cannot pass that cursor to another process - the cursor is now empty. That other process cannot rewind the cursor and start fetching from the 1st row again. You will need to pass the SQL to that process in order for it to create its own cursor - also keeping in mind that in between the rows can have changed and that this other process could now see different results with its cursor.
    If you want to create such a physical temporary result set that is consistent and re-usable, you can use a temporary table - and insert the results of the SELECT into this temp table for further processing. This temp table is session specific and is auto destroyed when the session terminates.
    A comment though - it sounds like you're approaching the date warehouse processing (scrubbing, transformation and loading of data) as a row-by-row process.
    That is a flawed approach. Row-by-row processing does not scale. One should deal with data sets. Especially when the volumes are large. One should also attempt to perform minimal passes through a data set. Processing a bunch of rows, then passing that rows to another process to do some processing on the same rows.. this means multiple passes through the same data. That is very inefficient performance and resource wise.

  • How to get Implicit Dimensions/Dimension Values in the result set?

    Hi All,
    How does endeca return implicitly selected dimensions in the result set? For example, consider a dimension set up for Television data as below.
    Brand
    Samsung
    LG
    Philips
    Type
    LEDs
    LCDs
    Plasma
    Lets say, I refine the result set by brand, by selecting Philips. Now lets assume that there were 2 results returned for philips and both the results were of Type - Plasma. In this case, Endeca does not return the Type dimension in the result set, as we cannot drill down the 2 results further based on LED or LCD.
    How does Endeca return these implicit dimensions in the result set in such scenarios? Suppose if there was a requirement to show to the user that both the results were of Type - Plasma, how do we get this information from Endeca, by default?
    Thanks in advance :)

    How does Endeca return these implicit dimensions in the result set in such scenarios?Check out: Navigation.getCompleteDimensions() or Navigation.getCompleteDimGroups()
    http://docs.oracle.com/cd/E28910_01/PresentationAPI.622/apidoc/javadoc/navigation/index.html

  • Can you store the resultSet from a query into a vector?

    I am totally frustrated. How the heck does one store the results of a query (resultSet) in a vector so that I can get the vector from my jsp page to display in a table.? searchRS is my resultSet from stmt.executeQuery().
    public Vector storeResultSet ()throws SQLException
    int dataType;
    Vector rows = new Vector();
    System.out.println("INSIDE SEARCHQUERY VALUE OF searchRS: " + searchRS);
    // Get the ResultSetMetaData. This will be used for the column headings
    ResultSetMetaData rsmd = searchRS.getMetaData();
    // Get the number of columns in the result set
    int numCols = rsmd.getColumnCount ();
    columnNames = new String[numCols];
    System.out.println("inside of store results and column count of rsmd is: " + numCols);
    boolean more = searchRS.next();
    while (more)
    Vector testData = new Vector();
    for(int i=0;i<numCols;i++)
    Object value = searchRS.getObject(i);
    rows.add(value);
    System.out.println("VALUE of testData vector is: " + rows);
    more = searchRS.next ();
    rows.add(testData);
    System.out.println("This is the populated vector in storeSearchResults " + rows);
    return rows;
    }>

    The OP has initiated a new thread asking this question, it's here
    http://forum.java.sun.com/thread.jspa?threadID=5162925
    Please don't created duplicate threads! If you feel you have to create a new thread for this question, post here and explain (as I did) so that no further replies will be posted to this thread.

  • Can I create a result set filter on a SSRS Report similar to what you can do in Excel?

    Asking this question in a different way...I have my SSRS Result set. Now the Business User wants to filter down a 15-page report to what they want to specifically see....Sooo my result set has a list of claims. And now the Business User just wants to see
    the list of claims by a certain Provider, which is also in the report. So I don't want to put that "filter" on the front-end...within the Stored Procedure that is producing the report because they want to see everything. Is there a way to make SSRS
    intelligent enough to parameterize the back-end result set? Or do I need to do it the old fashioned way by allowing for an optional parameter, let them run their report, define the available values by a query similar to the stored procedure filtering, and
    let them drill down that way?
    I have tried playing around with Dataset filters and a parameter using the existing result set and existing Dataset, but I just cannot seem to get this to work the way I envision. If this entails creating a Function or Procedure within the SSRS, bring it
    on...I'm willing to learn. And I do have some VBA experience...so I'm not intimidated.
    Again...I apologize for the similar type question, but I felt the need to be a little more clear.
    Thanks for your review and am hopeful for a reply.
    PSULionRP
     

    I GOT IT!!!
    Followed the following...
    Here's what I've put into my SSRS Knowledgebase...
    Filters/Parameters on the Report Result Set
    Request from the Business User to add "parameters" to the Report Result Set. Kind of like auto filtering you can do in Excel
    Within the Report Design within Microsoft Visual Studio…
    — Insert a new Dataset which is merely carving out the SQL from the working Report Stored Procedure and customizing the SQL for the DISTINCT values that you want
    — Insert a NEW Parameter based on the carved out SQL
    General → Allow blank value
                      Allow multiple values
    Available Values → Get values from a query
    Specify the previously created Dataset
    Default Values → Get values from a query
    Specify the previously created Dataset
    — Insert a Filter back on the original Dataset that is used to create the Report
    Expression → Choose the Report Detail Item column name
    Operator → In
    Value → Physically type in the Parameter Name created previously
    Works EXACTLY as I had envisioned. Prompts for the From Date and Thru Date, runs the report, dynamically builds the "optional" parameters/filters,
    and then allows the Busimess User to speify or drill down into the result set based on the dynamically built parameter drop-down list.

  • How to do the second search in the Result set? Thanks

    Hi:
    I am going to implement a function so called "search in the result", with Tomcat 5 and Mysql 4.11
    The user will give out some conditions first , with these conditions, do the first search.
    Then they give some other conditions to do the advance search in the result from the first search.
    i dont wanna do the sec search with the combine conditions of first and second ones. as u know this will involve too much database retrieve.
    can i save the first search as the temp table or view? and then do the sec search directly from this temp table or view. is it possible in the JSP ?
    Thanks in advance.

    Hi,
    If u want to visit database only once follow this approach.
    Store the results of first query in a HashMap where the primary key of th table shld be made the key objects of Map and the values should be a Vector conating values of other clumns in database.
    Now, when user wants to refine the search with more criteria, just use vector.contains() method to check wether the new criteria are ther in values vector. If it there means the current key in hashmap satifies the refired criteria. So, retain this row. And any row which does not satisfy the refined criteria, remove that key-value pair from HashMap.
    Hope this helps.

  • How to return the result set of multiple select statements as one result set?

    Hi All,
    I have multiple select statements in my stored procedure that I want to return as one result set 
    for instance 
    select id from tableA
    union 
    select name from table b 
    but union will not work because the result sets datatypes are not identical so how to go about this ?
    Thanks

    You have to CAST or CONVERT (or implicitly convert) the columns to the same datatype.  You must find a datatype that both columns can be converted to without error.  In your example I'm guessing id is an int and name is a varchar or nvarchar. 
    Since you didn't convert the datatypes, SQL will use its data precedence rules and attempt to convert name to an int.  If any row contains a row that has a value in name that cannot be converted to an int, you will get an error.  The solution is
    to force SQL to convert the int to varchar.  So you want something like
    select cast(id as varchar(12)) from tableA
    union
    select name from tableb
    If the datatypes are something other that int or varchar, you must find a compatable datatype and then convert one (or both) of the columns to that datatype.
    Tom

  • Why to need close the result set and statement

    why to need close the result set and statement

    It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
    These should be closed in a finally block.
    Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
    You can capture this in one nice utility class, like this:
    package db;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.LinkedHashMap;
    import java.util.List;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    * Created by IntelliJ IDEA.
    * User: MD87020
    * Date: Feb 16, 2005
    * Time: 8:42:19 PM
    * To change this template use File | Settings | File Templates.
    public class DatabaseUtils
         * Logger for DatabaseUtils
        private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
        /** Private default ctor to prevent subclassing and instantiation */
        private DatabaseUtils() {}
         * Close a connection
         * @param connection to close
        public static void close(Connection connection)
            try
                if ((connection != null) && !connection.isClosed())
                    connection.close();
            catch (SQLException e)
                logger.error("Could not close connection", e);
         * Close a statement
         * @param statement to close
        public static void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
            catch (SQLException e)
                logger.error("Could not close statement", e);
         * Close a result set
         * @param rs to close
        public static void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
            catch (SQLException e)
                logger.error("Could not close result set", e);
         * Close both a connection and statement
         * @param connection to close
         * @param statement to close
        public static void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static void close(Connection connection,
                                 Statement statement,
                                 ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
         * Helper method that maps a ResultSet into a map of columns
         * @param rs ResultSet
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs) throws SQLException
            List wantedColumnNames = getColumnNames(rs);
            return toMap(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a map of column lists
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return map of lists, one per column, with column name as the key
         * @throws SQLException if the connection fails
        public static final Map toMap(ResultSet rs, List wantedColumnNames)
            throws SQLException
            // Set up the map of columns
            int numWantedColumns    = wantedColumnNames.size();
            Map columns             = new LinkedHashMap(numWantedColumns);
            for (int i = 0; i < numWantedColumns; ++i)
                List columnValues   = new ArrayList();
                columns.put(wantedColumnNames.get(i), columnValues);
            while (rs.next())
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value        = rs.getObject(columnName);
                    List columnValues   = (List)columns.get(columnName);
                    columnValues.add(value);
                    columns.put(columnName, columnValues);
            return columns;
         * Helper method that converts a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @return list of maps, one per row, with column name as the key
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs) throws SQLException
            List wantedColumnNames  = getColumnNames(rs);
            return toList(rs, wantedColumnNames);
         * Helper method that maps a ResultSet into a list of maps, one per row
         * @param rs ResultSet
         * @param wantedColumnNames of columns names to include in the result map
         * @return list of maps, one per column row, with column names as keys
         * @throws SQLException if the connection fails
        public static final List toList(ResultSet rs, List wantedColumnNames)
            throws SQLException
            List rows = new ArrayList();
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Map row = new LinkedHashMap();
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.put(columnName, value);
                rows.add(row);
            return rows;
          * Return all column names as a list of strings
          * @param rs query result set
          * @return list of column name strings
          * @throws SQLException if the query fails
        public static final List getColumnNames(ResultSet rs) throws SQLException
            ResultSetMetaData meta  = rs.getMetaData();
            int numColumns = meta.getColumnCount();
            List columnNames = new ArrayList(numColumns);
            for (int i = 1; i <= numColumns; ++i)
                columnNames.add(meta.getColumnName(i));
            return columnNames;
    }Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
    Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
    scsi-boy is 100% correct.
    %

  • How to Colour the fields in the Result Set of the query

    Hi all,
    I am having a requirement wher the user want to view the queries results with some colour to the char in the result set.
    suppose customer is the row he want to view some customers with one color and some with different color.
    Is it possible in Bi.
    If so Plz let me know
    Regards

    Hi Priya,
    for the macro thing, you will have to create a workbook and store your query into it, because macros are attached to only workbooks and not queries.
    in the workbook screen (i.e. excel), go to tools --> Macro --> Visual Basic Editor. or simply press Alt + F11. this will take you to macro editor screen.
    you can use code that may look something like below to color the columns, you can also give constant column if they are fixed.
    sub ColorColumns(rngTarget As Range, _
        intColor As Integer)
    Dim c As Long
        With rngTarget
            .Interior.ColorIndex = intColour
            Next c
        End With
    End Sub
    You will find some easy and short snippets for this.
    Regards,
    Purvang

Maybe you are looking for

  • What are the considerations shd be taken while creating multiprovider?

    hi all, What are the consideration / prequisite shd be taken before creating an multi provider. i am creating an multiprovider with four ods. And each ods is derived from different data source like r/3, etc. can anyone let me know abt it regds hari

  • Workforce planning

    Hello I have seen in some screens from books about PS that there is possibility to add personel to objects in Project Editor. There should be additional tabs where I can add personel numer to activity. But what prerequisities should be prepare to get

  • Something is blocking firefox loading, how can I fix this please?

    I have been using Firefox OK, then today I did various virus scans and malaware sweeps and since then something is preventing it loading and so I have to use Explorer. Every time I click on Firefox it comes up for a fraction of a second then disappea

  • IWeb 08 - Next the universe help needed

    I have built a website with the original iWeb and I am currently rebuilding it again on iWeb 08. http://web.mac.com/jamie_jones So far everything is going well and will be uploaded soon. But I now want to take things further and have my own domain na

  • JavaDoc for the SLD API?

    Hi forumers, I an unable to find a proper javaDoc for this API. Can anyone help please? Thanks, Boaz