2D array getting errors on passing variables and more...

When I compile this, I get an error saying that I cannot pass my variables of pizza, type, and day. It says that it cannot have String and int[][]. Then I get errors saying that symbol cannot be resolved for my variables of type, pizza, and day when they are in my input and calculate methods of the menu class.
I am trying to set up a 2D array that has 3 rows and 7 columns, for 3 types of pizza and the days of the week. If I get it right, it should allow the user to input the # of each type of pizza sold on each day, and then total it and display the totals.
Each time I change something, I get something else weird going on. If anyone can help me figure out where I went wrong I would appreciate it.
Thanks
import java.io.*;
class my_main
     public static void main (String []args) throws IOException
     int [] [] pizza = new int [3] [7];
     String [] type = {"Cheese", "Sausage", "Pepperoni"};
     String [] day = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
     menu menupt = new menu();
     menupt.input(pizza, type, day);
     menupt.calculate(pizza, type, day);
class menu
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int col = 0;
int row = 0;
int total = 0;
int T;
     void input (String []args) throws IOException
     for (col = 0; col < 7; col++)
          for (row = 0; row < 3; row++)
               System.out.print ("Enter the number of "+type [row]+"pizzas sold on "+day[col]);
     void calculate (String []args) throws IOException
          for (col = 0; col < 7; col++)
          for (row = 0; row < 3; row++)
               T = total + pizza[row][col];
               System.out.println ("The number of "+type[row]+"pizzas sold on "+day[col]+"="+T);
          

When I compile this, I get an error saying that I
cannot pass my variables of pizza, type, and day. It
says that it cannot have String and int[][]. You are calling :
menupt.input(pizza, type, day);What this call is trying to do is send 3 arguments to input() - the 1st arg is a 2d int arr, the 2nd is a String arr and the 3rd is a String arr i.e int[][], String[], String[]
But the input() method is declared like this:
void input (String []args) throws IOExceptionAccording to this signature, input() takes only 1 argument - String arr, not 3 args that you are trying to pass to it.
Hence the compile error.
Then I
get errors saying that symbol cannot be resolved for
my variables of type, pizza, and day when they are in
my input and calculate methods of the menu class.Really?
void input (String []args) throws IOException
for (col = 0; col < 7; col++)
for (row = 0; row < 3; row++)
System.out.print ("Enter the number of "+type [row]+"pizzas sold on "+day[col]);
}Where are the vars type, pizza & day in the input() method? The only vars that it knows about are :
1. args - the string array argument that is passed to it.
2. col
3. row
Each time I change something, I get something else
weird going on. If anyone can help me figure out
where I went wrong I would appreciate it. First try to understand the following:
what variables are
what variable scope means
what scopes are possible
how to pass arguments to methodsThen a light bulb will turn on in your head with regard to these problems/errors.

Similar Messages

  • Getting error when passing variable to Matlab script

    Hi
    I am using LabVIEW 2013 Version 13.0f2 (32bit) and MATLAB R2014b (Version: 8.4.0.150421) in Windows 7 Professional  Version 6.1 (Build 7601: Service Pack 1).
    I am trying to pass measured data to a matlab script to plot but I get errors.
    I have made a small program to make the problem easyer to solve and I get this error
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Reference to a cleared variable A.
    . in MatlabTest.vi
    I tried the solution mentioned in http://digital.ni.com/public.nsf/allkb/4475BC3CEB062C9586256D750058F14B though it was intended for an older version. This gave me this error instead
    Error 1048 occurred at LabVIEW:  LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'num'.
    " in MatlabTest.vi
    The problem occures when I try to access the input, in other words I can have inputs to my script as long as I do not use them.
    How can I solve this?
    Attachments:
    MatlabTest.vi ‏7 KB

    Thank you so very much.
    I shold of cours have realised that that was what happened but I always use the three clearing lines (close all, clear all, clc) in the beginning of a script to make sure that no old and irrelevant data corrupts my script and did not think about when the inputs were generated.
    Again, Thank you!

  • Getting error while passing implicit request object from JSP to JavaBean

    Hi,
    I am getting error while passing implicit object ie( request object)
    from within JSP to JavaBean.
    Following is source for JSP, JavaBean and Error message I am getting.
    vaLookup.jsp Source
    <jsp:useBean id="db" class="advisorinsight.javabeans.DisplayPages"
    scope="request">
    <jsp:setProperty name="db" property="request" value="<%= request %>"
    />
    </jsp:useBean>
    <jsp:getProperty name="db" property="totalrecords" />
    JAVABEAN DisplayPages.java source
    package javabeans;
    import java.io.Serializable;
    import javax.servlet.http.HttpServletRequest;
    public final class DisplayPages implements Serializable {
    private String totalrecords;
    private HttpServletRequest request;
    public void setRequest(HttpServletRequest req){
    this.request = req;
    public java.lang.String getTotalrecords()
    this.totalrecords =
    this.request.getParameter("totalrecords");
    return this.totalrecords;
    public DisplayPages(){
    totalrecords = "";
    request = null;
    error after executing vaLookup.jsp
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service JavaExtData successfully loaded
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service LockManager successfully loaded
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service RLOPManager successfully loaded
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:7] info: ENGINE-ready: ready: 10819
    [30/Nov/2001 11:56:46:0] info: --------------------------------------
    [30/Nov/2001 11:56:46:0] info: JSPRunnerSticky: init
    [30/Nov/2001 11:56:46:0] info: --------------------------------------
    [30/Nov/2001 11:56:51:7] error: Exception: SERVLET-compile_failed:
    Failed in compiling template: /va/valookup.jsp, javac error:
    c:\iplanet\ias6\ias\APPS\variabl
    S\va\valookup.java:76: Undefined variable: JSP_8
    db.setRequest(_JSP__8);
    ^
    1 error
    Exception Stack Trace:
    java.lang.Exception: javac error:
    c:\iplanet\ias6\ias\APPS\variableannuity\va\WEB-INF\compiled_jsp\jsp\APPS\va\valookup.java:76:
    Undefined variable: JSP_8
    db.setRequest(_JSP__8);
    ^
    1 error
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileJSP(Unknown Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileOrLoadJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown
    Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJspCompiler(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUriRestrictOutput(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(Unknown
    Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown
    Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

    The only thing that I see that looks funny to me is when you pass the request object into the method using <%=request%>, Im not sure whats going to happen here because that is suppose to print the results. Have you tried simply using <%request%>?

  • Getting error after putting variable in select statement

    Hi All,
    Kindly help me with Pl/sql code
    here i'm trying to put variable in select statement ....
    I successfully put the Yr and Mnth ..but getting error for loop variable "i"
    Here i'm getting error that too because of " i" only-->TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    Please find the full code below.
    Declare
    Yr number not null:=2010;
    Mnth varchar2(20) not null:='Jun';
    v_val number:=0;
    begin
    for i in 1..2 loop
    case i
    SELECT count(*) into v_val
    FROM DUAL
    WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
    in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'))
    end case;
    end loop;
    end;

    Declare
      Yr number not null:=2010;
      Mnth varchar2(20) not null:='Jun';
      v_val number:=0;
    begin
      for i in 1..2 loop
      SELECT count(*) into v_val
      FROM DUAL
      WHERE TRIM(UPPER(TO_CHAR(TO_DATE(i||'-'||Mnth||'-'||Yr,'dd-Mon-YYYY'),'DAY')))
      in (UPPER('Monday'),UPPER('Tuesday'),UPPER('WEDNESDAY'),UPPER('THURSDAY'),UPPER('friday'));
    end loop;
    end;

  • I can't open PSE.  Get error message 150:30 and restarting computer doesn't help.  Any suggestions?

    I can't open PSE.  Get error message 150:30 and restarting computer doesn't help.  Any suggestions?

    Please try out the instructions mentioned in this article.
    Thanks!!

  • Hi, I got my Mac in 2009 with photoshop elements on it - it's recently been wiped, however before the process we put Photoshpp onto a hard drive, we then copied it back over and it no longer works, I'm getting error code 150:30 and I'm being asked for a p

    Hi, I got my Mac in 2009 with photoshop elements on it - it's recently been wiped, however before the process we put Photoshop onto a hard drive, we then copied it back over and it no longer works, I'm getting error code 150:30 and I'm being asked for a password... any ideas how to get it working again?

    You can never, never migrate an installed copy of PSE. It's just too complex and you can't get to all the bits and bobs.
    First you will have to download and run this:
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    which will not seem to do anything, but is necessary to break the links within PSE so that you can pitch the bits manually. Then you will have to go around, not only to applications, but also to your username>library>preferences and most importantly to the library at the top level of your hard drive>application support>adobe, and remove everything you can find. Spotlight will not help with this kind of search, so don't try that.
    Then you can install PSE from scratch.

  • Any Function Module to get date by passing week and year

    Hi,
       Is there any Function Module available to get date by passing week and year. For example, Week 24, Year 2005 and you get the date.
    Regards,
    Mira

    WEEK_GET_FIRST_DAY
    pass 'YYYYWW' (200524) to WEEK parameter it will give you the week start date
    Raja

  • Getting error , while passing parameters from one page to another page

    Hello friends,
    i am getting error, while passing parameters from one page to another page, below code i wrote.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    ArrayList arl=new ArrayList();
    EresFrameworkAMImpl am=(EresFrameworkAMImpl)pageContext.getApplicationModule(webBean);
    ERecordImpl ERecordObj=new ERecordImpl();
    HashMap hMap = new HashMap();
    hMap.put("1",ERecordObj.getTransactionName());
    hMap.put("2",ERecordObj.getTransactionKey());
    hMap.put("3",ERecordObj.getDeferredMode());
    hMap.put("4",ERecordObj.getUserKeyLabel());
    hMap.put("5",ERecordObj.getUserKeyValue());
    hMap.put("6",ERecordObj.getTransactionAuditId());
    hMap.put("7",ERecordObj.getRequester());
    hMap.put("8",ERecordObj.getSourceApplication());
    hMap.put("9",ERecordObj.getPostOpAPI());
    hMap.put("10",ERecordObj.getPayload());
    // hMap.put(EresConstants.ERES_PROCESS_ID,
    if(pageContext.getParameter("item1")!=null)
    pageContext.forwardImmediately(EresConstants.EINITIALS_FUNCTION,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    hMap,
    true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    Error(71,2): method forwardImmediately(java.lang.String, byte, null, java.util.HashMap, boolean, java.lang.String) not found in interface oracle.apps.fnd.framework.webui.OAPageContext
    Thanks
    krishna.

    Hi,
    You have imported the wrong class for HashMap.
    Import
    com.sun.java.util.collections.HashMap; instead of java.util.HashMap
    Thanks,
    Gaurav

  • After upgrading to 10.3.1 I get error -50 on startup and 1008 when I try to sign in to the store

    After upgrading to iTunes 10.3.1 I get error -50 on startup and 1008 when I try to sign in to the Store. How do I fix this?

    I got the solution from another post...
    use the Finder to navigate to /library/preferences/SystemConfiguration and delete NetworkInterfaces.plist ( you will be prompted for username and password), then reboot. You will get a message about new network interface found--just reset the network info.
    That did it for me.

  • After  i have upgraded to Lion OS, this computer has become the worst computer on this planet. Everything is so slow as if i am in 1990's, where you can click on something and take a coffee break. Constantly get errors on MS Outlook and all applications

    After  i have upgraded to Lion OS, this computer has become the **** computer on this planet. Everything is so slow as if i am in 1990 where you can click on something and take a coffee break. Constantly get errors on MS Outlook and all applications are taking for ever to open up. If you guys can't fix it i am going to throw this out the window. Completely fed up with this. Have always loved apple but this is the worst experience i have with the MacBook Air and its not even 1.5yr old.

    There are two ways to upgrade to Lion - one is to install Lion overtop of the existing Snow Leopard and the other is to erase the hard drive, install Lion, and then migrate your applications and user accounts. This second option takes a good deal longer than the first so the preferred method for most is the first method and in most cases it works fine. But not in all.
    captfred has told you what I'd start out doing if it were my computer. There's a good chance that you can identify an application or plug-in that's causing the problem. Upgrading the involved item(s) can solve the problem. Of all the Lion upgrades I performed I had a couple that weren't completely successful even though I'd looked for programs and plug-ins that needed upgrading first. I missed a few but I found them after the fact and had happy computers.
    There was one computer that still had problems. With this computer I reinstalled Lion right over the old version. (If you didn't keep a copy you'll need to download it first.) I still wasn't satisfied so with that computer I rebooted into the recovery partition (Command R after restarting) formatted the hard drive, installed Lion and then migrated. That did solve the problem.

  • Why does my mrs phone keep getting my contacts from iCloud and more importantly how do i stop it!?

    Hey guys an gals sorry if this has been asked 100's times before but...
    Why does my mrs phone keep getting my contacts from iCloud and more importantly how do i stop it!?
    Thanks for your help :-)

    Thanks for you reply, she already has her own account and wants to back her own contacts up to the cloud, we have tried turning both contacts off in icloud settings, also deleting from phone when prompted, then, we also deleted all her icloud backups to start a fresh. However soon as she turns contacts back on.. Bam they re appear. We also have ipad in the mix so we did the same to that, turned off and deleted contacts on there also to no avail. Somehow they are linked to my acount just cant work out how or where?

  • Getting error in cursor variable in CallableStatement

    Hi,
    I am trying to retrieve result set from PL/SQL procedure using cursor variable.
    but I getting error sometime.
    this is code in my program...
    CallableStatement pstmt=null;
    pstmt = con.prepareCall("{call Crms2.SearchRNameTime(?,?,?,?,?,?)}");
    pstmt.setString(1, uid);
    pstmt.setString(2, strBookingDate);
    pstmt.setInt(3, roomid);
    pstmt.setInt(4, lngStartTime);
    pstmt.setInt(5, lngEndTime);
    pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR ); // error accured in this line
    pstmt.execute();
    rs = (ResultSet)pstmt.getObject(6);
    error was accrued at line : pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR );
    error is: orable.jdbc.driver can not resolve tha symbol..
    but it some time executing , some time giving error.
    it is require any package to import?
    please help me on this problem.
    regards
    Narru

    990187 wrote:
    i have created a cursor to return only 5th row from a table .
    declare
    cursor cur is select * From(select last_name,salary,rownum rn from employees where rownum<=50)) where rn=5;
    just a side note, (others have helped with the actual error already), using "rownum" like you do isn't very consistent. Not really sure about the requirment of "5th row", but no matter. Just keep in mind that the way Oracle assigns a rownum, and the fact you have no sorting/order ... you are - effectively - getting a random row. That is, with no data changing, Oracle may very well retrieve things in a different order due to index, new oracle version, whatever.
    If you do actually need the 5th row where you have some sorting (ie 5th largest salary, or 5th record by last name, etc. ), then you may want to consider something like:
    select * from (select last_name, salary, row_number() over (order by salary desc) rn from employees) where rn = 5;
    or whatever your sort criteria is. Do a search for "Top N" queries if you need more info.
    It'll work a bit more consistently.

  • PI Control Error Between Process Variable and Set Point

    I've developed a PI program that uses measurements from a pressure transducer as the process variable to control air pressure released from a motorized valve. The program works great at lower pressures, but as the set point pressure increases the error between the process variable and set point increases. I've tried several things....adjusting the P seems to initially increase the overshoot but the process variable always settles down below the set point....tried adjusting the EGU min and max values but no real pattern develops with this. It appears as the process variable get closer to the max EGU value of 70000 pascals the error increases.
    I've attached three screen shots showing the process variable curve and setpoint value. The graph of interest is the one in the upper right hand corner.
    Any recommendation or advice would be appreciated.
    tks, Terry
    Attachments:
    Low Pressure.JPG ‏267 KB
    High Pressure.JPG ‏398 KB
    Mid Pressure.JPG ‏266 KB

    Kyle,
    First off....I appreciate your comments. No...there is no value is system represented as U16.
    Actually errors start to develop quite a bit before the maximum. If you look at the mid pressure.jpg file you'll notice that the set point (~28125 Pascals) and process variable (~25625 Pascals) are roughly off by about 2500 Pascals. Then if you look at the high pressure.jpg file you'll notice that the set point (~53000 Pascals) and process variable (~45500 Pascals) are roughly off by about 7500 Pascals. Therefore it appears as the setpoint pressure increases towards maximum the error tends to increase.
    I was curious about something....the set point value I'm inputting into the PID.VI , shown in the high pressure.jpg file, is from EGU to percent.VI. It would look exactly like the EGU to percent VI feeding the process variable input of the PID.VI with the set point value feeding the EGU to percent.VI input. Would I be better off feeding the actual set point value to the PID.VI input instead of percentage?
    Thanks, Terry

  • Pass variable and set default value based on user's group

    Hello
    I'm using SharePoint 2010 and SQL 2012. I need to send a variable to the page and based on its value, set default value for a drop down list and send it to other web part to filter the data. Is it possible for certain users to send that value as a default
    and limit user to see only this value in the text field or drop down list; for others - to allow to see the drop down list, but also set the default value for that list?
    The main page was designed in SharePoint designer, using web parts (aspx page). I had setup a connection to Active Directory and already have the code to get user's groups and based on their group, I have that variable pulled into the web page for further
    use. But I don't know how to pass that value as a default value to the web part (currently using SharePoint Filter web part). When I tried to set a default value for the web part - it automatically puts the quotation marks around the name of the variable
    and shows it as a text instead of showing the value of the field.
    Thank you!
    P.s. I have limited knowledge of SharePoint and need guidance (links, examples, recommendations)!
    Alla Sanders

    Thank you for your response. I'll try to give you more details. On PageA I check user's groups and based on the group, assign the value and pass it to the next page (no input from the user, all done behind the scene and user is redirected to PageB).
    On the next page I read that value and would like to send it to the SharePoint List Filter Web as a default value, as well as send it to another web part that displays the list from SQL, filtered using that default value. Ideally, if the user is from Group
    A, I'd like for them to have only one value in that drop down list; if user is from Group B - give him drop down list with 40 items to choose from. Below there is a part of the code and variable fnum has the value from PageA (if I print the value on the screen
    - I do see that it has correct value, so the code that gets groups from Active directory works correctly). If I assign fnum as a default value of the list, it shows "fnum" instead of the value of variable fnum. I connect to SQL database, using external
    content - so the other list that I'm filtering based on the value in that drop down list - is XSLT Data View Web part. I also have 2 more filters on that page, that user will have full access to and based on their input, it is also sent to the XSLT web part
    to filter out more data. Since one of the filters is the date and I am filtering data starting from the date that user chooses - XSLT is the only web part that I was able to make it work with.
    I looked at the link you provided (thank you). It is using Content Query Web part. Will it work with external content, as well as accepting multiple filtering, including custom starting date? I appreciate your help!
    <%
    string fnum = Request.QueryString["field1"];
    %><table cellpadding="4" cellspacing="0" border="0" style="height: 1000px">
    <tr>
    <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="2" valign="top" style="height: 101px">
    <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate>
    <WpNs0:SpListFilterWebPart runat="server" FilterMainControlWidthPixels="0" RequireSelection="False" ExportMode="All" PartImageLarge="/_layouts/images/wp_Filter.gif" AllowHide="False" ShowEmptyValue="True" MissingAssembly="Cannot import this Web Part." AllowClose="False" ID="g_1ccc4bca_3ba1_480b_b726_adfdb1e9e02d" IsIncludedFilter="" DetailLink="" AllowRemove="False" HelpMode="Modeless" AllowEdit="True" ValueFieldGuid="fa564e0f-0c70-4ab9-b863-0177e6ddd247" IsIncluded="True" Description="Filter the contents of web parts by using a list of values from a Office SharePoint Server list." FrameState="Normal" Dir="Default" AllowZoneChange="True" AllowMinimize="False" DefaultValue="fnum" Title="Facilities List Filter" PartOrder="2" ViewGuid="2da5d8db-6b55-4403-80a8-111e42049f8b" FrameType="None" CatalogIconImageUrl="/_layouts/images/wp_Filter.gif" FilterName="Facilities List Filter" HelpLink="" PartImageSmall="/_layouts/images/wp_Filter.gif" AllowConnect="True" DescriptionFieldGuid="2d97730a-cd0d-4cb9-8b55-424951201081" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" TitleIconImageUrl="/_layouts/images/wp_Filter.gif" ChromeType="None" SuppressWebPartChrome="False" IsVisible="True" ListUrl="/Lists/FacilitiesList" AllowMultipleSelections="False" ZoneID="Header" __MarkupType="vsattributemarkup" __WebPartId="{768E2035-0461-4A09-8DDD-CA7020C2B23D}" WebPart="true" Height="" Width="615px"></WpNs0:SpListFilterWebPart>
    Alla Sanders

  • Pass variables and return ResultSet from same preparedStatement

    I am passing "fp" and "week_no" to a preparedStament in a class and want to return the values to my jsp page. "fp" and "week_no" are used twice. Please see below. When I run it, I get no error messages but, it doesn't display any data.
    I have the following code in a class:
    public ResultSet getHistory(String fp, String week_no)
                        throws SQLException, Exception {
    ResultSet rs = null;
    if (con != null) {
    try {
         PreparedStatement getHist;
         getHist = con.prepareStatement(
         "SELECT sbu, TO_CHAR(((sum_dollar) + (adj_sum_dollar)),'$999,999,999.99') AS sum_dollar, TO_CHAR(actual_date,'MM/DD/YY') AS actual_date, " +
         "((sum_cases) + (adj_sum_cases)) AS sum_cases, " +
         "((new_order_cases) + (adj_new_order_cases)) AS new_order_cases, " +
         "((total_open_orders) + (adj_total_open_orders)) AS total_open_orders, " +
         "((back_orders) + (adj_back_orders)) AS back_orders, " +
         "TO_CHAR((sum_dollar/sum_cases), '999.99') AS yield " +
         "FROM SUMMARY " +
         "WHERE actual_date BETWEEN (SELECT begin_dt " +
                   "FROM fiscal_calendar " +
                             "WHERE fiscal_period = '?' " +
                             "AND week_number = '?' " +
                             "AND week_number <> '9' " +
                             "AND fiscal_yr = '2003') " +
                        "AND " +
                             "(SELECT end_dt " +
                        "FROM fiscal_calendar " +
                             "WHERE fiscal_period = '?' " +
                             "AND week_number = '?' " +
                             "AND week_number <> '9' " +
                             "AND fiscal_yr = '2003') " +
              "ORDER BY actual_date, sbu ");
         getHist.setString(1, fp);
         getHist.setString(2, week_no);
         getHist.setString(3, fp);
         getHist.setString(4, week_no);
         rs = getHist.executeQuery();
         } catch (SQLException sqle) {
    error = "SQLException: Update failed, possible duplicate entry.";
         throw new SQLException(error);
    } else {
    error = "Exception: Connection to the database was lost.";
         throw new Exception(error);
    return rs;
    This is in my jsp:
    <%
    String fp = request.getParameter("fp");
    String week_no = request.getParameter("week_no");
    historyInfo.connect();
    ResultSet rs = historyInfo.getHistory(fp, week_no);
    while (rs.next()) {
    //String sum_dollar = rs.getString("sum_dollar");
    %>
    <%= rs.getString("sum_dollar") %>
    <%
    %>

    Hi,
    First thing U can't do this way in java. If U are executing this sort of database query, after retriving all the values, put inside Haahtable or HashMap as the application required and return it.
    Otherwise execute this query at the same place where u r printing values in jsp page insted of writing it inside seperate method..It will work.
    If still it's not workimg, please let me know.
    Rajeh Pal

Maybe you are looking for

  • Want shipping Point address(not Number) in the invoice layout

    Dear Experts Please tell me tables and fields  how get the shipping point address in invoice layout, if i give likp-vstel, it picks the shipping point number only, issue resolution is very urgent Thanks and regards Janardhan

  • Live Cycle Acrobat 9 etc... Flex day 3

    Day 3... and I am frustrated to discover that I may not be able to continue with this training because apparantly Live Cycle Data Services ( and Acrobat 9) which the Live cycle site advises downloading first - are only available for Windows, not Mac.

  • Role and privilege used by JDBC

    Is there any reqiured role and privilege used by JDBC? I use Oracle JDBC9203 for Oracle to connect Oracle8163, when executing certion codes, the JDBC raise a exception as below:      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

  • Is there a backup for contacts on Icloud?

    I did a misstake when I installed my sons iPhone. I deleted contacts that came whit iCloud on my sons iPhone and now they are gone from my iPhone aswell. I need them back! Is there a backup in iCloud?

  • How to connect teradata DB

    Hi, I am working in oracle 9i. I need to connect TERADATA DB using Oracle. Please provide me the solution how to connect to the DB. Rgds,,,