Query Design/Implementation Question

I have to query the database based on different input values from a JSP page. So, A user can query the database based on one or more fields. My question to you is what would be an efficient way to write the queries or implement this using JDBC. Should I write PreparedStatements for every possible combination of the query fields. Should I write stored procedures ? I had problems with the PreparedStatement earlier and I still do, so just to keep my developement going I wrote a stored procedure. If you read my previous post you can read the whole story.
So, this is more of a design question. Let the ideas flow.
Any help or suggestion will be appreciated.

Hi Justin,
This I got from an earlier post on this forum and you said that doing this was a very bad idea. Why ? I am doing this just as a workaround to my current problem.
So, basically I would have a temporary table for every query field in my JSP page. This table I would create in separate stored procedures and then finally do an AND to get the result ?
This feels dirty to me too but can u suggest a better way ?
stored procedure, temporary table, and result sets Nov 6, 2003 6:39 PM
Pls, Help me with the folloing questions:
1. Is it possible to declare and use temporary tables in a stored procedure? How?
2. Is it possible to return a result set, or recordset from a stored procedure? How?
These might be a very basic one, but as a beginer in Oracle Databse, I am having hard time to find out good source of technical materials.
Justin Cave
Posts: 5,786
OTN Member Since: Oct, 1999
Re: stored procedure, temporary table, and result sets ( In Reply To : stored procedure, temporary table, and result sets ) Nov 6, 2003 7:17 PM
1) You certainly can declare and use temporary tables in a stored procedure. On the other hand, doing so strikes me as a manifestly bad idea, so I would strongly caution you not to. If you explain a bit about what you're trying to accomplish, I'm sure there are better ways.
If you did want to create temporary tables in a stored procedure, you'd have to use dynamic sql, i.e.
execute immediate 'create temporary table foo...'
2) You can return resultsets from a stored procedure by declaring an OUT parameter which is a REF CURSOR.
Distributed Database Consulting, Inc.

Similar Messages

  • BEx Query Designer - Simple Question - Will Give Points Promptly

    I have this query designed and looks like I have personalized the variables from the parameter screen. how do I undo it. I am running this report from query designer itself and not th web. Kindly assist.

    It may be helpful to know that ODS 0PERS_VAR stores all the entries. We have used this in the past to see who had turned this on & for what kind of objects. You can also selectively delete out of the ODS if you had to, for some reason.
    <b>(Better one)</b>
    Start transaction SM31 (table maintenance)
    Enter table RSPERSHEAD and click on [maintain]
    It is not necessary to open the BW system for maintenance in SCC4.
    Search for the line:
    application component = VAR
    version = A (active)
    now un-check the checkbox in the table field "boolean" and save the changes.
    As a result the BEX analyzer will show all the personalized variables in the selection screens again, you don't have to delete the data in the ODS 0PERS_VAR.
    You can undo the changes by ticking the checkbox again.
    I have implemented this solution on BW release 3.1
    We only use BEX reporting so I don't know if this solution has any effect on WEB reports.
    please let me know if one of you encounters any problem with this solution.

  • Query Design - Hierarchy Question

    Hi guys,
    I am making a query with Cost and Profitaccounts. All the accounts are listed up in a hierarchy.
    6>61>610, 6>61>611,6>62>621 etc
    Under each 3digit account we have vendor information.
    Now one users wants me to create a query that only shows the 1digit accounts with directly the vendor information underneath it.
    How do you do this?
    Thank you,

    Hi Filip,
    if you want to display the 1 digit accounts then give the restriction by selecting it in the filter and give the range of fixed values.and if you want to display the heirarchial values then select the particualr dimension and right click and go to properties and select the hierarchy level and give for the display which node you want to display and hide the other fields by hiding them and you can gieve the selction also on hierarchy nodes by creating the hierarchy node variables.if this is not you are looking for exactly then post your question more clear way then we will help in resolving your issue.
    assign points if it helps.

  • BI 7 - BEX Query Designer variable question

    Hi all,
    If I have an Entry Variable in the selection screen of a query,  is it possible to populate another variable based on the user input.
    If I have a Report Date with a mandatory input, and I want a CalMonth variable to be populated based on this.
    Is the only way of achieving this through customer exits???
    Many thanks,

    Hi Shane,
    You would need to write a code in the CMOD for the variable, something like below:
    Declare internal table IT_RANGE with type same as I_T_VAR_RANGE.
    Also declare work area WA_RANGE like line of IT_RANGE
    when 'variable_name'.
         IF i_step = 2.
         REFRESH e_t_range.
         data: v_date type sy-datum.
         data: v_date1 type sy-datum.
         data: v_month type I length 2.
         data: v_year type I length 4.
         read I_T_VAR_RANGE into WA_RANGE where VNAM = 'variable_name' and IOBJNM = '0cal_day'.
         if sy-subrc = 0.
              v_date = WA_RANGE-LOW. "Date Entered by user     
         WA_RANGE-SIGN = 'I'.
         WA_RANGE-OPT = 'EQ'.
         * here we will write our logic to populate the 7 dates as required.
         * and populate the date into v_date1.
            WA_RANGE-LOW = v_date1. "Similar procedure to derive all 7 dates
         append wa_range to e_t_range. "We append all the 7 derived dates to e_t_range
            "(i.e. 7 append statements)
         You should be careful while writing the logic for previous month to handle year ends.
         you can use sample code like below for that:
         v_month = v_date4(2). "month
         v_year = v_date+0(4). "Year
         if v_month = '01'.
              v_month = '12'.
              v_year = v_year - 1.
    You will probably need an ABAPers help to write the logic for deriving the dates as required.
    Here your logic will be like finding end date of previous months which can be done using function module LAST_DAY_OF_MONTHS
    similarly you will have to get last dates of 3 quarters, which can be done by determining which quarter the input date falls in.
    and same for the year end date.
    Hope this helps
    Edited by: lazarus_joey on Feb 15, 2012 6:45 PM

  • 2013 Design implementation-two sites

    I have a design implementation question. We are a small firm with 80 AD users, 100 mailboxes, DB store is 200 gigs and all on Exchange 2007 (Virtualized connecting to a SAN), but growing rapidly. Also, we currently have two sites in Chicago and New York(Exchange
    2007 server in NY). We would like to upgrade from 2007(all roles installed on a VM server ESX 5.5 server) to 2013. Should we virtualized the Exchange 2013 or should they be physical servers? Also, since the servers will be in separate sites will I need a Load
    Balancer in both location? Also, should I split up the roles since we have two locations running the both roles on both servers. For example below:
    1 Chicago server-CAS/Mailbox Role
    1 New York server-CAS/Mailbox Role
    Should I have the Chicago users connect to the Chicago Server? And the New York users pointed to the New York Server? Currently everyone connects to the mail sever in NY. Any advice or comments would be appreciated.

    Yes, if you need proxy or redirection settings on OWA and other Exchange web services, one CAS in each site is must.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Simon Wu
    TechNet Community Support

  • Bi Query Design Question

                I have a question regarding a query design issue I was faced with today. I was asked to designed a Query, however all the fields required are all defined as characteristics but I would like to display one as a key figure. I would have a characteristic for a row, the column also for a characteristic and have another characteristic displayed instead of the key figured…… Is that possible?
    Thanks for any feedback

    Hi Serge,
    This question would be more appripriate -- and you will get a quicker answer -- in the BI Forums.  Please open your question there.
    Best Regards,

  • Please help how to design query to implement this requirement.

    Dear Expert,
    Here is what I have and what the requirement is:
    I have a InfoCube:
    1. Material
    2. Currency
    Key Figures:
    1. Qty
    2. Amount
    We want to get the Qty and Amount by Material, but use Currency to be the filter.
    It means for example, if the Currency have CNY for one material, we need to show all the Qty/Amount, not only Qty/Amount in CNY.
    So please help give some idea about how to design the query to implement this requirement.
    Thank you,

    Hi Andy:
    To accomplish your requirement you need to do 2 things:
    1. Create a Variable for the Currency (to be used as the Target Currency not as a filter for the Characteristic itself).
    2. Use the Standard Currency Conversion for the Amount Key Figure (Conversion Tab).
    This way, while executing the report you can select any currency you want and all the amounts will be converted to that currency.
    Take a look at this paper:
    "How to... Use Variables for Currency Conversion"
    A more detailed explanation can be found on this article provided by Ramakrishna Gattikoppula:
    "Currency Conversion in BI 7.0"
    In summary, to work with the Standard Currency Conversion you need to define 4 things:
    - Exchange Rate Type.
    - Source Currency.
    - Target Currency.
    - Time Reference.
    Francisco Milán.
    Edited by: Francisco Milan on May 31, 2010 11:19 AM

  • Query designer in EXCEL question

    I have a question about query designer in excel.
    I want SQL query to have in WHERE clause OR instead of AND (which is default), so the query would be like these:
    D1~SID_ZKAZALNIK AS S____590
    = D1~DIMID
    = DT~DIMID
    = DP~DIMID
    = 20044
    ) ) AND  ( (
    = 0
    ) ) AND  ( (
    <= 1060
    ) ) ) )</b>*** GROUP BY
    <b>WHAT I WANT:</b>
    D1~SID_ZKAZALNIK AS S____590
    = D1~DIMID
    = DT~DIMID
    = DP~DIMID
    = 20044
    ) ) <b>OR</b> ( (
    = 0
    ) ) <b>OR</b>  ( (
    <= 1060
    ) ) ) )</b>*** GROUP BY
    &SUBSTITUTE LITERALS&<b></b><b></b>
    Is there a way to change filter from AND to OR where u need that in visual query designer in Excel????
    I need these becouse i want to say smth. like that ... SELECT data FROM some cube WHERE date = 10/2004 OR date_q = 3/2004 OR month = 11 OR year = 2003

    Thanks for reply Roberto!
    Do u think with that? :
    Create 3 different queries on worksheet and than copy values in excel to another worksheet manualy?
    If that, then this is not an option for me, becouse i need joust one query.
    Is there another option?

  • Question about calculation example with Query Designer

    Hi guys,
    I have to calculate within columns and rows and I am not familiar with the settings in Query Designer that could be done to achieve the results.
    For example:
    Delay -
    Weighted Delay
    1000USD--10 days--
    2000USD--20 days--
    50000 (this is the sum row)
    The column marked with the xxx is calculated with the sum of weighted delay divided by the sum of payments (50000 / 3000).
    Has anybody an idea how the sum row can be calculated separately?
    Thank you for suggestions!
    Edited by: saplaz on Jul 13, 2010 8:47 AM
    Edited by: saplaz on Jul 13, 2010 9:08 AM

    Assuming you have the Payments Infoobject in the rows and WD Infoobject in the columns; Delay as a formula object.
    > Payments----
    Delay -
    Weighted Delay
    > 1000USD--10 days--
    > 2000USD--20 days--
    > 3000USD--xxx--
    50000 (this is the sum row)
    > The column marked with the xxx is calculated with the sum of weighted delay divided by the sum of payments (50000 / 3000).
    You may try this workaround of using
    on a formula variable. (In this case, the assumption is you have not static type-restricted the rows/cols) If you find any hinderances in the default approach, you may check this out as a formula & insert this at the cell editor level.
    If not, use a simple formula variable; here define the replacement path as 0(N) for your Payments. (N being the # of digits)
    Use a simple calculation:
    But you may not get an result o/p in the last row, as the values are not linked (sans relation with Payments). as it will return a X for the delay in the Result row.
    Pls. let me know know if this works or some sample o/p if the initial assumption was wrong.
    Arun Bala

  • Webi: BW Query design best practice question

    The scenario is as follows:
    SAP NetWeaver BW 7.01 SPS3
    Business Objects Enterprise XI 3.1 Fix Pack 1.2
    SAP Integration Kit XI 3.1
    Webi report built off of a BW Query. Based on the versions listed above, the MDX statement generated should only pick up only the fields listed in the query panel in Webi, not necessarily every field in the underlying BW query.  Having said that, does it matter what fields are in the Free CHAR or in the rows in the underlying BW Query??  I heard a suggestion that all fields should be put in the Free CHAR panel of the BW Query Designer but I don't see the value add of that approach.  Any thoughts?

    it does not matter if the items are Free Characteristics or rows or columns.
    for best practices here some material:

  • Query design question (NW04s)

    In query designer, how do I hide a column that has no data. I know how to suppress zero result columns, but these columns are not zero because they had no data.
    Can this be done using a local formula?

    Hi Raynald,
    Yes you can do this by restriction. I mean you restrict the report only display for the column that has a data.
    How you do this :
    1. Open your query.
    2. Right click for the characteristic (column), choose restrict.
    3. Choose for fix values, and singles value for selection type.
    4. (there will be 2 area) You restrict it by choose no-data / symbolized by # (move it from left to right pane).
    5. (After moving it to right pane) You right click to that symbol then choose exclude from selection in the context menu.
    If you have already made it, the column that has no data will be hidden.
    Hopefully it can help you.
    award points if it helps you.

  • Some question about the query designer

    hello, dear all,
    I am a new comer of here, and I am intersting in BI, but I have no basic knowledge about it.
    so I just want someone could give me some advice about it.
    our boss need I do the developer about the query designer,  I just have searched in this forum. but nothing founded for I am a new comer here,
    I heard there are some training document of the query designer, could someone give me the URL, thanks.

    Query desinger is used to develop a Query, Query can be created on following data targets
    -Info Cube
    Virtual data target
    We have 5 section in query designer
    - Infoprovider : where we select the data target , on which report to be created
    -Filter : to restrict value at infoprovider level ( if you want data for year 2008, for example)
    -Free Characterstic : this allow you to drill down
    -Columns : char/keyfigs to be display in columns can be added here
    Row: key/char to be display in Rows can be added here
    gv me ur mailid i will let u have Bex manual,
    I would suggest , if you have any IDES ( training ) system , where you can log in and then go to RRMX,
    and try to create new query and add any data target ( which is already created ) and then drag and drop the char/key fig to the required section ,
    save it and execute it .....
    if you play arround and see the output , that would help u to understand how to work with query designer.
    Hope this helps
    Edited by: Sukhvidner Singh on Nov 4, 2009 5:36 PM

  • Settings for SAP Portal start page from BEx Query Designer

    In order to see queries I would like to use SAP Enterprise Portal from BEx Query Designer.
    When I push "execute" button within BEx Query Designer a wrong page will be shown in browser.
    I changed the settings in table RSPOR_T_PORTAL, but still get the wrong Portal page shown in browser.
    What is the transaction/table/report to customize the portal start page using by BEx Query Designer?
    Thank you very much!

    Hi Anton?
    Many thanks for your reply.
    But I mentioned that I changed the URL within table RSPOR_T_PORTAL and this does not help...
    Do you speak Russian? Me too
    Can you also help me with the following problem?
    I am about to implement SAP Best Practices scenario "B34: Accounts Receivable Analysis".
    Therefore I load the data from SAP ERP IDES system into SAP NetWeaver 2004s system.
    My problems are:
    when I try to load the transaction data for Infosources 0FI_AR_4 and 0FI_AR_6 from SAP ERP system the following happens:
    - the status is getting u201Cyellowu201D (194 from 0 records)
    - at the next day the status is getting u201Credu201D and I received the following error:
    Errors while sending packages from OLTP to BI
    No IDocs could be sent to BI using RFC.
    System Response
    There are IDocs in the source system ALE outbox that did not arrive in the ALE inbox of BI.
    Further analysis:
    Check the TRFC log.
    You can access this log using the wizard or the menu path "Environment -> Transact. RFC -> In source system".
    Error handling:
    If the TRFC is incorrect, check whether the source system is fully connected to BI. In particular, check the authorizations of the background user in the source system.
    I did not find any entries on "Environment -> Transact. RFC -> In source system"
    The Source system connection EC6CLNT100 is OK
    Can some one help me to solve this problem?
    Edited by: Jgen Pfeiffer on Feb 5, 2009 12:48 PM

  • Difference between  aggregation and calculation tab in BEx Query Designer

    I am using BEx Query Designer for my report, for the key figures in the coloumn area i slected one numeric key figures, in  the properties tab i found aggregation tab and calculation tab.
    I need to sum up the total values for that particualar coloumn, when i used calculation tab i found to sum all the values for a particular coloumn, then what is the use the aggreagation tab?
    I not able to used that Aggregation tab it is showing as a hidden fields...
    can any one tell me whats the exact difference between these tabs and when we need to use which tab?
    With Regards,
    Thanesh Kumar.

    Hi Thanesh Kumar,
    I moved this thread from forum Data Warehousing to Business Explorer since it is a query related question (as SDN moderator).
    I could explain to you the difference between these two tabs.
    For "calculation" tab, it changes the display of result and does not change the calculation logic.
    It means that, if this key figure is used further in formula, still the original number (without "calculation" tab setting)  is used for further formula calculation.
    For "aggregation" tab, it changes the real calculation logic.
    The system takes the setting as the aggregation rule for records.
    The most common aggregation rule is of course summation. If you set to e.g. Average here, the system does the
    Average instead of summation when aggregating records. And the Average value will be taken for calculation
    in further formulas or other calculations.
    For "aggregation" tab, you could only use it for CKF (calculated key figure) or formula and you could not use it for
    a basic key figure. That should be the reason why you see it greyed-out.

  • Doubt on Rows and Coloums in BEx Query Designer.

    Hello, Experts.
    I have a Doubt in BEx Query Designer.
    In the Rows I have a Fiscal year Period,  if the user enters the Fiscal year period for e.g. : 001/2006  .  
    in the columns i have  forecast for the Fiscal year period which user entered ( 001/2006 ),   and we have another column pervious ( Prior )fiscal year period ( 001/2005 ). 
    My Questions is ,  as we are Restricting with 001/2006 will the query retrieve the values of 2005 or not?
    Thanks in Advance .

    yes i am  Doing Offest.
    I moved this Fiscal year Period to Free char,   and i Restricted with Pervious Fical Year period and Fical year period .  it worked.  but
    when i kept this in Rows and deleted Previous Fiscal Year period .  it is displaying blanks.   in prior years forecast.
    is it because i am Ristricting it to only fical year period  which user entered
             Colums-->  Forcast ( User Entered year )          Prior year
    Fiscal year period
      Fiscal year period( user enterd )

Maybe you are looking for

  • TouchSmart 600-1050 - Graphics Problem with MS Outlook

    I have a TouchSmart 600-1050. When I open MS Outlook, and then open the Calendar in a separate window, the window opens as non-maximized and everything is fine. When I maximize the window (I start in Week view), the tasks below each day do not stretc

  • Task not showing in UWL XML File

    Hello Experts, I am back with another query in less than a week. Requirement:- There is a Transaction BNK_APP by which users do their task (approve reject etc) it triggers a workflow and then the workitems are generated and sent to SAP Inbox. These w

  • Retrieve a single row from Oracle function

    Hi! I have an Oracle function created as follow: CREATE OR REPLACE FUNCTION user_data(userId IN users.user_id%TYPE) RETURN users%ROWTYPE AS userData users%ROWTYPE; BEGIN SELECT * INTO userData FROM users WHERE user_id = userId; RETURN userData; END u

  • HELP: symbol netvision phone w/cisco 350

    Hello I am having trouble setting up a symbol netvision phone with my cisco ap 350 that is running 12.01T. Basically, when the phone powers up it finds the SSID for my network (if i enable the broadcast SSID). It does not seem to get an IP Address/ma

  • 404 Error Downloading Oracle9iAS Java Edition 9.0.3 for Windows NT/2000

    When I click on the 9iAS_Java_Windows.zip from the Oracle9iAS download page (http://www.oracle.com/technology/software/products/ias/htdocs/javasoft.html) I get redirected to the following URL which gives me a 404 page not found error: https://profile