Function in a query causing a problem ................

Hello Gurus
I have a problem with my select statement which contains 2 function in it. These functions cause the query to run slow. I have cross checked with all the indexes, statistics and index used within the function they are all correct.
Please some one tell me why is this happening. There was a database crash since then this has started to happen. I have revalidated the fucntions and indexes, still it does not help any.
A questions comes to my mind will it be solved by pinning these functions in memory? and how that could be done.
Please help me at the earliest.
Thanks

first function
=========
function CS_GET_AGENT_TRACK_DATA (
v_ACCOUNT_NUM VARCHAR ,
v_USER_ID VARCHAR,
v_OEM_ID NUMBER
return VARCHAR
is
L_INFO VARCHAR(2000) := '';
L_EMPTY_INFO VARCHAR(2000) :='N' || CHR(2) || 'N' || CHR(2) || '0' || CHR(2) ||
cursor get_AGENT_TRACK_DATA (P_ACCOUNT_NUM VARCHAR,P_USER_ID VARCHAR, P_OEM_ID N
UMBER) is
select
NVL(IN_OUT_FLAG,'N') || CHR(2) ||
NVL(AVAILABLE_FLAG,'N') || CHR(2) ||
NVL(AGENT_INCIDENT_LOAD,0) || CHR(2) ||
ASSIST_LIST
from
WEBTEL.CS_AGENT_TRACK
where
AGENT_ACCOUNT_NUM = P_ACCOUNT_NUM and
AGENT_USER_ID = P_USER_ID and
OEM_ID = P_OEM_ID ;
--cursor get_LAST_ACTIVITY_DATE (P_ACCOUNT_NUM VARCHAR,P_USER_ID VARCHAR) is
-- select
-- NVL(IN_OUT_FLAG,'N') || CHR(2) ||
-- NVL(AVAILABLE_FLAG,'N') || CHR(2) ||
-- NVL(AGENT_INCIDENT_LOAD,0) || CHR(2) ||
-- ASSIST_LIST
-- from
-- WEBTEL.CS_AGENT_TRACK
-- where
-- AGENT_ACCOUNT_NUM = P_ACCOUNT_NUM and
-- AGENT_USER_ID = P_USER_ID and
-- OEM_ID = P_OEM_ID ;
BEGIN
OPEN get_AGENT_TRACK_DATA (v_ACCOUNT_NUM, v_USER_ID, v_OEM_ID);
FETCH get_AGENT_TRACK_DATA into L_INFO;
IF (get_AGENT_TRACK_DATA%NOTFOUND) THEN
L_INFO := L_EMPTY_INFO;
END IF;
CLOSE get_AGENT_TRACK_DATA;
IF ((LENGTH(L_INFO) <= 0) or (L_INFO IS NULL)) THEN
L_INFO := L_EMPTY_INFO;
END IF;
RETURN L_INFO;
EXCEPTION WHEN OTHERS THEN RETURN L_EMPTY_INFO;
END;
second function
============
function CS_GET_AGENT_OPEN_COUNT (
v_ACCOUNT_NUM VARCHAR ,
v_USER_ID VARCHAR,
v_ADD_HANDICAP NUMBER default NULL,
v_HANDICAP_OEM NUMBER default NULL
return NUMBER
is
L_INFO NUMBER := 0;
L_RET_VAL NUMBER := 0;
L_USING_AGENT_TRACK NUMBER := 0;
cursor get_AGENT_OPEN_COUNT (P_ACCOUNT_NUM VARCHAR,P_USER_ID VARCHAR) is
select /*+ INDEX_COMBINE(CS_INCIDENT_TABLE) */
count(*)
from
WEBTEL.CS_INCIDENT_TABLE
where
AGENT_ACCOUNT_NUM = P_ACCOUNT_NUM and
AGENT_USER_ID = P_USER_ID and
INCIDENT_STATE < 2 ;
cursor get_HANDICAP_COUNT (P_ACCOUNT_NUM VARCHAR,P_USER_ID VARCHAR, P_OEM_ID NUM
BER) is
select
NVL(AGENT_INCIDENT_LOAD,0)
from
CS_AGENT_TRACK
where
AGENT_ACCOUNT_NUM = P_ACCOUNT_NUM and
AGENT_USER_ID = P_USER_ID and
OEM_ID = P_OEM_ID ;
BEGIN
OPEN get_AGENT_OPEN_COUNT (v_ACCOUNT_NUM, v_USER_ID);
FETCH get_AGENT_OPEN_COUNT into L_INFO;
IF (get_AGENT_OPEN_COUNT%NOTFOUND) THEN
L_INFO := 0;
END IF;
CLOSE get_AGENT_OPEN_COUNT;
L_RET_VAL := L_INFO;
IF ((v_ADD_HANDICAP is not null and length(v_ADD_HANDICAP) > 0) AND
(v_HANDICAP_OEM is not null and v_HANDICAP_OEM > 0)) THEN
L_USING_AGENT_TRACK := WEBTEL.IS_SITE_CONFIG_ON('AGENT_TRACKING_ENABLED',v_HAN
DICAP_OEM);
IF (L_USING_AGENT_TRACK > 0) THEN
OPEN get_HANDICAP_COUNT (v_ACCOUNT_NUM, v_USER_ID, v_HANDICAP_OEM);
FETCH get_HANDICAP_COUNT into L_INFO;
IF (get_HANDICAP_COUNT%NOTFOUND) THEN
L_INFO := 0;
END IF;
CLOSE get_HANDICAP_COUNT;
L_RET_VAL := L_RET_VAL + L_INFO;
END IF;
END IF;
RETURN L_RET_VAL;
EXCEPTION WHEN OTHERS THEN RETURN 0;
END;
These are the two functions
thanks

Similar Messages

  • I use the SCC mediaserver in my work, and the crop function has stopped working on Firefox, although it works on Internet Explorer, and I'm wondering if a recent upgrade caused that problem.

    I am a newspaper copy editor and use Firefox to work from home. I use the SCC mediaserver to crop photos and place them in the JazBox system, which includes Adobe InCopy and InDesign. For some reason, the crop function is not working on the SCC when I go on it in Firefox, although it's working in Internet Explorer, which is much slower. I didn't have this problem until I installed a Firefox update today. What can I do?

    Try to update to Firefox 8.0.1
    You can find the latest Firefox release here:
    *Firefox 8.0.x: http://www.mozilla.com/en-US/firefox/all.html
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • On Submit process not firing -report (PL/SQL function returning SQL query)

    Can anyone suggest possible causes / solutions for the following problem?
    I have a report region that uses a PL/SQL function returning SQL query. The report allows the user to update multiple fields / rows and then click a button to submit the page which should run the On-Submit process to update the database. However the process does not run and I get a 'HTTP404 page cannot be found' error; and when I navigate back using the Back button I cannot then navigate to any other page in my application without getting the same error. The button was created by a wizard selecting the options to submit the page and redirect to a (same) page. The button does not actually have a redirect in its definition but the wizard created a branch to the same page which should work and the button has the text 'submit as SUBMIT' next to it so it appears to be set up correctly.
    I have recreated this page several times in my application and I cannot get the On-Submit process to run. However I have created a cut down version of the same page in the sample application on apex.oracle.com at http://apex.oracle.com/pls/otn/f?p=4550:1:179951678764332 and this works perfectly so I am at a loss to understand why it does not work in my application. I cannot post any part of the application itself but if anybody would like to check out page 30 of the sample application (Customer Update Test tab) updating the surnames only, using credentials ja, demo, demo this is pretty much what I have got in my application.
    Any ideas would be much appreciated?

    Thanks for the suggestions guys. I have now identified that the problem goes away when I remove the second table from my report query. The original report query retrieved data from two tables and the process was updating only one of the tables. I thought I had approached the task logically i.e. first get the report to display the records from the two tables, then get the process to update the first table and finally to modify the process further to update the second table.
    Can anyone point me to an example of multiple row updates on multiple tables using a PL/SQL function returning an SQL query?

  • Query Causes ASP Error

    This query works great within MS Access itself but causes and
    error when used in an ASP application ...
    DateAdd("m",-2,EndDate()) >= Date()
    Someone suggested there is a problem with the quote marks in
    ASP. Would appreciate any help to resolve this. The original thread
    is below. Thanks.
    Newsgroup User has posted a message entitled Re: EndDate.
    Message Posted on: Monday January 22,2007 05:01:27 PM
    You use a DateAdd function to get this, something like
    DateAdd("m",-2,EndDate()) >= Date()
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Tiggerick" <[email protected]> wrote in
    message
    news:ep2nej$oar$[email protected]..
    > Our current function is ... EndDate() >= Date() ...
    which is used to
    > screen out
    > any results prior to today's date.
    > We would like to modify this so that instead of today's
    date we would use
    > the
    > date 2 months prior to today's date, so that, for
    example the EndDate() on
    > 1/22/07 would be 11/22/06.
    > Would appreciate help on the format for this.
    > Thanks in advance!
    > Rick
    >
    You can view the message at
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=189&threadid=1235135&fo rumid=12.
    Text
    quote marks
    Text

    The quotes around m are the problem here. Double them up to
    send as-is to
    Access (""m"" instead of "m").
    "Tiggerick" <[email protected]> wrote in
    message
    news:er00oi$duu$[email protected]..
    > Here is the complete SQL statement that is causing a
    problem. Dreamweaver
    > is
    > showing the m inside the quotes in black if that means
    anything ...
    >
    > Recordset1.Source = "SELECT * FROM Events WHERE
    EventType = '" +
    > Replace(Recordset1__MMColParam, "'", "''") + "' AND
    EndDate >=
    > DateAdd("m", -2,
    > Date()) ORDER BY StartDate ASC"
    >

  • Question on query causing timeouts and CXpacket

    Hello,
    I am using SQL Server 2008 R2 SE with 24 processors as shown below:
    This is a standalone non clustered server. The MAXDOP setting is 8 as shown below:
    These settings have been the same for more than an year. But since last week I am noticing that query is taking longer time to execute and complaining on 94% wait time is on CXPACKET. Does this necessarily mean the MAXDOP setting has to be changed?
    I added a few indexes for this query and CXPacket is gone but the indexes are causing failures somewhere else. As soon as the indexes were disabled these failures are gone. 
    Experts I need your valuable thoughts on this. Thanks a bunch.

    Hello,
    But since last week I am noticing that query is taking longer time to execute and complaining on 94% wait time is on CXPACKET. Does this necessarily mean the MAXDOP setting has to be changed?
    I would think not at this moment (though that's just a guess right now). Is this a problem with just a single query, a few, all, etc? The first step I would take (against CXPACKET waits on a query) is to check out the execution plan and verify that statistics
    skew isn't causing a problem with work divisions per thread. To do this, find the parallelism operators (press f4 to show details in SSMS) and investigate the threads and the amount of rows each processed. If it is skewed on some threads that could be participating
    in the issue you are having. Let's start checking here and see what the result is.
    You could also get the execution plan and upload it somewhere for us to look at.
    Sean Gallardy | Blog
    MCM 2008
    MCSM:Data Platform Charter Member

  • New WIN7 System, FFox gives error "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory" - will not go to any site.

    New Windows 7 computer. After installing Firefox, every time I bring it up I get the following message:
    "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features."
    Then Firefox comes up, but will not function at all - can enter url address, but will not respond to ANY clicks, so can not go to any site.

    This link shows how to fix this - https://support.mozilla.com/kb/Could+not+initialize+the+browser+security+component

  • SQL Query ( PL/SQL function body returning query ) page

    Hello Friends,
    I have a page with type SQL Query ( PL/SQL function body returning query ).
    I have written a pl/sql block that returns a sql query - select statment.
    Some times i am getting no data found error - does it got to do with the variable that stores the query .
    =======================
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Error ERR-1101 Unable to process function body returning query.
    OK
    =====================
    When the query is returned with records where exactly the records are stored is it in the variable declared in pl/sql block or with the Oracle Apex implicit cursor.
    Here's the pl/sql block ..
    The query is generated while the user is navigating through pages ..
    ====================
    declare
    l_return_stmt varchar2(32767);
    l_select varchar2(32000);
    l_from varchar2(32000);
    l_where varchar2(32000);
    l_order_by varchar2(32000);
    l_stmt_recordcount varchar2(32000);
    l_recordcount number ;
    begin
    l_select := 'select '||:P10_VARLIST1||:P10_VARLIST2||:P10_VARLIST3
    ||:P10_VARLIST4||:P10_VARLIST5;
    l_from := ' from '||:P10_RELATION;
    if length(:P10_WHERE) > 0 then
    l_where := ' where '||:P10_WHERE;
    else
    l_where := '';
    end if;
    if length(:P10_ORDER_BY) > 0 then
    l_order_by := ' order by '||:P10_ORDER_BY;
    else
    l_order_by := '';
    end if;
    l_return_stmt := l_select||l_from||l_where||l_order_by;
    :P10_STMT := l_return_stmt;
    return l_return_stmt;
    end;
    =============================
    Appreciate your help in this regard.
    thanks/kumar
    Edited by: kumar73 on Apr 22, 2010 6:38 AM

    It looks like the query string you are trying to pass back exceeds the 32K limit for a varchar. Where this is happening is kind of difficult to tell as it could be any number of points, and also depends on what you are passing into the process via page items.
    I would first try to establish what combination of page items causes this error to occur. Then, starting from the bottom and working your way backwards, I would start 'switching off' some of the items you use to build your query until it breaks again, thus establishing which part is leading to the error.
    Also, I'm not sure what :P10_STMT is doing (are you maybe using this for visiblity of the query created)?
    It looks like the query string you are trying to pass back exceeds the 32K limit for a varchar. Where this is happening is kind of difficult to tell as it could be any number of points, and also depends on what you are passing into the process via page items.
    I would first try to establish what combination of page items causes this error to occur. then, starting from the bottom and working your way backwards, I would start 'switching off' some of the items you use to build your query until it breaks again, thus establishing which part is leading to the error.
    Also, I'm not sure what :P10_STMT is doing (are you maybe using this for visiblity of the query created)?

  • PL/SQL function in datamodel query

    Hi All,
    I have the following problem:
    I have a query Q1 returning a few rows. In the group G1 using this query Q1 i have a computed field returning a number NUM_1.
    select col_1, col_2 from table_1;
    So the output looks like:
    row 1 col_1 col_2 NUM_1_1
    row n col_1n col_2n NUM_1_n
    I want to order these rows by the calculated column NUM_1 the highest first.
    I know i can't order by a calculated column but can i do it by using a pl/sql function in the query to calculate the NUM_1?
    Like:
    select col_1, col_2, function(x) NUM_1 from table_1;
    And where should i create this function? Can it be done in the program unit section or do i have to create a library?
    Best regards,
    Snoesky

    Oke, i have created a break group on the calculated field.
    Ordering works fine now.
    I have an additional question:
    Is it possible to dynamically order this break (column) group? Meaning thru a parameter to tell the ordering to be descending or ascending.
    Regards,
    Snoesky

  • Use of sql group function in orcl:query-database - urgent

    All,
    Version: 10.1.3.4
    Two requirements for me:
    1. I want to use sum function in orcl:query-database. How to use it?
    For ex: I tried the following
    <xsl:value-of select='orcl:query-database("select sum(salary) from emp",false(),false(),"jdbc/DB1")'/>
    I got the following error
    oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name.
    When I tried without sum function, it works fine
    2. I used the same table, but without the sum function as below
    <xsl:value-of select='orcl:query-database("select salary from emp",false(),false(),"jdbc/DB1")'/>
    This time, it returns the first employees salary!! I dont understand this logic. I expected either the query returns all the rows else it throws error, but none of them were true!
    Can anyone pls explain what is the behavior? I want your reply for both the queries!
    Currently I'm in a project where I'm working in the similar scenario, so please guru's let me know ASAP.
    Thanks,
    Sen

    Hi Sen,
    Create a normal variable variable in XSLT.
    Then use that variable.
    I mean variable name='Var_1' select='Your Query'
    Now use Var_1/yourcollection/...
    I am giving some example
    <xsl:variable name="Stopdetails" select="/ns0:MyEBM/ns0:DataArea/ns0:MyEBO/ns0:Stops/ns0:Stop[ns0:StopID=$TempStopId]"/>
                <xsl:variable name="AccStopTypeVar">
                        <xsl:value-of select="$Stopdetails/ns0:StopType"/>
    </xsl:variable>If you want you can loop on the created variable.
    You can do these in XSL.
    But DB calls those things ...it would be better , if u take them out. Spme debugging problems are there with XSL.
    Regards
    PavanKumar.M

  • Query selection variable problem

    Hi ,
    We have a material "89-9712" . When running a query in the query designer (on portal) with material as selection variable we are having problems. When we enter "89-9712", we are getting an error "enter single values and not a range"...is the fact that there is a "-" in the material key causing the problem. What can we do?
    Thanks,
    Anita.

    Hi,
    Having a '-' while entering the material value shouldn't pose a problem in case the same fromat is adopted while storing the material , or does two no. i.e. 85-39876 , 85 refers to some " material grooup" or category , and the real material no is 39876 in that case it may pose a problem.
    While making an entry make sre you are not putting any sapce other than '-' sice space is not permitted.
    Hope this will be expedite.
    Thax &  Regards
    Vaibhave Sharma
    Edited by: Vaibhave Sharma on Sep 17, 2008 11:35 PM

  • BW User Exit - Code in function of the query name

    Hi,
    I would like to create an user exit code which execute a algorithm different in function of the query executed. do you know in which variable is store the technical name of the query.
    CASE query
        WHEN 'Z_ZAPO_001'.
           V1 = 1
        WHEN 'Z_ZAPO_002'.
          V1 = 2    WHEN '10' OR '11' OR '12'.
    ENDCASE.

    Yaroslav,
    I_S_RKB1D-COMPID will never be filled for authorization user-exits (I_STEP = 0). Don't ask my why, I once raised this question to OSS and they replied it was never foreseen to work with authorization user-exits. God knows why, it's very unlogical and it wouldn't cost them a lot of work to get it working...
    I could solve this problem by applying a little trick. In our queries we included a user-exit keydate variable. This will push the user-exit first in I_STEP = 1 mode where I_S_RKB1D-COMPID is filled. Then save the query name by exporting it to the ABAP-memory. Afterwards, the user exit with code for I_STEP = 0 will be processed and then you can import the query name from the ABAP memory.
    I agree it sounds a little bit tricky but there is no better option I'm affraid.

  • Using 'Function Returning SQL Query' with Flash charts

    I have created a pl/sql function that returns a SQL query as a varchar2 of this form:
    select null link
    <x value> value
    <Series1 y value> Series 1 Label
    <Series2 y value> Series 2 Label
    <Series3 y value> Series 3 Label
    from tablea a
    join tableb b
    on a.col = b.col
    order by <x value>
    If I now call the function from a Flash Chart Series SQL box with the Query Source Type set to 'Function Returning SQL Query' like this:
    return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'))
    it parses correctly and the page is saved; however, when I run the page I don't get any output - nor any error messages or other indication of a problem.
    Now, if I call the function in a SQL client, capture the SQL query output using dbms_output and paste that into the Flash Chart Series SQL box - changing the Query Source Type to SQL Query - and save the page it works fine when I run it and returns a multi-series flash chart.
    Can anyone suggest either;
    1. What have I might have missed or done wrong?
    2. Any way to usefully diagnose the problem...
    I have tried using the Apex debugger - which is very nice, by the way - but it doesn't provide any info on what my problem might be. I even tried writing my own debug messages from my function using the apex_debug_message package - got nothing...
    Thanks,
    Eric

    Hi Eric,
    Try expressing the source as this:
    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
    It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • Question - Passing date to a function from a Query

    Hello,
    I have a function which looks like this
    CREATE OR REPLACE FUNCTION CAL_DATES_FNC
    (fp_fddate IN VARCHAR2,
    fp_task IN VARCHAR2
    RETURN VARCHAR2
    IS
    BEGIN
    IF TO_CHAR(TO_DATE(fp_fddate,'YYYYMMDD'),'DD-MON-YYYY') <= TO_CHAR(ADD_MONTHS(TO_DATE(fp_fddate,'YYYYMMDD'),60),'DD-MON-YYYY')
    THEN
    RETURN TO_CHAR(ADD_MONTHS(TO_DATE(fp_fddate,'YYYYMMDD') +21,6 * SUBSTR(fp_task,-2)) ,'DD-MON-YYYY');
    ELSIF TO_CHAR(TO_DATE(fp_fddate,'YYYYMMDD'),'DD-MON-YYYY') >= TO_CHAR(ADD_MONTHS(TO_DATE(fp_fddate,'YYYYMMDD'),72),'DD-MON-YYYY')
    THEN
    RETURN TO_CHAR(ADD_MONTHS(TO_DATE(fp_fddate,'YYYYMMDD') +21,12 * SUBSTR(fp_task,-2)) ,'DD-MON-YYYY');
    END IF;
    END;
    I am using this function in a query as given below to pass a date fp_fddate
    The problem I am having is that the function is executing only the first part of the IF construct it is not going into the second IF condition.
    Can some one please let me know where I could be going wrong.
    SELECT ABC.PT,
    ABC.INV,
    ABC.INVSITE,
    ABC.TASK TASK_NAME,MAX(XYZ.FPDATE) fpdate ,
    CAL_DATES_FNC(MAX(XYZ.FPDATE),ABC.CPTASK) "DATE1",
    TO_CHAR(TO_DATE(ABC.D_YR||ABC.D_MON||ABC.D_DAY,'YYYYMMDD'),'DD-MON-YYYY') "DATE2"
    FROM ABC,
    XYZ
    WHERE ABC.PT = XYZ.PT
    AND PATSTAT.PT = '61090'
    GROUP BY ABC.PT,ABC.INV,ABC.INVSITE,ABC.D_YR,ABC.D_MON,ABC.D_DAY,ABC.CPTASK
    Regards
    Fm

    Hi,
    IQ wrote:
    Thanks for your messages. I am sending the scripts for the tables and insert statements in this message. Hope this will help to recreate the scenario.Don't forget to post the output you want from that data, and an explanation of how you get that output from the given data.
    Some of my answers are as follows,
    1) I know that the function is not in a proper syntax and thats the reason I need to fix it to be able to perform well. All I want is to compare the dates for a 5 year period(60 months) and then return something . For a period greater than 6 years (72 months) it should return something else.What dates do you want to compare? I assume fp_fddate is one of them, but what about the other(s)?
    When does the 5-year period begin or end?
    When does the 6-year period begin or end?
    I understand the fucntion may return either of two values. Do you care what those two values are? If so, give examples.
    What if the date is in neither the 5-year nor the 6-year period? (A fucntion has to return something in all cases. It can return NULL, if that's what you want.)
    What if the argument can't be interpreted as a date?
    2) Regarding the string datatype for date columns I cannot change the database design as this is done by another team, I can however explain them the points mentioned here.
    Please find below the scripts When you say TEST_DATES, do you mean TEST_DATES1. or is there another table? Test before you post.
    CREATE TABLE TEST_DATES
    pt VARCHAR2(10 BYTE),
    inv VARCHAR2(10 BYTE),
    invsite VARCHAR2(10 BYTE),
    task_name VARCHAR2(20 BYTE),
    fpddate VARCHAR2(8 BYTE),
    DATE1 VARCHAR2(4000 BYTE),
    DATE2 VARCHAR2(17 BYTE)
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (61090,'XDUMMY1'     ,'R1111','UP01'     ,'19990714','04-FEB-2000',     '17-JAN-2000');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,     'XDUMMY1','R1111','UP02','19990714','04-AUG-2000','20-JUL-2000');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,     'XDUMMY1','R1111','UP03','19990714','04-FEB-2001','19-JAN-2001');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP04','19990714','04-AUG-2001','21-JUL-2001');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP05','19990714','04-FEB-2002','20-JAN-2002');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP06','19990714','04-AUG-2002','19-JUL-2002');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP07','19990714','04-FEB-2003','17-JAN-2003');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP08','19990714','04-AUG-2003','15-JUL-2003');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP09','19990714','04-FEB-2004','20-JAN-2004');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP10','19990714','04-AUG-2004','25-JUL-2004');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP11','19990714','04-FEB-2005','27-JAN-2005');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP12','19990714','04-AUG-2005','25-JUL-2005');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP13','19990714','04-FEB-2006','28-JAN-2006');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP14','19990714','04-AUG-2006','30-JUL-2006');
    insert into test_dates1(pt,inv,invsite,task_name,fpddate,date1,date2)
    values (
    61090,'XDUMMY1','R1111','UP15','19990714','04-FEB-2007','31-JAN-2007');
    /You said that sometimes the data contains values like 'NA'. Shouldn;t the sample data have an example or two of that?
    Once the data is populated in the table , use the following query
    select TASK_NAME,RCM_CAL_THEORETIC_DATES_FNC(MAX(fpddate),task_name) "DATE1"
    from test_dates1
    group by task_name When you say
    RCM_CAL_THEORETIC_DATES_FNC, do you mean the function you posted in your first message, which was called
    CAL_DATES_FNC, or is there another funciton?
    When I make those changes and run the query, I get 15 rows:
    TASK_NAME            DATE1
    UP06                 04-AUG-2002
    UP07                 04-FEB-2003
    UP14                 04-AUG-2006
    UP08                 04-AUG-2003
    UP10                 04-AUG-2004
    UP12                 04-AUG-2005
    UP15                 04-FEB-2007
    UP01                 04-FEB-2000
    UP02                 04-AUG-2000
    UP03                 04-FEB-2001
    UP05                 04-FEB-2002
    UP13                 04-FEB-2006
    UP04                 04-AUG-2001
    UP09                 04-FEB-2004
    UP11                 04-FEB-2005Is that correct?
    If so, what is the problem?
    If not, what results should I get?
    What is the function supposed to do?
    Edited by: Frank Kulash on Nov 9, 2010 4:45 PM

  • Quick Sales Order Form Enter Query(F11) and Execute Query(Clt+F11) Problem

    Hi Everyone,
    I am having a Problem in Quick Sales Order Form. When I am entering a New Sales Order and Book the Order it is working fine. And Now I want to Query the Sales Order If the Same New Order Number has Queried then It is Properly Queried. But If I am trying to Query Some Other Existing Sales Order other than the new one then It Shows the Error Messgae as Query Caused No Records to be Retrived. We have R12 12.1 Instance.
    Can anyone Helpme in Solving this Issue will be highly appriciable.
    Advance Thanks for your Efforts.
    Regards,
    Murugan. AR.

    Was this working before? If yes, any changes have been done recently?
    Have you tried to regenerate the form via adadmin and see if it helps?
    Do you have any invalid objects in the database?
    You may try to obtain the FRD log file and see if more details about the issue are collected in the logs.
    Note: 438652.1 - R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle Applications
    Note: 445166.1 - How to create a FRD (Forms Runtime Diagnostic) Log in EBusiness Suite R12 using Forms 10g
    Thanks,
    Hussein

  • 10.5.8 Install caused major problems

    When I started this machine, I used Migration Assistant to move from a G4 to an Intel processor which apparently is a bad idea.
    Finally, after 40+ hours of work and a half-dozen calls to Apple over months, I had to perform a clean install with 10.5.4, update to 10.5.7 and rebuild the data stores piece by piece. There were some problems, especially related to PERMISSIONS, but the new install seemed OK after spending another $100 on Disk Warrior 4 and rebuilding all the permissions.
    Then (about 10 days later) I installed 10.5.8. Suddenly all my permissions were wrong -- I could not even use GET INFO. Spent four hours rebuilding what looked to be all permissions through the Disk Utility. Seemed that the major change was to "downgrade" permisions from 777 to 770, or something like that.
    Seems generally OK, except now MAIL through IMAP GMAIL seems not to update properly.
    Any known reason that a functioning machine suddenly needs to have all the permissions rewritten?
    Any other suggestions?

    Thanks for the extensive suggestions. I always try to maintain two separate, up-to-date backup, one on Time Machine, one via Super Duper, in separate sites.
    Excellent.
    Thanks for the details, but what you suggest is what I finally had to do two weeks ago when I did the clean install that left me with permission problems, defined as repeated interruptions with the message "You cannot do "x" because you do not have permission."
    Then there are three possibilities: 1) you didn't really do the install the way I said to and it wasn't really "clean", 2) you've got some kind of skanky third-party software installed that is causing the problem or 3) you have a very odd hardware problem. From the error messages regarding permissions, I would consider #3 to be extremely unlikely.
    I got Disk Warrior because it was strongly advised by one of several telephone consultation with the Apple Expert after I was having problems with permissions. He said it was faster and more thorough in repairing permissions than Disk First Aid.
    I think you must have misunderstood. DiskWarrior does not have anything to do with permissions, it rebuilds the drive's directory structure. I can't imagine someone in Apple support would have told you that it repairs permissions, though I suppose that's always a possibility.
    As near as I could tell over a week or more of relatively intensive operation, after I adjusted all of the permissions, there were no further operating problems with the Mac (other than one Eudora crash)
    One crash is not equal to "no further problems," and just because you haven't noticed the problems didn't mean they weren't there. The number one most common cause of problems following an update is a damaged system getting further damaged.
    Your advice suggests that instead of trying to run my struggling nonprofit organization I should just quit and take up management of my MacBook.
    Well now you're just getting whiny. What I told you to do will take some time, yes, but not more than a half-day's work to get back to a state that you could work from. Either do it or don't, but don't blame the advice.
    I have been using Macs since the mid 1980's and this is a special problem.
    If you really had been using Macs since the 1980s, you should know that there weren't permissions until *this decade*. There also weren't regular updates back then, since the internet was not commonly used and typical connection speeds were much slower. So of course it didn't happen back then. However, these days it is not a special problem, though it is not what I would call a common problem.
    I should add perhaps that simultaneous with this series of problems with my Mac, the Foundation had a disk failure on a Dell laptop, still under warrantee. It took us ten days of staff effort, PLUS four more days and $800 in fees to a local Geek shop to get that fixed and all that Dell provided was a replacement hard disk.
    How is this relevant?
    I have been into my Annapolis Apple store twice during the trevails with the MacBook, but both times they were too busy helping people learn how to dial their iPhones to provide any real assistance.
    Did you make an appointment? If you are going to bring a machine in for help, you need to have an appointment with a Genius. If you don't, you will wait. Or go home. You can make an appointment online at your local [Apple Retail Store page|http://www.apple.com/retail>.

Maybe you are looking for

  • How do I transfer Voice memos from iPhone to my iMac?

    I have recordings made on my iPhone using Voce Memos, since updating to OS10.8 these no longer sync to my iMac when using iTunes.  The help files for iTunes bear no relation to the screens that iTunes produces and there seems no direct way of transfe

  • Is there any way to write-enable an NTFS-format WD external Hard Drive ?

    I have a WD Elements external HD unit, 1TB previously formatted NTFS under Windows XP on a PC. I would like to use this HD unit to both read and write data using both the Windows PC and a MacBook Pro. But when connected to the MacBook Pro (USB), the

  • ITunes and Apple TV

    Good morning ! I do hope this is the right place for my "problem" so here goes: I'm a little tight on space on my MB. What I want to do is to sync my movies to Apple TV, then delete the files from my HD. If I understand correctly, the files would be

  • Graphics using graphic API are drawn below the loaded content created using Flash authoring tool

    Here is my problem. I am developing a Analog Dial component. Here , I am extending UIComponent and loading a swf file generated using Flash CS3 authoring tool ( the swf basically has the circle and needle) and adding the loaded content as child of Di

  • What webcams work in 10.4?

    I'm looking for webcams for a G4 powerbook and G5 imac for use in ichat and skype. I've called around but it's been frustrating trying to find any updated info. Seems that to use a USB webcam you need to also buy and download a iChatUSBCam for $10, w