No values returned by refcursor ....

Hi
1) I have created one procedure which returns refcursor
2) at sql prompt i have created variable of type refcursor
3) then I execute procedure by passing this variable
4) then i tried printing
i.e
SQL> print :jc11
ERROR:
ORA-24338: statement handle not executed
SP2-0625: Error printing variable "jc11"
my query is:-
Is the above error becoz of no records returned by cursor ????
( I have checked the select statement which is used in procedure which is not returning any records.)
Thanks and Regards
JC

example:
SQL> ed
Wrote file afiedt.buf
  1  create or replace function myrefc return sys_refcursor is
  2    v_rc sys_refcursor;
  3  begin
  4    OPEN v_rc FOR 'SELECT 1 as tom, 2 as fred from dual';
  5    RETURN v_rc;
  6* end;
SQL> /
Function created.
SQL> var x refcursor;
SQL> exec :x := myrefc;
PL/SQL procedure successfully completed.
SQL> print x
       TOM       FRED
         1          2
SQL>

Similar Messages

  • Issue with IN parameter of Oracle Procedure returning two RefCursors...

    Hi all,
    I'm having a nightmare with an Oracle procedure that takes one input parameter and returns two RefCursors as outputs. I recently got help in this forum getting a procedure to work that took no inputs but returned two refcursors and that's still working fine. So, for my current issue I have a procedure defined as follows:
    PROCEDURE getQueueInfo(domainKey char, importQueues OUT ODPNet.refcur, exportQueues OUT ODPNet.refcur) IS
      BEGIN
        OPEN importQueues FOR SELECT
        source_key, source_applid,
        import_status(source_key) as status,
        time_added, time_processed
        FROM wm_import_source_header
        WHERE source_id = domainKey
        ORDER BY source_key DESC;
        OPEN exportQueues FOR SELECT
        h.source_key, d.source_applid,
        export_status(h.source_key) as status,
        d.source_wire_code, d.destination_wire_code, h.time_added,
        h.time_transmitted
        FROM wm_export_source_header h, wm_export_source_data d
        WHERE h.source_key = d.source_key
          and d.source_id = domainKey
        ORDER BY h.source_key DESC;
      END getQueueInfo;This is defined within a package called ODPNet as with my previous procedure and all works fine (I can execute within Oracle SQL Developer and it returns the expected results). Within my .NET application my code is as follows:
                try
                    using (OracleConnection conn = new OracleConnection(connString))
                    using (OracleCommand comm = new OracleCommand())
                        comm.CommandText = "ODPNet.getQueueInfo";
                        comm.CommandType = CommandType.StoredProcedure;
                        comm.Connection = conn;
                        OracleParameter domainKey = new OracleParameter();
                        OracleParameter importQueues = new OracleParameter();
                        OracleParameter exportQueues = new OracleParameter();
                        domainKey.OracleDbType = OracleDbType.Char;
                        importQueues.OracleDbType = OracleDbType.RefCursor;
                        exportQueues.OracleDbType = OracleDbType.RefCursor;
                        domainKey.Value = "UKBD72";
                        domainKey.Direction = ParameterDirection.Input;
                        importQueues.Direction = ParameterDirection.Output;
                        exportQueues.Direction = ParameterDirection.Output;
                        comm.Parameters.Add(domainKey);
                        comm.Parameters.Add(importQueues);
                        comm.Parameters.Add(exportQueues);
                        conn.Open();
                        comm.ExecuteNonQuery();
                        OracleDataReader dr1 = ((OracleRefCursor)importQueues.Value).GetDataReader();
                        OracleDataReader dr2 = ((OracleRefCursor)exportQueues.Value).GetDataReader();
                        if (dr1.HasRows)
                            while (dr1.Read())
                                result6 += dr1["source_applid"].ToString() + "<br>";
                        else
                            result6 += "No Rows";
                        if (dr2.HasRows)
                            while (dr2.Read())
                                result7 += dr2["source_applid"].ToString() + "<br>";
                        else
                            result7 += "No Rows";
                catch (Exception ex)
                    result6 = ex.ToString();
                }The value I want to submit as the IN parameter of the procedure is "UKBD72". but I'm really not sure how to apply this and then return my two refcursors into separate datareaders (except for the input parameter stuff the code above is exactly what I did with the other procedure that returned two ref cursors and still works fine). When I run this code I get no errors, I just get told that each DataReader has no rows returned, which shouldn't be right.
    Any help with this would be hugely appreciated.
    Cheers,
    Seb

    Sorry folks, after staring at this over and over, eventually going to sleep and coming back to it with some fresh eyes I realised I was just being a complete idiot - I was feeding the procedure different data in the .NET app than I was when testing in Oracle SQL Developer. Low and behold once I gave it the right data it worked!
    Silly me...

  • Call a Stored Procedure that returns a REFCURSOR using ODI Procedure

    Hi,
    I have a scenario wherein the stored procedure (TEST_PROC1) that returns a REFCURSOR. The second procedure(TEST_PROC2) will use the REFCURSOR as inpuut and insert it to a table.
    Now, I need to execute the test procedures (TEST_PROC1 and TEST_PROC2) using the ODI Procedure but I always get error. However, I was able to execute the test procedures using sqlplus. Here is the command I used for sqlplus:
                   var rc refcursor
                   exec TEST_PROC1(:rc);
                   exec TEST_PROC2(:rc);
    PL/SQL Stored Procedure:
    -- TEST_PROC1 --
    create or replace
    PROCEDURE TEST_PROC1 (p_cursor IN OUT SYS_REFCURSOR)
    AS
    BEGIN
    OPEN p_cursor FOR
    SELECT *
    FROM test_table1;
    END;
    -- TEST_PROC2 --
    create or replace
    procedure TEST_PROC2( rc in out sys_refcursor ) is
    FETCH_LIMIT constant integer := 100;
    type TFetchBuffer is table of test_table2%RowType;
    buffer TFetchBuffer;
    begin
    loop
    fetch rc bulk collect into buffer limit FETCH_LIMIT;
    forall i in 1..buffer.Count
    insert into test_table2(
    c1, c2
    ) values(
    buffer(i).c1, buffer(i).c2
    exit when rc%NotFound;
    end loop;
    end;
    Is there a way to call a PL/SQL Stored Procedure that returns a REFCURSOR using ODI Procedure?
    Thanks,
    Cathy

    Thanks for the reply actdi.
    The procedure TEST_PROC1 is just a sample procedure. The requirement is that I need to call a stored procedure that returns a cursor using ODI and fetch the data and insert into a table, which in this case is test_table2.
    I was able to execute a simple SQL procedure (without cursor) using ODI procedure. But when i try to execute the SQL procedure with cursor in ODI, I encountered error.
    Do you have any idea how to do this?

  • Void Methods and Value Returning Methods in Java

    Hello,
    I'm new here so please let me know if I overstep any of the rules or expectations. I merely want to learn more about Java Programming efficiently, and easily. I can ask and discuss these topics with my online prof, but she doesn't have much time.
    So right now I'm trying to solve a problem. It's a typical college level computing problem which I've already turned in. So I'm not looking for someone to do my homework for me or something. It's just that the program didn't work. Even though I probably won't get a very good grade for it, I want to
    make it work! I'm kind of slow when it comes to java so just bear with me.
    The prof wanted us to write an algorithm that reads a student's name and 6 exam scores. Then it computes the average score for each student, assigns a letter grade, using a rating scale:
    90 and above = A
    80 - 89 = B
    70 ? 79 = C
    60 - 69 = D
    Less then 60 ? F
    We had to use a void method to determine the average score for each student, a loop inside the method to read the and sum the 6 scores but without outputting the average score. The sum and average had to be returned in and output in void main.
    Then we had to use a value-returning method CalculateGrade to determine and return the grade for each student. But it can't output the grade because that must be done in void main.
    Finally the class average must be output.
    Our prof gave us a list of student names with their 6 scores.
    Ward 100 54 98 65 35 100
    Burris 89 65 87 84 15 32
    Harris 54 21 55 87 70 54
    Bettis 43 55 68 54 15 25
    Staley 87 54 98 45 54 56
    Randle 54 87 54 98 65 15
    Maddox 56 14 40 50 40 50
    Roth 30 40 54 78 24 19
    Holmes 14 87 98 34 55 57
    So all the data had to be read from a file and the results output to a file. Also we couldn't use 'global variables'. We had to use the appropriate parameters to pass values to and from methods.
    Question 1:  What does she mean by 'no global variables'? Maybe she means: don't use "*double test1, test2, test3, test4, test5*;"
    Anyway because I'm a slow learner with Java, I end up looking for sample programs that seem to do a similar job as the problem posed. So with this program I decided to adapt a program called Comparison of Class Averages.
    //Program: Comparison of Class Averages.
    import java.io.*;
    import java.util.*;
    import java.text.DecimalFormat;
    public class DataComparison
    public static void main (String[] args) throws
    FileNotFoundException, IOException
    //Step 1
    String courseId1; //course ID for group 1
    String courseId2; //course ID for group 2
    int numberOfCourses;
    DoubleClass avg1 = new DoubleClass(); //average for a course
    //in group 1
    DoubleClass avg2 = new DoubleClass(); //average for a course
    //in group 2
    double avgGroup1; //average group 1
    double avgGroup2; //average group 2
    String inputGroup1;
    String inputGroup2;
    StringTokenizer tokenizer1 = null;
    StringTokenizer tokenizer2 = null;
    //Step 2 Open input and output files
    BufferedReader group1 =
    new BufferedReader(new FileReader("a:\\group1.txt"));
    BufferedReader group2 =
    new BufferedReader(new FileReader("a:\\group2.txt"));
    PrintWriter outfile =
    new PrintWriter(new FileWriter("a:\\student.out"));
    DecimalFormat twoDecimal =
    new DecimalFormat("0.00"); //Step 3
    avgGroup1 = 0.0; //Step 4
    avgGroup2 = 0.0; //Step 5
    numberOfCourses = 0; //Step 6
    //print heading: Step 7
    outfile.println("Course No Group No Course Average");
    inputGroup1 = group1.readLine(); //Step 8
    inputGroup2 = group2.readLine(); //Step 9
    while((inputGroup1 != null) &&
    (inputGroup2 != null)) //Step 10
    tokenizer1 = new StringTokenizer(inputGroup1);
    courseId1 = tokenizer1.nextToken(); //Step 10a
    tokenizer2 = new StringTokenizer(inputGroup2);
    courseId2 = tokenizer2.nextToken(); //Step 10b
    if(!courseId1.equals(courseId2)) //Step 10c
    System.out.println("Data error: Course IDs "
    + "do not match.");
    System.out.println("Program terminates.");
    outfile.println("Data error: Course IDs "
    + "do not match.");
    outfile.println("Program terminates.");
    outfile.close();
    return;
    else //Step 10d
    calculateAverage(group1, tokenizer1, avg1); //Step 10d.i
    calculateAverage(group2, tokenizer2, avg2); //Step 10d.ii
    printResult(outfile,courseId1,1,avg1); //Step 10d.iii
    printResult(outfile,courseId2,2,avg2); //Step 10d.iv
    avgGroup1 = avgGroup1 + avg1.getNum(); //Step 10d.v
    avgGroup2 = avgGroup2 + avg2.getNum(); //Step 10d.vi
    outfile.println();
    numberOfCourses++; //Step 10d.vii
    inputGroup1 = group1.readLine(); //Step 10e
    inputGroup2 = group2.readLine(); //Step 10f
    }//end while
    if((inputGroup1 != null) && (inputGroup2 == null)) //Step 11a
    System.out.println("Ran out of data for group 2 "
    + "before group 1.");
    else //Step 11b
    if((inputGroup1 == null) && (inputGroup1 != null))
    System.out.println("Ran out of data for "
    + "group 1 before group 2.");
    else //Step 11c
    outfile.println("Avg for group 1: " +
    twoDecimal.format(avgGroup1 / numberOfCourses));
    outfile.println("Avg for group 2: " +
    twoDecimal.format(avgGroup2 / numberOfCourses));
    outfile.close(); //Step 12
    public static void calculateAverage(BufferedReader inp,
    StringTokenizer tok,
    DoubleClass courseAvg)
    throws IOException
    double totalScore = 0.0;
    int numberOfStudents = 0;
    int score = 0;
    if(!tok.hasMoreTokens())
    tok = new StringTokenizer(inp.readLine());
    score = Integer.parseInt(tok.nextToken());
    while(score != -999)
    totalScore = totalScore + score;
    numberOfStudents++;
    if(!tok.hasMoreTokens())
    tok = new StringTokenizer(inp.readLine());
    score = Integer.parseInt(tok.nextToken());
    }//end while
    courseAvg.setNum(totalScore / numberOfStudents);
    }//end calculate Average
    public static void printResult(PrintWriter outp,
    String courseId,
    int groupNo, DoubleClass avg)
    DecimalFormat twoDecimal =
    new DecimalFormat("0.00");
    if(groupNo == 1)
    outp.print(" " + courseId + " ");
    else
    outp.print(" ");
    outp.println("\t" + groupNo + "\t "
    + twoDecimal.format(avg.getNum()));
    So my adaptation turned out like this:
    //Program: Compute individual and class averages from input file.
    import java.io.*;
    import java.util.*;
    public class Exams
    public static void main (String[] args)
    throws FileNotFoundException
    //Step 1
    String nameId; //student name ID for list
    int numberOfStudents;
    DoubleClass avg = new DoubleClass(); //average for a student
    //in list
    double avgList; //average for list
    //Step 2 Open the input and output files
    Scanner group1 = new Scanner(new FileReader("c:\\list.txt"));
    PrintWriter outfile = new PrintWriter("c:\\student.out");
    avgList = 0.0; //Step 3
    numberOfStudents = 0; //Step 5
    //print heading: Step 6
    outfile.println("NameID List Student Average");
    calculateAverage(list, avg); //Step 7d.i
    printResult(outfile,nameID, avg); //Step 7d.iii
    avgList = avgList + avgList.getNum(); //Step 7d.v
    outfile.println();
    numberOfStudents++; //Step 7d.vii
    outfile.printf("Avg for List: %.2f %n",
    (avgList / numberOfStudents));
    public static void calculateAverage(Scanner inp,
    DoubleClass courseAvg)
    double totalScore = 0.0;
    int numberOfStudents = 0;
    int score = 0;
    score = inp.nextInt();
    courseAvg.setNum(totalScore / numberOfStudents);
    }//end calculate Average
    public static void printResult(PrintWriter outp,
    String nameId,
    int groupNo, DoubleClass avg)
    if (list == list)
    outp.print(" " + nameId + " ");
    else
    outp.print(" ");
    outp.printf("%9d %15.2f%n", list, avg.getNum());
    I guess I was trying to find a shortcut that ended up being a long cut. Here's the algorithm I wrote.
    Algorithm
    1.) Initialize the variables
    2.) Get the student name and his/her accompanying 6 exam scores, limiting the number of scores to 6.
    3a.) Calculate score of 6 exams for each student using void method called CalculateAverage.
    3b.) Use a loop inside the method to read and sum the six scores.
    4.) Use value-returning method CalculateGrade to determine and return each student's grade.
    5.) Output each student's grade in void main.
    6.) Calculate the average score for all students
    7.) Output entire class average
    And now I'm trying to piece together code to match each step of the algorithm starting from scratch.
    So I got the code for outputting each students grade in void:
    public static void printGrade(double testScore)
    System.out.print("Line 10: Your grade for "
    + "the course is ");
    if (testScore >= 90)
    System.out.println("A");
    else if (testScore >= 80)
    System.out.println("B");
    else if (testScore >= 70)
    System.out.println("C");
    else if (testScore >= 60)
    System.out.println("D");
    else
    System.out.println("F");
    This code can read the the file with the scores:
    Scanner inFile =
    new Scanner(new FileReader("a:\\studentlist.txt"));
    PrintWriter outFile =
    new PrintWriter("a:\\avg.out");
    courseGrade = inFile.nextDouble();
    studentName=inFile.nextChar();
    while (inFile.hasNext())
    studentName= inFile.next().charAt(0);
    courseGrade= inFile.nextDouble();
    I'm just trying to piece this thing together. Any tips would be appreciated. I will return with more pieces to the puzzle soon. As you can tell it's all kind of disorganized, and scatterbrained. Just trying to find some simplification or distillation, or recommendations.
    WR

    Hello,
    Thanks for your reply. So I take it you are more familiar with Object Oriented Programming more than Procedural Based Programming?
    Well the teacher insisted I follow the algorithm instead of trying to adapt another program to the problem. But sometimes that approach saves time I've noticed since many of the code examples we study in Java are like 'the golden oldies'.
    The student gradebook problem is repeated over and over in different forms. Maybe if I just approached the problem more linearly:
    Algorithm
    1.) Initialize the variables
    String studentId
    int numberOfStudents
    DoubleClass avg = new DoubleClass(); //average for a student
    double avgGroup: //average for all students2.) Get the student name and his/her accompanying 6 exam scores.
    Scanner group = new Scanner(new FileReader("c:\\list.txt"));
    PrintWriter outfile = new PrintWriter("c:\\student.out"));
    3a.) Calculate score of 6 exams for each student using void method called CalculateAverage using a loop to read and sum the six scores. The loop must be inside the method. It does not output the average score. The sum and average must be returned and output in void main.
    method calculateAverage
    double totalScore //to store the sum of all the scores of each student
    int numberOfExams;  //to store the number of
    int score; //to read and store a course score
    double totalScore = 0.0
    int numberOfExams = 0;
    int score = 0;3b.) Use a loop inside the method to read and sum the six scores.
    Using psuedocode (since the variables have been declared and initialized)
    i)get the next student score
    RIght here my approach of adapting another program to my new program becomes problematic
    the pseudocode here is:
    ii) while (score != -999):
    I.) update totalScore by adding course score read in step i.
    II.) increment numberOfExams by 1
    III.) Get the nex student score
    iii) studentAvg.setNum(totalScore / numberOfExams);
    *What is the purpose of the statement while (score != -999)?*
    I don't see why they picked -999?  Will this loop allow me to read an endless number of student names and theri accompanying number of exams and then find the average for each student?
    I'll go into the next algorithmic steps later.
    4.) Use value-returning method CalculateGrade to determine and return each student's grade.
    5.) Output each student's grade in void main.
    6.) Calculate the average score for all students
    7.) Output entire class average
    Thanks ahead of time for any suggestions, tips.

  • Need Help ::  Current row attribute value returning null

      Hi Frds,
    I am facing the problem that
    Current row attribute value returning null............ even though value is there..... plz.. he
    This is the code in PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
        String  pPersonId = pageContext.getParameter("ctrlPersonId");
         String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
         OptionsVORowImpl curRow = (     OptionsVORowImpl) am.findRowByRef(rowReference);
        String dtlsItem =  (String)curRow.getFlexValue();   /*  this is returning null value */
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks & Regards,
    jaya
    Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810

    Hi Jaya,
    You want to catch Flexfield values?
    Try below code for catch value.
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
    OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
    OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
    OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
    String dtlsItem  = (String)Stylebean.getText(pageContext);
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks,
    Dilip

  • How to get the values returned by a function in a drop down?

    Hi All,
    Can anyone please help in getting the values returned by a function into a drop down? I have a java class file where in i have written a function called getWeeks() which give all the week dates and i want to display these week dates in a drop down box in a JSP page.
    Please help me in this regard.
    Thanks in Advance!!
    Lakshman.

    Hi Lakshman,
    the following code can help you do what you want :
    <hbj:dropdownListBox id="calendar" tooltip="Calendar" selection="<%= selected %>">
    <%
    String[] weeks = myObjectBean.getWeeks();
    for (int i = 0; i < weeks.length; i++) {
    %>
         <hbj:listBoxItem key="<%= i %>" value="<%= weeks<i> %>"/>
    <%
    %>
    </hbj: dropdownListBox>
    The <%= selected %> snippet allows you to pre-select one of the options (provided that the variable 'selected' is equal to one of the listBoxItem keys).
    You can also add onSelect to the tag (e.g. = "setSelectedItem"). It corresponds to a method in the corresponding JSPDynPage class. This means that when you select another item in the dropdown list, the method in your Java class is performed (allowing you to save the selected value and performing actions with it)
    I hope this helped you enough,
    kind regards,
    Frederic
    Edited seven times by: Frederic Taes on Nov 5, 2008 11:24 AM -> the onSelect element was in the hbj tag and in the text with "='setSelectedItem'" next to it and when I tried to post my message, I got a 501 error all the time ! Seems like a SDN bug to me ...

  • Null values returned when using request.getParameters(

    I have a html form which allows the user to choose options and select a file to upload. When I use method=Post I get null values returned. When I use method=Get I get my parameter values fine.. but I get an error.
    "Posted content type isn't multipart/form-data"
    I would like to know why I am getting null values returned when using Post. I am using the following to get the values from the name=value passed to the servlet.
    String strIndustry = request.getParameter("frmIndustry");
              String strCompany = request.getParameter("frmCompany");
              String strCollabType = request.getParameter("frmCollaboration");
    I have another form where the user can search information in a database that works just fine w/ either Get or Post
    Or perhaps I am using oreilly MultipartRequest incorrectly??? but I copied it directly from another discussion.. ???
    any thoughts
    Thanks

    taybon:
    you could do it like this. in this case, you submit your form with the parameters (industry, company, collaboration), and upload your file at the same time. and in the target servlet, you can build your MultipartRequest object like this:
    MultipartRequest multi = new MultipartRequest(request, temp_location, 50 * 1024);where variable temp_location stands for a temporatory diretory for file uploading.
    and then you get your parameters, so you can build the directory with them. and after that, you can move your file to that directory using File.renameTo();
    but as i've suggested in my previous posting, i just recommend you upload your file in a separate form. and then you can perform an oridianry doPost form submit with those parameters. or you may have problems with the file uploading. (this is just my personal experiences with Multipart).
    there is one other thing i'd like to mention, file.renameTo() won't work if you need to move files to a network drive in windows. it won't work if you move files across file systems in unix.
    Song xiaofei
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD

    Reading User Profile Properties pragmatically in SharePoint 2010 Returns Null Values Although it has values returned from AD
    I configured the user profile service application and run Sync and user profiles and its properties returned from Active directory but when I want to read it pragmatically it returns null values.
    this is my code...
       void runQueryButton_Click(object sender, EventArgs e)
               // Get the My Sites site collection, ensuring proper disposal
                using (SPSite mySitesCollection = new SPSite("http://sp/my"))
                    //Get the user profile manager
                    SPServiceContext context = SPServiceContext.GetContext(mySitesCollection);
                    UserProfileManager profileManager = new UserProfileManager(context);
                    UserProfile profile = profileManager.GetUserProfile("Contoso\\user");
                    foreach (Property prop in profileManager.Properties)
                       // if (prop.Name == "Department")
                        resultsLabel.Text += prop.DisplayName + ":" + profile[prop.Name].Value + "<br />"; ;

     Hi,
    Please try with the following code
          PrincipalContext principalContext = new PrincipalContext(ContextType.Domain);
                                SPServiceContext context = SPServiceContext.GetContext(site);
                                UserProfileManager profileManager = new UserProfileManager(context);                        
      foreach (Property prop in profileManager.Properties)
                       // if (prop.Name == "Department")
                        resultsLabel.Text += prop.DisplayName
    + ":" + profile[prop.Name].Value + "<br />"; ;
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • How do I print out the value returned by a method in main??

    I'm a total newbie at java, I want to know how I can print out the value returned by this function in the "Main" part of my class:
    public int getTotalPrice(int price)
    int totalprice=price+(price*0.08);
    return totalprice;
    I just want to know how to print out the value for total price under "public static void main(String[] args)". thanks in advance,
    Brad

    Few ways you could do it, one way would be to create an instance of the class and call the method:
    public class Test
        public double getTotalPrice(int price)
            double totalprice = price + (price * 0.08);
            return totalprice;
        public static void main(String[] args)
            Test t = new Test();
            System.out.println(t.getTotalPrice(52));
    }Or another would be to make getTotalPrice() static and you could call it directly from main.

  • Assigning value returned from RFC call to a global variable

    If I have an RFC call to SAP how can I assign the value returned to a global variable on my data services job?

    Hi,
    For now, it seems u haven't specified the destination properly. the call function statement must be suffixed with the 'destination' addition to make sure that the function call is an RFC and the particular function be executed at the desired destination.

  • The value returned from the load function is not of type numeric  errors after migration to Coldfusion 11

    I am currently testing our website with CF11. It is currently working with CF8 however after migrating it to a new server running CF11 I have encountered the following error.
    The value returned from the load function is not of type numeric.
    The error occurred in
    D:/Applications/CFusion/CustomTags/nec/com/objects/address.cfc: line 263
    Called from D:/Applications/CFusion/CustomTags/nec/com/objects/contact.cfc: line 331
    Called from D:/Applications/CFusion/CustomTags/nec/com/objects/user.cfc: line 510
    Called from D:/Applications/CFusion/CustomTags/nec/com/objects/user.cfc: line 1675
    Called from D:/website/NECPhase2/action.validate.cfm: line 54
    261 : <cfif isNumeric(get.idCountry)>
    262 : <cfset rc = this.objCountry.setID(get.idCountry)>
    263 : <cfset rc = this.objCountry.load()>
    264 : </cfif>
    265 : <cfset this.sPostcode = get.sPostcode>
    Have there been any changes between CF8 and CF11 that could  cause this error?
    Does anyone have ideas?

    This is the code in file object file country.cfc (nec.com.objects.country):
    <cfcomponent displayname="Country object" hint="This is a Country object, it allows you to access and set values in the Country.">
    <!---
    // Construct this object
    --->
    <cfset this.objFunctions = CreateObject( 'component', 'nec.com.system.functions' )>
    <cfscript>
      this.idCountryID = 0;
      this.sCountryName = "";
      this.sISOCode = "";
      this.sDHLCode = "";
      this.iErrorID = "";
    </cfscript>
    <!---
    // The following functions are the setters and getters. offering us a better way to get
    // at the contents of the object
    --->
    <!---
    // Getters
    --->
    <cffunction name="getID" displayname="Get ID" returntype="numeric" output="false" hint="This returns the ID of the current item.">
      <cfreturn this.idCountryID>
    </cffunction>
    <cffunction name="getsCountryName" displayname="Get sCountryName" returntype="string" output="false" hint="This gets the sCountryName value of this item.">
      <cfreturn this.sCountryName>
    </cffunction>
    <cffunction name="getsISOCode" displayname="Get sISOCode" returntype="string" output="false" hint="This gets the sISOCode value of this item.">
      <cfreturn this.sISOCode>
    </cffunction>
    <cffunction name="getsDHLCode" displayname="Get sDHLCode" returntype="string" output="false" hint="This gets the sDHLCode value of this item.">
      <cfreturn this.sDHLCode>
    </cffunction>
    <cffunction name="iError" displayname="Get iError" returntype="numeric" output="false" hint="This returns the iError of the current item.">
      <cfreturn this.iError>
    </cffunction>
    <!---
    // Setters
    --->
    <cffunction name="setID" displayname="Set ID" returntype="boolean" output="false" hint="This sets the ID value of this item.">
      <cfargument name="idCountryID" required="true" type="numeric" displayname="ID" hint="The ID to use.">
      <cfset this.idCountryID = arguments.idCountryID>
      <cfreturn true>
    </cffunction>
    <cffunction name="setsCountryName" displayname="Set sCountryName" returntype="boolean" output="false" hint="This sets the sCountryName value of this item.">
      <cfargument name="sCountryName" required="true" type="string" displayname="sCountryName" hint="The sCountryName to use.">
      <cfset this.sCountryName = arguments.sCountryName>
      <cfreturn true>
    </cffunction>
    <cffunction name="setsISOCode" displayname="Set sISOCode" returntype="boolean" output="false" hint="This sets the sISOCode value of this item.">
      <cfargument name="sISOCode" required="true" type="string" displayname="sISOCode" hint="The sISOCode to use.">
      <cfset this.sISOCode = arguments.sISOCode>
      <cfreturn true>
    </cffunction>
    <cffunction name="setsDHLCode" displayname="Set sDHLCode" returntype="boolean" output="false" hint="This sets the sDHLCode value of this item.">
      <cfargument name="sDHLCode" required="true" type="string" displayname="sDHLCode" hint="The sDHLCode to use.">
      <cfset this.sDHLCode = arguments.sDHLCode>
      <cfreturn true>
    </cffunction>
    <!---
    // Clear, to empty out the contents of this object
    --->
    <cffunction name="clear" displayname="Clear items Details" returntype="boolean" output="false" hint="Clears out all of the items details.">
      <cfscript>
       this.sCountryName = "";
       this.sISOCode = "";
       this.sDHLCode = "";
       this.iErrorID = "";
      </cfscript>
      <cfreturn true>
    </cffunction>
    <!---
    // The following functions deal with the load, save and deleting of objects
    --->
    <!---
    // Load
    --->
    <cffunction name="load" displayname="Load items details" returntype="numeric" output="false" hint="This loads in all the information about an item.">
      <cfset rc = this.clear()>
      <!---
      // First of all we need to get the name of the data source we are going to be using
      --->
      <cfscript>
      objDS = CreateObject("component","nec.com.system.settings");
      sDatasource = objDS.getDatasource();
    </cfscript>
      <!---
      // Check to see if it exists
      --->
      <cftry>
       <cfquery name="checkID" datasource="#sDatasource#">
        SELECT idCountryID
        FROM tblCountry
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("load: checkID: '#this.idCountryID#' #cfcatch.detail#");
        </cfscript>
        <cfset this.iErrorID = iErrorID>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfif not checkID.recordCount>
       <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         if(isDefined("session.afr")){
          whichOne = "#session.afr.getsAFRNumber()#";
         } else {
          whichOne = "";
         iErrorID = objError.addError("A Country with that id doesn't exists.[#this.idCountryID#][#whichOne#]");
        </cfscript>
       <cfset this.iErrorID = iErrorID>
       <cfreturn iErrorID>
      </cfif>
      <!---
      // If we got past all then then load in the details
      --->
      <cftry>
       <cfquery name="get" datasource="#sDatasource#">
        SELECT idCountryID, RTRIM(sCountryName) as sCountryName, RTRIM(sISOCode) as sISOCode, RTRIM(sDHLCode) as sDHLCode
        FROM tblCountry
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("load: get: #cfcatch.detail#");
        </cfscript>
        <cfset this.iErrorID = iErrorID>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfset this.idCountryID = get.idCountryID>
      <cfset this.sCountryName = get.sCountryName>
      <cfset this.sISOCode = get.sISOCode>
      <cfset this.sDHLCode = get.sDHLCode>
      <cfset this.iErrorID = "">
      <cfreturn true>
    </cffunction>
    <!---
    // Save
    --->
    <cffunction name="save" displayname="Save items Details" returntype="numeric" output="false" hint="Saves (to some source) the current details for the ID of the item.">
      <!---
      // First of all we need to get the name of the data source we are going to be using
      --->
      <cfscript>
      objDS = CreateObject("component","nec.com.system.settings");
      sDatasource = objDS.getDatasource();
    </cfscript>
      <!---
      // Now check to see if ithat ID exists
      --->
      <cftry>
       <cfquery name="checkID" datasource="#sDatasource#">
        SELECT idCountryID
        FROM tblCountry
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("save: checkID: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <!---
      // If it doesn't exist, then add the record, otherwise update the record
      --->
      <cfif not checkID.recordCount>
       <cfreturn this.add()>
      <cfelse>
       <cfreturn this.update()>
      </cfif>
    </cffunction>
    <!---
    // Add
    --->
    <cffunction name="add" displayname="Add Country" returntype="numeric" output="false" hint="This adds a Country.">
      <!---
      // Check to see if that a different item isn't already using the same unique details
      --->
      <cftry>
       <cfquery name="checkUnique" datasource="#sDatasource#">
        SELECT idCountryID
        FROM tblCountry
        WHERE sCountryName = '#this.objFunctions.scrubText(this.sCountryName)#'
        OR sISOCOde = '#this.objFunctions.scrubText(this.sISOcode)#'
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("add: checkUnique: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfif checkUnique.recordCount>
       <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("A Country with that name or ISO code already exists. idCountryID=#checkUnique.idCountryID#");
        </cfscript>
       <cfreturn iErrorID>
      </cfif>
      <cftry>
       <cfquery name="add" datasource="#sDatasource#">
        SET nocount on
        INSERT INTO tblCountry(sCountryName, sISOCode, sDHLCode)
        VALUES('#this.objFunctions.scrubText(this.sCountryName)#','#this.objFunctions.scrubText(t his.sISOCode)#','#this.objFunctions.scrubText(this.sDHLCode)#')
        SELECT @@identity as autoID
        SET nocount off  
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("add: add: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfreturn add.autoID>
    </cffunction>
    <!---
    // Update
    --->
    <cffunction name="update" displayname="Update Country" returntype="numeric" output="false" hint="This updates a Country record.">
      <!---
      // Check to see if that a different item isn't already using the same unique details
      --->
      <cftry>
       <cfquery name="checkUnique" datasource="#sDatasource#">
        SELECT idCountryID
        FROM tblCountry
        WHERE (sCountryName = '#this.objFunctions.scrubText(this.sCountryName)#'
        OR sISOCOde = '#this.objFunctions.scrubText(this.sISOcode)#')
        AND idCountryID <> #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("update: checkUnique: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfif checkUnique.recordCount>
       <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("Another Country with that name already exists. idCountryID=#checkUnique.idCountryID#");
        </cfscript>
       <cfreturn iErrorID>
      </cfif>
      <!---
      // Attempt to update the record to the datasource
      // if this fails for any reason then we submit an error message
      // to the error component and return the ID of the error
      --->
      <cftry>
       <cfquery name="update" datasource="#sDatasource#">
        UPDATE tblCountry
        SET sCountryName = '#this.objFunctions.scrubText(this.sCountryName)#',
        sISOCode = '#this.objFunctions.scrubText(this.sISOCode)#',
        sDHLCode = '#this.objFunctions.scrubText(this.sDHLCode)#'
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("update: update: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfreturn this.idCountryID> 
    </cffunction>
    <!---
    // Delete
    --->
    <cffunction name="delete" displayname="Delete Country" returntype="numeric" output="false" hint="This deletes a Country record.">
      <!---
      // First of all we need to get the name of the data source we are going to be using
      --->
      <cfscript>
      objDS = CreateObject("component","nec.com.system.settings");
      sDatasource = objDS.getDatasource();
    </cfscript>
      <!---
      // Now check to see if ithat ID exists
      --->
      <cftry>
       <cfquery name="checkID" datasource="#sDatasource#">
        SELECT idCountryID
        FROM tblCountry
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("delete: checkID: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfif not checkID.recordCount>
       <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("A Country with that id doesn't exists, delete failed.");
        </cfscript>
       <cfreturn iErrorID>
      </cfif>
      <!---
      // Now check to see if there are any dependancies, if so we can't delete the item
      --->
      <cftry>
       <cfquery name="checkDependancies" datasource="#sDatasource#">
        SELECT idCountry
        FROM tblAddress
        WHERE idCountry = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("delete: checkDependancies: idCountry: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfif checkDependancies.recordCount>
       <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("That Country is being used by an address, delete failed.");
        </cfscript>
       <cfreturn iErrorID>
      </cfif>
      <!---
      // Now attempt to remove the record.
      // if this fails for any reason then we submit an error message
      // to the error component and return the ID of the error
      --->
      <cftry>
       <cfquery name="delete" datasource="#sDatasource#">
        DELETE FROM tblCountry
        WHERE idCountryID = #this.idCountryID#
       </cfquery>
       <cfcatch>
        <cfscript>
         objError = CreateObject("component","nec.com.system.errors");
         iErrorID = objError.addError("delete: delete: #cfcatch.detail#");
        </cfscript>
        <cfreturn iErrorID>
       </cfcatch>
      </cftry>
      <cfreturn this.idCountryID>
    </cffunction>
    </cfcomponent>

  • Can I use the value returned from a Text Function in another Formula?

    I'm writing a report in Hyperion System 9 BI + Financial Reporting Studio version 9.2. I have 2 grids in my report.
    Grid1 Column A is set up as a text function using the function type - <<GetCell("Grid2", 1, a, 1)>>. I would like to use the values returned from this text function in Column A (Grid 1) in a formula in Column B (Grid 1).
    Is it possible to use the values returned in Column A of the text function in another formula? My report does not seem to recognize Column A as numerical values, even though the values to be returned are numerical.
    If so, how do I recognize the values in Column A Grid 1 as numerical values and not text?
    Thanks for any help you can offer!

    Hi Edson,
    Yes you need to use the CALC_ERROR macro function to be able to test whether the last macro function returned an error. CALC_ERROR will return an 'X' if there an error occured during the execution of the last macro function.
    You can use a macro similar to the following:
    IF
      CALC_ERROR( )
      = 'X'
          DO SOMETHING HERE
    ENDIF
    Let me explain how this works internally. The SAP system maintains a global variable g_flg_calc_error during the execution of macros in the planning book. The g_flg_calc_error variable will contain the value of f_calc_error that was set by the last macro function which executed. The ABAP coding of a planning book is something like this:
    data: g_flg_calc_error type /SAPAPO/FLAG.
    * SAP will pass g_flg_calc_error variable to all macro
    * functions. When SAP calls a macro function, it does
    * something like this.
    call function '/SAPAPO/MACRO_FUNCTION_HERE'
            exporting
              plob_values      = i_s_adv_plob_values
              sdp_book         = g_c_advf_sdp_book
              sdp_view         = g_c_advf_sdp_view
            tables
              cols_index       = i_t_cols
              value_tab        = l_t_value_tab
            changing
              f_calc_error     = g_flg_calc_error
    As you can see, the g_flg_calc_error variable
    is passed in the "changing" part of the call. The macro  function being called can then use the f_calc_error
    variable to change the value of the global
    g_flg_calc_error variable. In fact, the macro function being called can also check (by looking at the f_calc_error variable) if the last macro function reported an error.  The CALC_ERROR macro function just checks the value of f_calc_error parameter (w/c in fact is the value of the g_flg_calc_error variable) and returns "true/X" if the f_calc_error was set to true by the last macro function.
    Hope this helps in clearing things out

  • Re: values returned by select in Oracle 8.

     

    Can you post a test program that can duplicate it here. I will take a look
    at it.
    sree
    "Francis S" <[email protected]> wrote in message
    news:3bae1cfc$[email protected]..
    Hi,
    I am using Weblogic JDriver with Weblogic 6.0 on Solaris for Oracle8.1.6.
    The database is in UTF8.
    When I do a select, the value returned is a blank string.
    Data is present in the table and its varchar2.
    Please help as this is a really urgent issue..
    Thanks,
    Francis

  • Use value returned by badi

    hi all
    i havnt worked on badi before.
    i have to use the value returned by a badi in "if" condition.
    i just know the badi/implimentation name.
    when i try to find where this badi is used, all i get is the implementation name (which i already know)
    is the badi even used anywhere (because i dont see any program name in "where used list") ?
    Should it be called or will it be called automatically?
    also, i have tried calling this badi using:
    data : flag type string,
    Implementation_instance type ref to <implementaion_name>
    CALL METHOD cl_exithandler=>get_instance
    EXPORTING
    exit_name = <badi_name>
    null_instance_accepted = 'X'
    IMPORTING
    act_imp_existing = flag
    CHANGING
    instance = Implementation_instance
    EXCEPTIONS
    OTHERS = 0.
    CALL METHOD Implementation_instance-<interface_name>~<method_name>.
    EXPORTING
    p1 = a1
    IMPORTING
    p2 = a2
    but i get the following error.
    The type "<implementaion_name>" is unknown.
    I just have to use the value returned by this badi. Someone Please tell me how to do it.
    Thanks

    Hi,
    The way you are calling the BAdi implementation is perfect. However the declaration
    Implementation_instance type ref to <implementaion_name>
    is wrong, the implementation instance should reference the class behind the BAdi. Every BAdi has a class/interface.
    Go to SE18, enter the BAdi name and goto interface tab. In that you will see the name of the Inteface of the Badi say <interface_name>, hence your declaration for implemntation should be
    Implementation_instance type ref to <interface_name>.
    Then make sure you create an implementation for the BAdi from SE19 transaction and activate it.
    Then test your program agian.
    Cheers.

  • PDW : DWLoader in Execute Process Task, Success Value return code

    Hi,
    I'm using SSIS Execute Process Task to call DWLoader.
    It seems the Success Value return code is 2.
    Which is working fine except that after all data are loaded in my table a 0 return code is sent.
    And so my task fails.
    Any idea how to handle this ?
    Thx for your help !
    Regards,
    Bertrandr

    My understanding is - When DWLoader process returns 2, everything goes fine but in another case it returns 0 then task fails.
    You can Set: FailTaskIfReturnCodeIsNotSuccessValue
    to FALSE so that task will not care about return values
    But in case of any other error such as syntax - save
    error in MyVariable and verify if MyVariable != ""
    -Vaibhav Chaudhari

Maybe you are looking for

  • Oracle XA library not available  - Oracle 10g Release 2.0.1

    Hi, We have downloaded Oracle 10g Release 2.0.1 enterprise edition from oracle site and installed on Red hat Linux 4.0. After installation we found Oracle XA library is missing. Ideally it should be in folder $Oracle_Home/rdbms/xa/. The entire XA fol

  • A lot of questions, please help

    Hi! I'm running 10.4.11 on my PowerMac G4 AGP(500mhz), and I've used Classic Environment before to play some old OS 9 apps, like Photoshop CS, but when playing the original Nanosaur, the graphics seemed messed up. There was no texture at all, and eve

  • Read FileNames in Directory

    Hi, I have to read list of filenames in a directory(defined in topology) into a oracle table like filnames test.csv two.csv I know how to use procedure sure which is correct approach Please help Thanks

  • Forte compile error java source files must have a .java suffix

    Hello Guru's, I am using Forte for Java release 2.0 build 1160, and Java SDK 1.3.1. When I try to compile a project in Forte I get the following error : "fastjavac: java source files must have a .java suffix C:\Program" I have looked at the source fi

  • Weblogic 5.1 SP8 on WIN NT Hangs

    Hi, I have the following configuration being tested for load. Weblogic 5.1 SP8, Windows NT, Java 1.2.2, Oracle 8.1.6. I am running load scripts that access JSP. There are about 15 users doing fixed number of different things repeatedly i.e. they logi