Can JDBS calculate the cost of a query ?

In the past I worked with DB2 and I know that it has a feature that can calculate the cost of a query before executing it. Now I have to work with sybase.
I would like to know if there is any way to get that cost in order to decide whether to execute the query or not. In the same way, I would prefer a standard method:
Does JDBC provide a way? Is there any other standard way, using java? Is there any way possible way?, it may be not standard or not java.
Thanks a lot.

Most databases provide a way to do this. The most common verbage for this is "EXPLAIN".
Some of them might expose it via SQL. But that depends on the database.
I suspect there might also be problems with capturing the output.
The most likely way that I can think is if you can encapsulate it in a stored procedure. At the very least you could just call the stored procedure. Or doing it that way might allow you to figure out how to do it via direct SQL calls.

Similar Messages

  • Disassembly Order - System Can't  calculate the cost of Output Item

    Dear All,
    I have a problem with Dis-assembly order in production module,My scenario is I have two output item ABC1 And ABC2
    and One Input Item ABC.
    I have Made The Production BOM  ABC(1 Qty ) = ABC1(1 Qty) + ABC2(1 Qty)
    After it I have purchase the ABC item at the cost 100 Rs.
    I have made the    Disassembly order of ABC Item With qty 1 and set the price list Last Purchase Price,
    at the time of Issue from production system put the following journal entry.
    Stock Account = 100 CR
    WIP Account    = 100 DR
    But ,At the time of Receipt From Production system cannot pass any  journal entry.
    and result is my stock value of item ABC1 And ABC2  is zero with 1 qty.
    for correcting the stock value i am using  item revolution screen and correct the WIP Account.
    But why the system put the Blank Journel entry at the time of receipt from production ,is there any way
    to automate this .i.e.
    ABC1 Qty 1 and Cost 50
    ABC2 Qty 1 and Cost 50
    And JV is
    WIP = 100 CR
    STOCK = 100 DR
    Edited by: Ashish Gupta on Mar 30, 2010 10:59 AM

    Dont do revaluation. Its not necessary. If you observer the journal effect properly then you will find when you perform the disassembly production order after closing it creates JE in which you are in loss of finished product as its not creating the the item cost of returned item but stock is getting increased. So when you sale such item it will show the 100% sales GP and accounting transaction against production loss will be setteled. But if you dnt perform the revaluation then you get teh 100% GP against returned component as it doesn't have item cost.
    Regards,
    Rahul.....

  • Posting of Commission Exp to calculate the Cost of Goods Sold

    Hi Team,
    I do work in an automobile manufacturing organization and is new to SAP FI module. I have a business requirement which I need to fulfill; I would appreciate if all you gurus help me with finding the solution.
    Business Scenario:  at present, we are posting the following entries to record the commission we paid to dealers for selling vehicles.
    Commission Exp (DR)
         Customer (CR)
    Customer (DR)
         Dealer (CR)
    With these entries we are not been able to track the commission based on vehicle variants i.e. Toyota GLI, XLI etc.
    New Requirement:
    To calculate the Cost of Goods Sold for a variant, I need to track the commission expense based on vehicleu2019s variants. Please help me in finding the solution.
    Thanks

    Thanks for quick response.
    Let me give little more details of type of commission entries we have
    1) Normal Commission - Fixed commission variant wise and is derived from SD.
    2) Additional Commission - No predefined formula, this is totally based on top management discretion. Management decides how much would be paid to a particular dealer.
    3) Sliding Commission deduction - Deduction of certain amount from commission on late payments.
    4) Additional Sliding Commission - Payment of additional commission based on early payment terms.
    Currently, FI department is calculating all these figures on Excel sheets and then post a JV for each type of above mentioned commission.
    How can I configure the system to calculate these amounts automatically without involving Excel Sheet help?
    and how to post these amounts variant wise along with dealers and customers.

  • Can't delete the cost estimate via CKR1

    Hi,
    We have one material. We can't delete the cost estimate via CKR1. It is only warning. It is no error log. The other material cost estimate can delete normally. I check the material master I can't find the issue. The following is the warning message. Could you pls help check it? Whate factor will effect the cost estimate deletion? Thanks.
    ==========================
    Deleting current standard cost estimates can cause inconsistencies
    Message no. CK 669
    Diagnosis
    u2022 If you delete a current standard cost estimate, the fields for
    the cost estimate are set to zero in the material master record. If you
    use the material ledger, the standard prices in the material ledger
    master data are also deleted when you delete the current standard cost
    estimate. The material master record for the material thus does no
    longer contains a current standard price from a standard cost estimate.
    u2022 If you delete an active standard cost estimate, you can no
    longer determine scrap, work in process and variations for previous
    periods.
    u2022 In certain countires, it is a legal requirement to maintain
    records of standard pricing. Therefore, you should check whether you
    are obliged by law to keep records of your standard cost estimates.
    Please also contact the relevant accounting and inventory management
    departments.
    ==========================
    Best Regards
    Park Han

    Hi,
    The deletion of Current standard cost estimate should be followed with some rules of the IFRS.
    If you want to change the standard cost you can do the change,If you want to delete the standard cost of material then it will set the price of material to zero.If the material ledger also activate then it will make the Moving average price & standard cost of the material to zero.
    So follow the Law of the country & Discus with Audit team &then delete the curent standard cost estimate of the material.
    Regards,
    Raj

  • How can I calculate the characters with spaces in a document on pages

    I'm currently using pages to write my personal statement up on, although i need to keep my characters including spaces under 4000 characters and also have no more than 47 lines. I've found how to do a word count and find how many charcaters I've used, but i can't see anywhere the information that I actually need to find! Someone please help, thankyou

    How can you calculate the number of lines if you don't know how many characters there are to a line?
    This is 2013. We are using word processors with real fonts, not terminals or teletypers or typewriters.
    If you must have 47 lines then shrink the point size of the font until it fits.
    Peter

  • Can i get the history tab in query designer in bw 3.5 version

    can i get the history tab in query designer in bw 3.5 version plz help me.

    Hi,
    yes..
    do this..
    Go to SPRO->IMG->SAP NEtweaver->SAP BIW->Reprting-relevant Settings->General Reporting Settings in BEx->Activate personalization in Bex.
    Regards,
    San!

  • How can I calculate the request time ?

    Hello,
    How can I calculate the total consume time in each request ?
    For example, I want to start calculating the time when I click on a Link or a button and the end time when it completed load the page !
    Eric

    You could use a filter like this one:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    public class TimeFilter implements Filter {
        // The filter configuration object we are associated with.  If
        // this value is null, this filter instance is not currently
        // configured.
        private FilterConfig filterConfig = null;
        private static final boolean debug = false;
        private long start = 0;
        private long end = 0;
        public TimeFilter() {
        private void doBeforeProcessing(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {
            if (debug) log("CalendarFilter:DoBeforeProcessing");
            System.out.print("In Filter  ");
            this.start = System.currentTimeMillis();
            System.out.println((new java.util.Date()).toString() +
                               " start request ");
        private void doAfterProcessing(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {
            if (debug) log("TimeFilter:DoAfterProcessing");
            System.out.println("Completion Time = " + (System.currentTimeMillis() - start));
         * @param request The servlet request we are processing
         * @param result The servlet response we are creating
         * @param chain The filter chain we are processing
         * @exception IOException if an input/output error occurs
         * @exception ServletException if a servlet error occurs
        public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain)
        throws IOException, ServletException {
            if (debug) log("TimeFilter:doFilter()");
            doBeforeProcessing(request, response);
            Throwable problem = null;
            try {
                chain.doFilter(request, response);
            catch(Throwable t) {
                problem = t;
                t.printStackTrace();
            doAfterProcessing(request, response);
            // If there was a problem, we want to rethrow it if it is
            // a known type, otherwise log it.
            if (problem != null) {
                if (problem instanceof ServletException) throw (ServletException)problem;
                if (problem instanceof IOException) throw (IOException)problem;
                sendProcessingError(problem, response);
         * Return the filter configuration object for this filter.
        public FilterConfig getFilterConfig() {
            return (this.filterConfig);
         * Set the filter configuration object for this filter.
         * @param filterConfig The filter configuration object
        public void setFilterConfig(FilterConfig filterConfig) {
            this.filterConfig = filterConfig;
         * Destroy method for this filter
        public void destroy() {
         * Init method for this filter
        public void init(FilterConfig filterConfig) {
            this.filterConfig = filterConfig;
            if (filterConfig != null) {
                if (debug) {
                    log("TimeFilter:Initializing filter");
         * Return a String representation of this object.
        public String toString() {
            if (filterConfig == null) return ("TimeFilter()");
            StringBuffer sb = new StringBuffer("TimeFilter(");
            sb.append(filterConfig);
            sb.append(")");
            return (sb.toString());
        private void sendProcessingError(Throwable t, ServletResponse response) {
            String stackTrace = getStackTrace(t);
            if(stackTrace != null && !stackTrace.equals("")) {
                try {
                    response.setContentType("text/html");
                    PrintStream ps = new PrintStream(response.getOutputStream());
                    PrintWriter pw = new PrintWriter(ps);
                    pw.print("<html>\n<head>\n</head>\n<body>\n"); //NOI18N
                    // PENDING! Localize this for next official release
                    pw.print("<h1>The resource did not process correctly</h1>\n<pre>\n");
                    pw.print(stackTrace);
                    pw.print("</pre></body>\n</html>"); //NOI18N
                    pw.close();
                    ps.close();
                    response.getOutputStream().close();;
                catch(Exception ex){ }
            else {
                try {
                    PrintStream ps = new PrintStream(response.getOutputStream());
                    t.printStackTrace(ps);
                    ps.close();
                    response.getOutputStream().close();;
                catch(Exception ex){ }
        public static String getStackTrace(Throwable t) {
            String stackTrace = null;
            try {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                t.printStackTrace(pw);
                pw.close();
                sw.close();
                stackTrace = sw.getBuffer().toString();
            catch(Exception ex) {}
            return stackTrace;
        public void log(String msg) {
            filterConfig.getServletContext().log(msg);
    }and in the web.xml :
       <filter>
            <filter-name>TimeFilter</filter-name>
            <filter-class>
                com.filter.TimeFilter
            </filter>
        <filter-mapping>
            <filter-name>TimeFilter</filter-name>
            <url-pattern>/services/*</url-pattern>
        </filter-mapping > 

  • Where can we see the cost estimate which is got deleted.

    Where can we see the cost estimate which is got deleted.

    Hello rajesh as you told that the cost esimate is deleted.
    Then there is no way to see the cost estimate.
    You canonly see the cost esimate in CK40N or in CK13N but you can not see the itemiaxation of that material for ehich we create the cost estimate.
    Hope it will clear you
    IF this informetion is usefull for you please assign some points
    Regards
    Ravi

  • Using Numbers, can I calculate the date that will be eg 45 days ahead of a given date?

    Using Numbers, can I calculate the date that will be eg 45 days ahead of a given date?

    MWB,
    Certainly. Let's say that your given date is in B2. The date 45 days earlier can be found with:
    =B2 – 45.
    Almost seems too simple.
    Jerry

  • Can we Trasfer the cost from Cacital Project to Indirect Project?

    Dear Experts,
    Can we Transfer the cost from Capital Project to Indirect Projects? and If we can Transfer what are the Limitations are there to do so?
    Thanks & Regards
    Bharath
    Edited by: 983186 on Feb 15, 2013 9:35 PM

    Hi
    Any expenditure item charged to any project could be transfered to another project, assuming the Transaction Source does not restrict the adjustment in PJC.
    When you select the expenditure item to transfer, the system creates a negative EI in the original project and another related EI in the target project.
    Distributing those transactions will credit the CIP account on the capital project and debit the expense account on the indirect project.
    Dina

  • How can i calculate the average in java

    how can i calculate the avergae mark out of two marks for instance in like exam mark out
    of two other ones
    thanks for considering this message

    Average or Mean:
    sum_of_N/N
    Here N is the number of marks.
    sum_of_N is the total sum of n(all marks added together)
    public int average(int[] marks) {
    int sum;
    sum = 0;
    for(int i=0;i < marks.length;i++) {
    sum=marks[i]+sum; // keep adding to the total
    return average = sum/marks.length;
    // warning- using an int here can be a pitfall(we could have a decimal outcome).
    }

  • How can I calculate the waveform integral in a defined time interval?

    Hi:
    I need your help. How can I calculate the waveform integral in a defined time interval? For example: from "0" to "2pi"?!
    Thanks.

    Hello Clecio,
    You might want to try the Integral x(t) VI.  The documentation for this VI notes:
    Performs the discrete integration of the sampled signal X. Integral x(t) calculates a definite integral. The value of the output array at any value x is the area under the curve of the input array between 0 and x.
    You would pass the samples of the waveform that fall between your particular window, then pass 1/number of samples for the d(t) parameter.
    Hope that helps.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

  • How to calculate the costs of every item categary in costing run

    Hello Experts,
    Could anyone explain how to calculate the costs of every item categary when I carry out the costing run. For example, item categary: M, E, G.
    Thank you in advance.
    Maria

    This Applesctipt will add comma's to the file count:
    (Copy into Applescript Editor, and Save as File Format: App, then just click the App to run)
    set x to choose folder with prompt "Choose Folder to Count Files" default location alias (the path to pictures folder as text)
    set filecount to do shell script "find " & POSIX path of x & " ! -type d ! \\( -name \".*\" -or -name \"Icon*\" \\) | wc -l"
    display dialog "File Count: " & comma_delimit(trim(filecount))
    on trim(someText)
              repeat until someText does not start with " "
                        set someText to text 2 thru -1 of someText
              end repeat
              repeat until someText does not end with " "
                        set someText to text 1 thru -2 of someText
              end repeat
              return someText
    end trim
    on comma_delimit(this_number)
              set this_number to this_number as string
              if this_number contains "E" then set this_number to number_to_text(this_number)
              set the num_length to the length of this_number
              set the this_number to (the reverse of every character of this_number) as string
              set the new_num to ""
              repeat with i from 1 to the num_length
                        if i is the num_length or (i mod 3) is not 0 then
                                  set the new_num to (character i of this_number & the new_num) as string
                        else
                                  set the new_num to ("," & character i of this_number & the new_num) as string
                        end if
              end repeat
              return the new_num
    end comma_delimit

  • How can I calculate the total time in java?

    Hello!
    I need to calculate the total time!
    For example I have start time:
              Format formatter1;
              Date date1 = new Date();
              formatter1 = new SimpleDateFormat("hh:mm:ss");
              String startTime = formatter1.format(date1);
              //startTime = "14:20:40";
    And I have finish time:
              Format formatter2;
              Date date2 = new Date();
              formatter2 = new SimpleDateFormat("hh:mm:ss");
              String finishTime = formatter2.format(date2);
              //finishTime = "08:30:55";
    So, after manually calculating, I get total time: "18:10:15"
    How can I calculate the total time in java? (Using formatter1 and formatter2 I suppose)
    What I need is to print "total 18:10:15"
    Thanks!

    800512 wrote:
    I did the following but, I think something is wrong here:
    I defined before: Date date1 = new Date(); Date date2 = new Date();
    And it should be exactly 5 seconds between them.
    I found delta between date1 and date2:
    Format formatter = new SimpleDateFormat("HH:mm:ss");
              long timeInMilliFromStart = date1.getTime() - date2.getTime() ;
              Date date3 = new Date(timeInMilliFromStart);
              String timeInSecFromStart = formatter.format(date3);
    and I get always
    //timeInSecFromStart = 02:00:05
    But it should be exactly 00:00:05.
    What can be a problem?Because, like I said, a Date measure an instant in time, not a duration. So when you have 5000 ms, and you turn that into a Date, that means 5 sec. after the epoch, which works out to 1/1/1970 00:00:05.000 GMT.
    As I mentioned, if you're not currently in GMT, then you have to set the TZ of the DateFormat to GMT. Right now, it's showing you the time in your TZ. If you included the date in your SimpleDateFormat, you'd see either 1/1/1970 or 12/31/1969, depending on which TZ you're in.
    Bottom line: You're trying to use these classes in a way they're not meant for, and while you can get the results you want for a limited set of inputs if you understand what these classes do and how to work with that, it's a brittle approach and comes with all kinds of caveats.

  • Text on path: How can I calculate the text length?

    Hi
    I have a text on path (spline item). Now I need the length of this text and the length of the spline item.
    I try to calculate the text length using IWaxLine::GetWidth(), but this is always 0.
    - How can I calculate the length of this text?
    - How can I calculate the length of the spline item?
    Thanks
    Hans

    It would be interesting if you could describe the purpose of your "length", but I don't have an answer anyway. Would the bounding box be sufficient?
    Considering that TOP may be combined with arbitrary spline paths, this could become an exercise in higher math. I haven't yet encountered a function that returns the mathematical length of such a spline.
    Otherwise it could be solved if you iterate and sum up the relevant points of the bounding box (ascender, descender, baseline?) of individual glyphs.
    Be warned that the whole TOP looks alien, as if it were a transplant from a different program. Experience also shows that documented and actually used interfaces / commands are completely different animals ...
    Dirk

Maybe you are looking for