Problem with select query inside a function.

Hi,
i have created a function as
create or replace function "NEW"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
select sum(allocation_percent) into v_alo from employeeproject where start_date < s_date and end_date > e_date and pid != 'BPDE-KER12' and employee_id = emp;
select allocation_percent into v_alo2 from employeeproject where start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and employee_id = emp;
select max(end_date) into v_date from employeeproject where employee_id=emp having max(end_date) <= S_DATE;
if v_alo < 100 then
return 1;
else if v_alo2 = 100 then
return 2;
else if v_date < s_date then
return 3;
else
return 4;
end if;
end if;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;it is compiled correctly.
when executing the function with
select abc.a,new(a,'03-jan-2011','04-jan-2011') "status" from abc where new(a,'03-jan-2011','04-jan-2011') in (1,2,3,4);it is returning
A status
1 5
2 5
3 5
instead of
A status
1 1
2 2
3 3
and when i comment any two select statements then some part of my ans is correct.
unable to understand the behaviour.
can any pls help me understand it.
Thanks,
hari

Hi,
thanks for the reply, and sorry for my ugly code.
i am using Oracle database 10g express edition.
Case could be a option to use but i need to figure why my query is not returning any value when used together.
my requirement is to find
the employees who are have allocation percent sum < 100 for a defined period(excluding pid=BPDE-KER12) and
employee who is mapped to pid=BPDE-KER12 not in my first requirement in that period and
the employees whose latest end date is less than the new start date.
i have tried the new modified code as you said but this time it returns null, not even exceptions running.
i divide my requirement into three functions which will return value.
1.  create or replace function "NEW4"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to check if the employee total percentage is <100 then return 1 else return 4
select sum(allocation_percent) into v_alo from pm_employee_project
where
start_date < s_date and end_date > e_date and pid !='BPDE-KER12' and employee_id = emp;
if v_alo < 100 then
return 1;
elsif v_alo2 = 100 then
return 2;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW4(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
result,
A STATUS
1 *1*
2 4
3 4 2.create or replace function "NEW5"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--To select employee who are in a specific pid.
select allocation_percent into v_alo2 from pm_employee_project where
start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and
employee_id = emp;
if v_alo2 = 100 then
return 2;
elsif v_alo < 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW5(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 *2*
3 5 3.   create or replace function "NEW6"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to select the employee whose project end date is less thann the new date.
select max(end_date) into v_date from pm_employee_project where
employee_id=emp having max(end_date) <= S_DATE;
if v_alo2 = 100 then
return 2;
elsif v_alo = 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW6(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 5
3 *3* so my function works properly individually, but i want all the three conditions in a single function with same order as above 1 then 2 and then 3.
and when i try to do it that way i am not getting my result as
A STATUS
1 *1*
2 *2*
3 *3*
so how can i proceed.
my input table values,
select * from abc
A B C
1 2 2
2 1 3
3 1 2
select * from pm_employee_project
varchar2 varchar2 date date date varchar2
EMPLOYEE_ID PID START_DATE END_DATE ALLOCATION_PERCENT SUPERVISOR_ID
1 10 02-JAN-11 31-JAN-11 89 -
1 20 05-JAN-11 20-JAN-11 9 -
1 BPDE-KER12 21-JAN-11 31-JAN-11 11 -
2 BPDE-KER12 01-JAN-11 31-JAN-11 100 -
3 30 01-JAN-10 01-JAN-11 100

Similar Messages

  • Problem with select query

    Hi All,
    i_dfkkko-xblnr
      IF NOT i_dfkkko[] IS INITIAL       .
        SELECT opbel
               belnr
               FROM erchc
               INTO TABLE i_erchc1
               FOR ALL ENTRIES IN i_dfkkko
               WHERE opbel EQ i_dfkkko-xblnr.
      ENDIF.
    I am using the above select query.problem is when i put the value
    of i_dfkkko-xblnr by going to the table erchc i am getting the record.But this qury is not resulting any value.
    i have checked in debug mode copied the value of xblnr of i_dfkkko
    and went to erchc table and passed to opbel of erchc i got the reords.
    can anybody pls help..
    Rgds,
    Sai

    Hi,
    The database would be having the value with leading zeroes.
    Use FM "CONVERSION_EXIT_ALPHA_INPUT" to conver the values & then pass to select query.
    _dfkkko-xblnr
    IF NOT i_dfkkko[] IS INITIAL .
    loop at i_dfkkko.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    VALUE(INPUT) = i_dfkkko-xblnr
    IMPORITNG
    VALUE(OUTPUT) = i_dfkkko-xblnr.
    modify i_dfkkko.
    endloop.
    SELECT opbel
    belnr
    FROM erchc
    INTO TABLE i_erchc1
    FOR ALL ENTRIES IN i_dfkkko
    WHERE opbel EQ i_dfkkko-xblnr.
    ENDIF.

  • Problem with select query in search

    Hi,
    Here i am using MYSQL database and when i am insertind date to database it is saving like  '2009-11-10 00:00:00'  and when i used to dispaly this in dateformat as '11/10/2009' .
    here is the problem occurs , when i write a search query as
    select recruitername,interviewdate ,skillset
                 from details
                  where interviewdate = #form.interviewdate#
    i am getting problem with date . would u please help me how to solve this issue .

    Try to use DateFormat
    select recruitername,interviewdate ,skillset
                 from details
                  where interviewdate = #DateFormat(form.interviewdate, "yyyy-dd-mm")#

  • BULK COLLECT in select query inside a function

    Hi All,
    My query is :
    SELECT col1,col2,col3 FROM table_a; --( consider this is a long running query with lot of joins)
    Need to know how can i get the output of the above query from a function using BULK COLLECT.
    and i tried this:
    CREATE OR REPLACE TYPE tab_a_row
    AS OBJECT (
    col1 number(20),
    col2 number(20),
    col2 number(20)) ;
    create or replace type tab_a_nt as table of tab_a_row;
    create or replace function get_table_a
    return sys_refcursor
    is
    tab_a_recs tab_a_nt;
    rv sys_refcursor;
    begin
    SELECT tab_a_row(col1,col2,col3) BULK COLLECT INTO tab_a_recs FROM table_a;
    open rv for select * from table(tab_a_recs);
    return rv;
    end;
    Function created successfully. and i exec this from sql plus using
    SQL> var rc refcursor;
    SQL> exec :rc := get_table_a;
    BEGIN :rc := get_table_a; END;
    ERROR at line 1:
    ORA-22905: cannot access rows from a non-nested table item
    ORA-06512: at "GET_TABLE_A", line 12
    ORA-06512: at line 1
    Kindly share your ideas on how to use bulk collect and get set of outputs from a function.
    Edited by: 887268 on Apr 18, 2013 3:10 AM

    >
    If i use refcursor , then the JAVA code needs to be changed accordinglyto get the refcursor output.
    >
    Well, of course. Java has to know what the sql projection is. How else will it know how many columns there are and their datatypes.
    But that is true no matter what method you use.
    >
    But if i use a PLSQL COLLECTION TYPE (nested tables ) , then i can get output as ,
    select * from table(function_name(input1,input2));
    >
    No - using the 'table' function mean you are calling a PIPELINED function.
    This is a sample of a PIPELINED procedure.
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
    select * from table(get_emp(20))Or your function could return a collection like the example from this thread this morning.
    Example of Collection as datatype of a function’s return value
    CREATE OR REPLACE TYPE enamelist as VARRAY(20) of VARCHAR2(20)
    /* Formatted on 4/18/2013 4:06:47 PM (QP5 v5.126.903.23003) */
    CREATE OR REPLACE FUNCTION ename_fn
    RETURN enamelist
    AS
    v_cursor_main enamelist := enamelist ();
    BEGIN
    SELECT ename
    BULK COLLECT
    INTO v_cursor_main
    FROM emp;
    RETURN v_cursor_main;
    EXCEPTION
    WHEN OTHERS
    THEN
    RETURN v_cursor_main;
    END;
    select * from table(ename_fn()) from dual;
    COLUMN_VALUE
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER

  • Problem with select query that includes a date

    I've been fighting with this for about 4 hours - yes, quite literally... I've never been good with date stuff. I have a brain block.
    Anyway, here's the situation:
    I have an Access database that has a time/date field. There are no times, just a date in mm/dd/yyyy format.
    That table is a list of classes held for the past three years. I want to make a query that only shows the classes that have ended after January 1 of this year. I don't want to put 01/01/2010 in the query itself because I want it to still work next year.
    This is the current query:
    <cfquery name="classes" datasource="#DSN#" dbtype="ODBC">
    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit
    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime ON classes.classTime = classTime.timeID) INNER JOIN owners ON classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType
    WHERE  classes.classEnd <  01/01/#DatePart("yyyy", now())#
    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle
    </cfquery>
    I don't get any results, but I should get a list of every class that has an end date before January 1 of this year - about 200 records.
    When I swap around the where clause to:
    <cfquery name="classes" datasource="#DSN#" dbtype="ODBC">
    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit
    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime ON classes.classTime = classTime.timeID) INNER JOIN owners ON classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType
    WHERE  classes.classEnd > 01/01/#DatePart("yyyy", now())#
    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle
    </cfquery>
    I get EVERY class in the database, and I should only be getting about 50
    The classes are about 8 weeks long, the begin date and end date are in the database as date/time fields, so I need to show everything that ended in 2010, regardless of when it started.
    I'm sure it's something glaringly obvious, but it's escaping me.
    THANKS
    Michelle

    The format of your date field in access is irrelevent to the situation at hand.  Use proper date objects instead of trying to build a suitable string.  For the first of January of the current year, the coldfusion functions createdate(), year(), and now() are your freinds.  Then, in case Adam's post was not clear, use cfqueryparam with the resulting variable.

  • CF9 Problems with Select * query, resulting in Value can not be converted to requested type.

    So, I work on a legacy CF web site and there are numerous SELECT * FROM USERS_TABLE queries all over the site.
    Well, we changed the structure of said table in the database on our Testing and Staging sites, with no issues.
    When we pushed up to our production environment and changed the structure of the production DB table, the server kept kicking back "Value can not be converted to requested type."
    After doing some searching out there, it looks like CF caches the structure of the table, and you either have to restart CF to clear it, or rename and then name-back the DSN to fix the issue.
    http://www.bennadel.com/blog/194-ColdFusion-Query-Error-Value-Can-Not-Be-Converted-To-Requ ested-Type.htm
    That said, this doesn't happen in our testing and staging environments - so what would be the difference?
    Is there some setting I need to change in the CF Admin to keep this from happening again?

    Also, if you can use a Stored Procedure to retrieve the data, do so.  Standard queries gets all the information, anyway, chokes bandwidth passing it all to the CF server, and forces the CF server to filter, sort, and format the data.  SPs tell the db server to get ONLY the data requested, and forces the db server to filter and sort the data, leaving only formatting to the CF server.
    That's not true. The only time CF messes with data returned from the DB is if there's a maxrows attribute, and the record set returnded from the DB has more than that number of records... which causes CF to truncate the recordset to the correct size before returning it. The DB might or might not stop sending rows down to CF after CF says "yeah, I've got all I want now".
    Other than that, for all intents and purposes all CF does with the SQL is pass it to the DB and wait for an answer. The only thing it does to the returned data is to create a CF record set ("query") with it... this does not involve any filtering and sorting.
    Adam

  • Problem with Select query fetching records.

    Hi All,
    SELECT bukrs belnr gjahr bldat cpudt aedat cputm usnam xblnr bktxt waers
                       FROM bkpf INTO TABLE bkpf_tbl
                       WHERE bukrs IN s_bukrs AND blart IN ('RE' , 'ZL')
    AND ( ( cpudt > prv_date )
                       OR    ( cpudt = prv_date AND cputm >= prv_time ) )
                       OR  ( ( aedat > prv_date )
                       OR    ( aedat = prv_date AND cputm >= prv_time ) )
                       AND gjahr IN s_gjahr
                       AND monat IN s_monat
                       AND belnr IN s_belnr
    My prv_date is 05/04/2010 while debugging.
    CPUDT (Accounting Document Entry Date) in BKPF doesnu2019t have any entries.
    But AEDAT (Date of the Last Document Change by Transaction) is having a single entry on date 05/04/2010.
    While this query is showing number of records around 200000. I feel something is wrong with the AND/OR statements.
    Please suggest some ideas?

    Hi Mishra,
    I dont know the excaly wht u r passing in the prv_date and cpudt . But one thing i notice that blart part.
    SELECT bukrs belnr gjahr bldat cpudt aedat cputm usnam xblnr bktxt waers
                       FROM bkpf INTO TABLE bkpf_tbl
                       WHERE bukrs IN s_bukrs AND blart eq  'RE' or  blart eq 'ZL'
      AND ( ( cpudt > prv_date )
                       OR    ( cpudt = prv_date AND cputm >= prv_time ) )
                       OR  ( ( aedat > prv_date )
                       OR    ( aedat = prv_date AND cputm >= prv_time ) )
                       AND gjahr IN s_gjahr
                       AND monat IN s_monat
                       AND belnr IN s_belnr.
    With Regards,
    Sumodh.P

  • Problem with select query (results cant b displayed)

    SELECT url,SUM(data_received) xyz FROM logs GROUP BY url ORDER BY xyz desc
    when i triedthe above query in the worksheet it works fine but when i write same query in code i get this error.
    myjsp page has this code.
    <%while (rset.next())
    out.println("<tr>");
    out.println("<td>" +
    rset.getString(1) + "</td><td>" +
    rset.getInt(2) + "</td><td> " +
    "</td>");
    out.println("<tr>");
    %>
    This is the error
    500 Internal Server Error
    java.sql.SQLException: Invalid column name at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240) at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:3201) at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1880) at oracle.jdbc.driver.ScrollableResultSet.findColumn(ScrollableResultSet.java:1308) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1618) at list_action._jspService(_list__action.java:67) [list_action.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
    please help

    it is better to use  into table ....itab.
    dont go for joins if u r joining four tables .......
    it is better to for all entries.
    SELECT aauart awerks akdauf akdpos
    bftrmi baufnr bstlbez baufpl
    blead_aufnr bprodnet
    FROM aufk AS a
    INNER JOIN afko AS b
    ON baufnr EQ aaufnr
    INTO  TABLE i_data1
    WHERE a~auart IN s_auart
    AND a~kdauf IN s_vbeln
    AND a~werks EQ p_werks
    AND b~aufnr IN s_aufnr
    AND b~ftrmi IN s_ftrmi.
    if i_data1[] is not initial .
    if any sorting criteria is required based on primary keys write the sort statement here.
    select  crueck crmzhl
    cvornr carbid clmnga cxmnga
    crmnga cism04 cism05 cbudat
    d~kunnr
    e~arbpl
    FROM afru AS c inner join vbak AS d
    ON caufnr EQ aaufnr  innerjoin  crhd AS e
    like this u need to do...........................
    u have joined around five tables ...definetly that wont work
    endif.

  • Problem with select query when it returns a NULL value

    Hi all,
    I have a d/b table called QMEL and i picked VBELN from that table. Now if the VBELN value in that table is NULL i have to wtite an if condition.
    Can i say it like this
    IF VBELN = ' '.
    write: enter into the if condition.
    ELSE.
    write: enter into the else condition.
    ENDIF.
    or should is say some thing else? my objective is ..i should execute some statments if VBELN has no value and i should execute some othet statements if VBELN has a value.
    Kindly help..as even though i put above condition..it deosnot work
    Regards,
    Jessica Sam

    hi
    check this
    if u r using selection optins  use this code
    IF NOT s_material[] IS INITIAL.
        SELECT material                             
        FROM marc
               INTO  l_material
             WHERE material IN s_material.                     
        ENDSELECT.
        IF sy-subrc NE 0 AND l_material IS INITIAL.
          MESSAGE e302 WITH space.
        ENDIF.
      ENDIF.
    if u r using parameter then
    IF NOT P_material IS INITIAL.
        SELECT material                             
        FROM marc
               INTO  l_material
             WHERE material EQ P_material.                     
        ENDSELECT.
        IF sy-subrc NE 0 AND l_material IS INITIAL.
          MESSAGE e302 WITH space.
        ENDIF.
      ENDIF.
    ~linganna
    Edited by: katigiri linganna on Apr 8, 2009 5:58 AM

  • Problem with select query:help

    SELECT url,SUM(data_received) xyz FROM logs GROUP BY url ORDER BY xyz desc
    when i triedthe above query in the worksheet it works fine but when i write same query in code i get this error.
    myjsp page has this code.
    <%while (rset.next())
    out.println("<tr>");
    out.println("<td>" +
    rset.getString(1) + "</td><td>" +
    rset.getInt(2) + "</td><td> " +
    "</td>");
    out.println("<tr>");
    %>
    This is the error
    500 Internal Server Error
    java.sql.SQLException: Invalid column name at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240) at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:3201) at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1880) at oracle.jdbc.driver.ScrollableResultSet.findColumn(ScrollableResultSet.java:1308) at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1618) at list_action._jspService(_list__action.java:67) [list_action.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
    please help

    This is not the proper forum....
    Post this thread to
    Java Server Pages (JSP)
    Greetings...
    Sim

  • Chart - problem with realize one of the function under CR XI

    Post Author: mrowa
    CA Forum: Charts and Graphs
    Hello,
    I have
    problem with realize one of the function under CR XI. I would be persuade if
    any of us would like to help me.
    1)   
    1) From
    database (basically from one table), I take data to make report. Each of record
    have appropriate fields:
    dteData
    intYear
    intMonth
    intDate
    2)   
    2) I
    want to realized comparison data from two or more periods of time on one chart
    and in one table. For easily explanation I will describe problem on two
    periods.For instance, user want to display and compare
    on chart date (type monthly -sum data of each month) from 2007.02 u2013 2007.05
    with date from 2006.03 u2013 2006.06. So we compare month 2007.02 with 2006.03;
    2007.03 with 2006.04; 2007.04 with 2006.05; 2007.05 with 2006.06
    On char I would like to display bars with comparison
    of months.
    Problem is that I donu2019t know how to write
    something similar. I can use one period without any problems, but two and mores
    I canu2019t realized.
    Detail description:
    I passed
    two parameters two report:
    {?from}, {?to} u2013for first period
    {?offset}, it means {?from}+{?offset},
    {?to}+{?offset}  - for second period
    On axis Y I have Sum(intDate);On
    X (year + month). But on each value x( example 20007.02) I need to have
    two values (bars). Value for standard period and offset.
    For example for x=2007.02, I need
    two bars one equal 2007.02 and second with offset u2013 2006.03
    Movement to next value (bar) is
    persuade by fields {data.rok}&{data.month} first or second period. This is
    combination of two elements year&month defined under Formula. Problem
    persist in that both period has different year.month and here problem starts once
    again. I donu2019t know how to solve it. I have found out one solution but it
    limits user only for two periods (I want to compare more).
    My idea for compare only two
    periods:
    I make one query in CR for one
    period and second query for second period.
    Firs query:
    "SELECT 
           year ,
          month
    Second query
    "SELECT 
           year + FLOOR({month + offset} % 13),
          {month + offset} % 13
    Then in CR I connect two periods and
    make u201Ctableu201D (results of queries) with JOIN on fields year and month.
    This solution is not functional,
    because I need to make reports for days and hours as well. In this solution I
    canu2019t use (%31), because not all months has 31 days.
    I use CR in WEB app made in Visual
    Studio 2005. Maybe from aspx we can manipulate with date to get exact solution,
    and solve problem with SELECT.
    Hope my description clearly
    describe problem and someone will be able to help me. I would be thankful.

    I have had similar problem before.
    Because I had too many data, the legend would not display all the data. Also the chart would not display all the data. But I was able to find a work around.
    In your case, Right click on the Legend text and click on Format Legend Entry.
    Change the font of the legend to 4 (which is the minimum). This may work.
    If you are also having problem with data labels, you could change the font size of the data labels.
    Hope this helps.
    Thank you.

  • Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination

    Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination
    Problem in committing transactions in Multiple Forms (Oracle Forms) with POST built-in command:
    Consider that the following statements are written in WHEN-WINDOW-CLOSED trigger of a called form.
    Statements in called form (Form name: FORM_CHILD):
    go_block('display_block') ;
    do_key('execute_query') ;
    -- Data from table_b will be populated in this block, based on the value of COLUMN_1 obtained
    -- from TABLE_A.
    -- Example: If the value of COLUMN_1 is 10, then all the matching records from TABLE_B, which
    -- are inserted with value 10 in TABLE_B.COLUMN_1 will be fetched and shown here.
    if user_choice = 'YES' then
    commit ;
    else
    rollback ;
    end if ;
    Statements in calling forms:
    There are two calling forms having following statements and it is going to call the above said called form.
    CALLING FORM 1
    Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...; Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    CALLING FORM 2:
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...;
    insert into table_b ...;
    Our understanding:
    Assume that both the forms are running from two different machines/instances, issuing commit at the same time. In this case, forms will start executing the statements written in ON-INSERT trigger, the moment POST command is executed. Though the commit is issued at the same time, according to oracle, only one of the request will be taken for processing first. Assume that calling form 1 is getting processed first.
    So, it fetches the value available in COLUMN_1 of TABLE_A and locks the row from further select, update, etc. as SELECT...FOR UPDATE command is used (note that NOWAIT is not given, hence the lock will be released only when COMMIT or ROLLBACK happens) and proceed executing further INSERT statements. Because of the lock provided by the SELECT...FOR UPDATE command, the statements in calling form 2 will wait for the resource.
    After executing the INSERT statements, the FORM_CHILD is called. The rows inserted in to TABLE_A will be queried and shown. The database changes will be committed when user closes the window (as COMMIT is issued in its WHEN-WINDOW-CLOSED trigger). Then the SELECT...FOR UPDATE lock will be released and calling form 2's statements will be executed.
    Actual happenings or Mis-behavior:
    Calling form 2 starts executing INSERT statements instead of waiting for SELECT...FOR UPDATE lock. Also, the value selected from TABLE_A.COLUMN_1 is same in both the calling forms, which is wrong.
    The rows inserted into TABLE_B are having similar COLUMN_1 values in calling form 2 and they are fetched and shown in the called form FORM_CHILD.
    Note that in calling form 2 also POST only is issued, but the changes posted there are accessible in calling form 1 also, which is wrong.
    Kindly suggest us as to how to fix above problem. It will be much use, if you can send us the information regarding the behavior of Oracle Forms POST built-in also.
    Our mail ID: [email protected]
    Thanks a lot in advance.

    You have several problems:
    1. On-Insert will ONLY run if you have created a new record in a base-table block. If you haven't done that, then the POST command will not cause it to run.
    2. Select for update without a "no wait" will lock records for the first form, but when the second form tries this, it will hit the ORA-00054 exception, and will NOT wait. The only way you could make it wait is to issue an UPDATE sql command, which is not such a good way to go.
    All POST does is issues SQL insert or update commands for any changes the user has made to records in a form's base-table blocks, without following with a Commit command.
    Also understand that Commit is the same as Commit_Form, and Rollback is the same as Clear_Form. You should read up on these in the Forms help topics.

  • How to create a DB Adapter with select query having inner query

    Hi All,
    I am trying to create a DB Adapter with select query. The query has some inner queries in it. It is just like this select a, b, c, (select d from e) d, (select e from e) e from tablename.
    The problem here is with the xsd generated for this query. Xsd is not getting generated properly for all the fields it is just getting generated till c element and when it encounters
    the inner query it is stopping the generation of xsd. So for the above query the xsd is something similar to the below
    <xs:complexType name="rewOutput">
    <xs:sequence>
    <xs:element name="a" type="xs:string" nillable="true"/>
    <xs:element name="b" type="xs:string" nillable="true"/>
    <xs:element name="c" type="xs:string" nillable="true"/>
    <xs:element name="select_d" type="xs:string" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    as shown above the xsd is just getting generated till the first inner query. What should be done to get the full fledged xsd. Should it be manually built ?? Please help me on this.
    Thanks In Advance.
    Edited by: 959766 on Nov 30, 2012 1:20 AM

    Hi,
    I don't think the parser will be able to understand your query properly... I would try building the xsd manually...
    Cheers,
    Vlad

  • Problem with a query with a BLOB data type

    Hi i've a problem with this query in 11g. R1
    SELECT
          LOGTIMESTAMP,
          LOGTIMEMILLIS,
          MSGID,
          XMLTYPE(MESSAGEBODY, nls_charset_id('AL32UTF8')).getClobVal()  as LLamada
    FROM
        vordel.AUDIT_MESSAGE_PAYLOAD,
        vordel.AUDIT_LOG_POINTS
    WHERE
        AUDIT_LOG_POINTS.LOGPOINTSPK = AUDIT_MESSAGE_PAYLOAD.MP_LOGPOINTSPK AND
        LOGTIMESTAMP between TO_TIMESTAMP('03-12-2011 00:00','DD-MM-YYYY HH24:MI') and  TO_TIMESTAMP('03-12-2011 12:00','DD-MM-YYYY HH24:MI')
         and filtertype = 'LogMessagePayloadFilter'
      and filtername like 'Log Llamada%'MESSAGEBODY: data type of the Column is BLOB
    throw this error after execute the query
    Error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00200: could not convert from encoding UTF-8 to UCS2
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 283
    ORA-06512: at line 1

    Could you check the BLOB really contains UTF-8 encoded XML?
    What's your database character set?The BLOB contains UTF-8 Encoded
    and the database where i am connectes have AL32UTF8 character set, but my internal instance have "AMERICAN_AMERICA.WE8ISO8859P1"
    that is a problem?
    How could I change the character set of the oracle local client to the character set of the remote oracle data base?

  • Problem with Hierarchical query

    Gurus,
    I have a problem with hierarchical query, which I am pasting below.
    select sys_connect_by_path (Fname,'/')"PATH",Fname,id,level
    ,(SELECT COUNT(ID)-1 FROM (SELECT CONNECT_BY_ROOT LNAME LNAME,ID FROM CMT_PERSON
    START WITH ID = 'emplo000000000126009'
    CONNECT BY PRIOR ID=MANAGER_ID)
    GROUP BY FNAME)"COUNT"
    from CMT_PERSON
    WHERE
    LEVEL <= 4
    ----And ID='emplo000000000001877'
    CONNECT BY PRIOR id=manager_id
    ----AND NOT LEVEL > 3
    START WITH ID='emplo000000000126009'
    As per the result, count is getting repeated for all the levels. That is, count is coming 16100 for every level, Can you please help where exactly I am going wrong
    Regards

    You do not say anything about what count you want to get?
    A wild guess could be:
    select
       sys_connect_by_path (p1.fname, '/') "PATH",
       p1.fname,
       p1.id,
       level,
       (select count (id) - 1
        from
           (select connect_by_root p2.lname lname, p2.id
            from cmt_person p2
            start with p2.id = p1.id
            connect by prior p2.id = p2.manager_id)
        ) "COUNT"
    from cmt_person p1
    where level <= 4
    connect by prior p1.id = p1.manager_id
    start with p1.id = 'emplo000000000126009';Since your inner query simply starts with the hardcoded employee id, naturally it will give you the same count.
    My guess is your inner query should start with the person id from the outer query?
    If that is not the case - please state in plain english what you are trying to accomplish ;-)
    (Oh, and please paste code within tags so we can read it more easily...)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for