XSQL bug  when using CURSOR in xsql:query SELECT statement?

Hi there,
When I tested with different XSQL pages, I found out that if I
did not involve any XSQL pages that contain "CURSOR", I received
data correctly and when I shut down Tomcat, Oracle DB server did
NOT create any dump file (???). However, as long as I involve a
XSQL page which contains "CURSOR", even I received data
correctly, but when I shut down my Tomcat, Oracle DB server
created a dump file (???).
for example, if I involve xsql:query like:
<xsql:query>
SELECT emp_name,
emp_id
CURSOR( SELECT emp_address
from address a
where a.emp_id = b.emp_id)
FROM employee b
</xsql:query>
Once, I involve this xsql page, when I shut down Tomcat, Oracle
dB will create a dump file on the server.
Even when I run this xsql page from
oracle.xml.xsqlXSQLCommandLine, Oracle dB server still create a
dump file on the server.
Any idea for help ?
Thanks,

Hi,
Is this what you are trying:
    try {
    Statement *stmt = conn->createStatement("SELECT ename AS aaaaaaaaaaaaaaa  FROM emp");
      ResultSet *rs = stmt->executeQuery ();
      vector<MetaData> md = rs->getColumnListMetaData ();
      int numCols = md.size ();
      cout<< "Number of columns :" << numCols << endl;
      string *colName = new string [numCols];
      int type = (int ) malloc (numCols);
      for (int i = 0; i < numCols; i++ ) {
        int ptype = md [ i ].getInt (MetaData::ATTR_PTYPE);
        if ( ptype == MetaData::PTYPE_COL ) {
          colName[ i ] = md[ i ].getString (MetaData::ATTR_NAME);
          cout<<"Column Name :" << colName[ i ] << endl;
      delete[] colName;
      stmt->closeResultSet (rs);
      conn->terminateStatement (stmt);
    catch (SQLException &ex) {
                cout<<ex.getMessage()<<endl;
    }The above snippet works correctly for me.
Rgds.
Amogh

Similar Messages

  • Bug when using alias in sql query?

    I don't know if this is a problem related to the getString function of the MetaData class, or if it is something else. I'm having problems when sending a select query containing a specification for column alias to the execute function of the Statement class. Whenever the alias is more than 11 characters it crashes, saying the heap may be corrupt. When the alias is <=11 or there is no alias specified, there are no problems to get the name.
    After executing a query I am looping through the vector of MetaData objects retrieved from the ResultSet and its getColumnListMetaData to get information about each column, among other things the column name. The crash occurs when it comes to the execution of getString(MetaData::ATTR_NAME). As I said, this does not happen when no alias is set, it will pass by without any errors.
    I am using visual studio 2005, oracle 10g release 2 and the downloaded debug versions of occi for visual studio 2005.

    Hi,
    Is this what you are trying:
        try {
        Statement *stmt = conn->createStatement("SELECT ename AS aaaaaaaaaaaaaaa  FROM emp");
          ResultSet *rs = stmt->executeQuery ();
          vector<MetaData> md = rs->getColumnListMetaData ();
          int numCols = md.size ();
          cout<< "Number of columns :" << numCols << endl;
          string *colName = new string [numCols];
          int type = (int ) malloc (numCols);
          for (int i = 0; i < numCols; i++ ) {
            int ptype = md [ i ].getInt (MetaData::ATTR_PTYPE);
            if ( ptype == MetaData::PTYPE_COL ) {
              colName[ i ] = md[ i ].getString (MetaData::ATTR_NAME);
              cout<<"Column Name :" << colName[ i ] << endl;
          delete[] colName;
          stmt->closeResultSet (rs);
          conn->terminateStatement (stmt);
        catch (SQLException &ex) {
                    cout<<ex.getMessage()<<endl;
        }The above snippet works correctly for me.
    Rgds.
    Amogh

  • When using TODATE function MDX query is not correctly generated

    Essbase 9.3.1.2 and OBIEE 10.1.3.4.1.
    When using TODATE function MDX query is not correctly generated.
    This leads to unexpected values not only on cumulative columns in report (generated with TODATE), but also other columns (calculated with AGO function or directly read from cube) have incorrect values.
    The problem occurs when you filter on a column that is not in the select list. If you filter on just one level of dimension, results are fine. You can filter on multiple dimensions as long as you filter on just one level of each dimension.
    If you filter on two or more levels of one dimension, than results are not correct. In some cases results for TODATE column are all zeros, in some cases it is a random value returned by Essbase (same random value for all rows of that column), and in some cases BI Server returns an error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. Essbase Error: Network error [10054]: Cannot Send Data (HY000).
    Here is generated MDX code:
    With
    set [Grupe proizvoda2] as '{[Grupe proizvoda].[N4]}'
    set [Grupe proizvoda4] as 'Generate([Grupe proizvoda2], Descendants([Grupe proizvoda].currentmember, [Grupe proizvoda].Generations(4), leaves))'
    set [Segmentacija2] as '{[Segmentacija].[RETAIL]}'
    set [Segmentacija4] as 'Filter(Generate({[Segmentacija2]}, Descendants([Segmentacija].currentmember, [Segmentacija].Generations(4),SELF), ALL), ([Segmentacija].CurrentMember IS [Segmentacija].[AFFLUENT]))'
    set [Vrijeme3] as '{[Vrijeme].[MJESEC_4_2009]}'
    member [Segmentacija].[SegmentacijaCustomGroup]as 'Sum([Segmentacija4])', SOLVE_ORDER = AGGREGATION_SOLVEORDER
    member [Accounts].[MS1] as '(ParallelPeriod([Vrijeme].[Gen3,Vrijeme],2,[Vrijeme].currentmember), [Accounts].[Trosak kapitala])'
    member [Accounts].[MS2] as '(ParallelPeriod([Vrijeme].[Gen3,Vrijeme],1,[Vrijeme].currentmember), [Accounts].[Trosak kapitala])'
    member [Accounts].[MS3] as 'AGGREGATE({PeriodsToDate([Vrijeme].[Gen2,Vrijeme],[Vrijeme].currentmember)}, [Accounts].[Trosak kapitala])'
    select
    { [Accounts].[Trosak kapitala],
    [Accounts].[MS1],
    [Accounts].[MS2],
    [Accounts].[MS3]
    } on columns,
    NON EMPTY {crossjoin ({[Grupe proizvoda4]},{[Vrijeme3]})} properties ANCESTOR_NAMES, GEN_NUMBER on rows
    from [NISE.NISE]
    where ([Segmentacija].[SegmentacijaCustomGroup])
    If you remove part with TODATE function, the results are fine. If you leave TODATE function, OBIEE returns an error mentioned above. If you manually modify variable SOLVE_ORDER and set value to, for example, 100 instead of AGGREGATION_SOLVEORDER, results are OK.
    In all cases when this variable was modified in generated MDX, and query manually executed on Essabse, results were OK. This variable seems to be the possible problem.

    Hi,
    Version is
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    Sorry, in my last post i forgot to mention that i already created a function based index but still it is not using because, there is a UNIQUE constraint on that column.
    Thanks

  • How to create a cursor on a union select statement?

    Hi,
    Using Oracle 10g RAC +ASM ( RELEASE 1002000300)
    What are is the proper way to create a cursor on a union select statement?
    Is it possible?
    code lines, Results in PLS-00201 error: sT := crsR.STATUS; sS := crsR.TIME;
    Procedure listed below:
    CREATE OR REPLACE PROCEDURE BUILD_SUMMARY IS
    CURSOR csrO IS
    SELECT
    STATUS,
    TIME
    FROM (
    SELECT
    SUBSTR(DESCRIPTION,1,50) STATUS,
    TO_CHAR(TIMESTAMP,'MM/DD/YY hh12:mi:ss') TIME
    FROM GLOBALSALES.CUBE_STATUS
    UNION ALL
    SELECT
    ' TOTAL BUILD TIME',
    TO_CHAR(TO_DATE('00:00:00','HH24:MI:SS') +(MAX(TIMESTAMP) - MIN(TIMESTAMP)), 'HH24:MI:SS')
    FROM GLOBALSALES.CUBE_STATUS);
    csrR csrO%ROWTYPE;
    sT LONG :='';
    sS LONG :='';
    BEGIN
    FOR csrR IN csrO
    LOOP
    sT := crsR.STATUS;
    sS := crsR.TIME;
    DBMS_OUTPUT.PUT_LINE(sT || ' ' || sS);
    END LOOP;
    END;
    /

    csrR csrO%ROWTYPE;
    Declares the csrR correct? Cursor Record of Cursor Object Type?That line declares one variable CSRR with your column structure described by the cursor (CSRO) type you declared above it. It means the CSRR variable has the columns you had in the SELECT statement in that cursor.
    When you run a cursor as you did you don't need to declare the record variable. Try this:
    CREATE OR REPLACE PROCEDURE build_summary IS
      CURSOR csro IS
        SELECT status, TIME
          FROM (SELECT substr(description, 1, 50) status, to_char(TIMESTAMP, 'MM/DD/YY hh12:mi:ss') TIME
                  FROM globalsales.cube_status
                UNION ALL
                SELECT ' TOTAL BUILD TIME',
                       to_char(to_date('00:00:00', 'HH24:MI:SS') + (MAX(TIMESTAMP) - MIN(TIMESTAMP)),
                               'HH24:MI:SS')
                  FROM globalsales.cube_status);
      --csrr csro%ROWTYPE;
      st   LONG := '';
      ss   LONG := '';
    BEGIN
      FOR csrr IN csro
      LOOP
        st := csrr.status;
        ss := csrr.time;
        dbms_output.put_line(st || ' ' || ss);
      END LOOP;
    END;Also why are you using LONG? It's a deprecated data type and Oracle recommends against using it. Either pick varchar2(4000) or CLOB.
    DBMS_OUTPUT.PUT_LINE will implicitly convert that LONG data type anyway.

  • Using pop-up value in select statement

    Hello.
    I want to select a value from a pop-up box and then use that value in a select statement for another pop-up. Is that possible?
    The first pop-up is P39_PIIN_CALL but it is not recognized in the second pop-up when I use it in the select statemnt... select * from table where PIIN = :P39_PIIN_CALL. I get nothing back because it has no idea what :P39_PIIN_CALL is. I'm desperate and on a timeline.
    Thanks,
    Mark E

    Hi,
    After fetching the value from first popup the page should submit so that the value is availble to the second popup..
    Edit the first popup.. and in HTML Form Element Attributes and enter onchange="doSubmit('MyRequest')"
    Regards,
    Shijesh

  • Limitations in using a function within a select statement

    I have a function which retrieves various data elements from the
    database and formats it accordingly. The data (varchar2)
    returned could be in excess of 2,000 characters length.
    I need to use the returned data as part of a view. I am able to
    use the function in a "select" statement, but when I use it with
    returned data in excess of 2,000 chars, I get the following
    error:
    ORA-06502: PL/SQL: numeric or value error
    This error is occurring whenever the returned data is in excess
    of 2,000 characters.
    Is there an alternative method to what I am proposing, I have
    tried alternative data types but if I am able to use it in a
    "select" statement, I get the above error when the returned
    length exceeds 2,000 chars.
    Thanks
    Peter

    are u using oracle 7. varchar2 limit in 8 is 4000.

  • Ora-00600 error on select distinct when using cursors

    Hi, we are using oracle9iFS version 9.0.1.1.0. When I execute the following query in sqlPlus an ora-00600 error occurs.
    Here is the query:
    SELECT     DISTINCT ODMV_FOLDER.NAME,
         CURSOR(SELECT ODMV_DOCUMENT.NAME
    FROM     ODMV_DOCUMENT
    WHERE     ODMV_DOCUMENT.ID = ODMV_FOLDERRELATIONSHIP.RIGHTOBJECT)as Document
    FROM     ODMV_FOLDER,
              ODMV_FOLDERRELATIONSHIP
    WHERE     ODMV_FOLDER.CREATOR = 96 /*this is the user 'system'*/
    AND (ODMV_FOLDER.ID = ODMV_FOLDERRELATIONSHIP.LEFTOBJECT)
    I have no clue why is this happening. I might be doing something wrong since a similar query with a nested cursor works with the scott/tiger schema. Your help is greatly appreciated. Thank you in advance.
    Alfonso.

    I was able to reproduce this error. This looks like a bug in the RDBMS; I would suggest posting on their newsgroup or working with support to handle this problem.

  • Bug when using IBOT

    Hi all,
    has anyone had this kind of error?
    I am using IBOT, and I set Schedule_ to Start Date=21/09/2009, Time of Day=08:00, Set Time Zone=GMT+01:01, and Recurrence_ to Every 1 week(s) on  MON.
    When I look overview of this IBOT, everything is fine, but when I go Show IBOTs acting on my behalf Next Run is not date that I had set. And IBOT is not running in time that he should. But when I set Recurrence_ Daily Every 7 day(s) every thing is OK. IBOT is running and Next Run shows correct date and time.
    Thanks

    This looks the same as bug 5539348 "Schedule an iBot to run immediately and weekly, the immediate run doesn't take place". According to that bug when you say start immediately and run every 1 week you are actually saying start the schedule now not start the ibot?! So a schedule is created in the scheduler to run your ibot every week on Mon but it does not run it immediately.
    I think this is a bug with the weekly schedule though as setting it to 7 days seems to fix it. The bug database seems in infer that later releases of 10g fixed this problem so it might be worth upgrading to a newer patch release if it becomes a problem and seeing if this fixes it.

  • Data refresh bug when using inheritance?

    I am getting unexpected behaviour when using the pm.refresh(Object) method.
    Refresh works correctly and reloads data if the lock has been updated on
    tables/objects with no inheritance. However, if I try to use refresh on an
    object that is part of an inheritance hierarchy, the query that is executed
    to get the jdolockx value is missing the table join.
    Example:
    Table Entity
    id
    displayname
    jdolockx
    jdoclassx
    Table Individual (inherits from Entity)
    id
    firstName
    lastName
    jdolockx
    Query executed when calling refresh and passing in Individual
    SELECT
    t0.JDOLOCKX
    FROM
    ENTITY t0,
    INDIVIDUAL t1
    WHERE
    t1.ID = 1151
    Problem
    Missing crucial join t1.ID = t0.ID
    These classes work correctly with correct SQL when inserting/selecting.
    Any help is greatly appreciated.
    Regards
    Nathan Boyes

    Sorry, forgot to mention Kodo version
    Kodo 2.5.3
    SQLServer2000
    "nathan boyes" <[email protected]> wrote in message
    news:bmj215$qq3$[email protected]..
    I am getting unexpected behaviour when using the pm.refresh(Object)method.
    Refresh works correctly and reloads data if the lock has been updated on
    tables/objects with no inheritance. However, if I try to use refresh onan
    object that is part of an inheritance hierarchy, the query that isexecuted
    to get the jdolockx value is missing the table join.
    Example:
    Table Entity
    id
    displayname
    jdolockx
    jdoclassx
    Table Individual (inherits from Entity)
    id
    firstName
    lastName
    jdolockx
    Query executed when calling refresh and passing in Individual
    SELECT
    t0.JDOLOCKX
    FROM
    ENTITY t0,
    INDIVIDUAL t1
    WHERE
    t1.ID = 1151
    Problem
    Missing crucial join t1.ID = t0.ID
    These classes work correctly with correct SQL when inserting/selecting.
    Any help is greatly appreciated.
    Regards
    Nathan Boyes

  • Strange UI bug when using People view/face recognition

    I've started playing with the face recognition in LR6/CC and have encountered an odd display bug when viewing the groups of 'named people':
    The thumbnail for each named person includes a count of how many images (or perhaps that should be faces) are attributed to their specific name. However, once the number of images for a person exceeds 100, LR only displays the first two digits in the thumbnail and drops off the third one, e.g. 254 is displayed as 25. If you hover over the thumbnail, the full count (e.g. 254) is displayed so long as the mouse cursor is kept on the thumbnail. Interestingly, once the number of images attributed to a named person exceeds 1000, it does the same thing, only it adds an extra digit (so 1400 becomes 140).
    I'm running this on Win7.
    Anyone else seeing this?
    M

    I guess I was primarily "testing the water" to see if the problem was specific to my configuration in some way, but you make a fair point John.
    Here's my (possible) bug report: LIGHTROOM Facial recognition: thumbnails not displaying full number
    M

  • Potential bug when using Parsley 2.4.1 and Cairngorm's module 0.17 in Flex 4.5.1

    Hi
    I have an issue when using cairngorm's ModuleViewLoader along with ParsleyModuleDescriptor to load a simple module consistig mainly of HBoxes, VBoxes and Datagrids.
    The module consists of one child (let's call it ViewA) and that child consists of several children as its components.
    When I use cairngorm's ModuleViewLoader along with the ParsleyModuleDescriptor and Parlsey to inject the modulemanager in my main app, the module loads, as well as ViewA but some nearly all of ViewA's children are not loaded (in fact they're initialized but creationComplete is not invoked).
    When I use Flex's mx:ModuleLoader all ViewA's chikldren are initialized and creation complete is also invoked.
    I will attach the source as a zip file  later on....
    but for now...this is all I can give http://dpaste.com/713503/
    Thanks
    Andreas

    Did you ever find an answer to this?  I am running into the same issue with needing to upgrade parsley to 2.4.x, but with parts of application heavily relying on cairngorm module, upgrading it from module-0.11 to 0.17 seems to break compile! 

  • ERROR WHEN USING CALENDAR DATES IN QUERY

    I am using calendar day in my query selection and it keeps switiching the day and month field and this causes a critical error. 
    program error in class SAPMSSY1 METHIOD: UNCAUGHT_EXCEPTION

    hi
    Instead use a customised date field where user have the option to enter the date
    This will stop the date keep changing
    G N

  • Using a UDF in query select

    I am using CF8 and MS Sql Server. I am getting an error on "select Str, CapFirst(Str) ..." when trying the following:
    <cffunction name="CapFirst" returntype="string" output="false">... </cffunction>
    <cfquery name="query" dbtype="query">
    select Str, CapFirst(Str) as CapStr from SampleTable
    </cfquery>
    Thanks for your help

    You can't run a UDF like that in any <cfquery> SQL string, be it a QoQ or any other DB's driver.
    If one wants to use a UDF in the SQL string, then one needs to call it like one would anywhere else: #myFunctionHere()#.  However this won't help you because all the CF calls are resolved before the resultant string is sent to the DB driver.
    And the string that goes to the driver needs to be valid SQL.
    So you cannot do what you're wanting to do via this approach.
    I presume the original data is coming from a DB?  Why don't you run an equivalent function on the DB before passing it back to CF, so the results are already how you want them to be?
    Adam

  • How to use bind variable in this select statement

    Hi,
    I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
    the procedure is given below:
    create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
    authid current_user
    is
    type poicurtype is ref cursor;
    poi_cur poicurtype;
    sqlst varchar2(250);
    THEVALUE NUMBER;
    begin
         sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
         DBMS_OUTPUT.PUT_LINE(SQLST);
    OPEN POI_CUR FOR SQLST ;
    LOOP
         FETCH POI_CUR INTO THEVALUE;
              EXIT WHEN POI_CUR%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE(THEVALUE);
              SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
              SQLST:=SQLST|| ' WHERE EMPNO=:X';
              DBMS_OUTPUT.PUT_LINE(SQLST);
                   EXECUTE IMMEDIATE SQLST USING THEVALUE;
    END LOOP;
    COMMIT;
    END TEST;
    Best Regards,

    So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
    create or replace procedure test (tablename in varchar2, fieldname in varchar2)
    authid current_user
    is
       sqlst      varchar2 (250);
       thevalue   number := 1234;
    begin
       sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'')  where substr(' || fieldname
          || ',1,5) = ''.THE ''';
       dbms_output.put_line (sqlst);
       execute immediate sqlst;
    end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows.

  • Using Hint in Update or Select Statement...

    Hi ,
    I had an update statement that will get the data from the inline select statement,now where can i can keep the hint ,either in update statement or in Select statement...
    Please let me know if my sample script is wrong or any better way to approach...Please assume that Salary table had millions of employee's salary records.
    update emp
    set salary = salary + (select /*+ full(a) parallel(a,4)  */ salary from Salary
                             where   experience > 5  and empno = 55 )
    where empno = 85Thanks
    Rede

    The better approach would be to determine why you need a hint in the first place. If you're using a hint, that implies that the optimizer is choosing the incorrect plan when left to its own devices. That, in turn, implies that the statistics on your objects, the statistics on your system, your optimizer parameters, your session's optimizer settings or some other variable is incorrect. You're generally better off fixing the root problem than hinting every query.
    In this specific case, the parallel hint is invalid because there is no table aliased A. The full hint is invalid for similar reasons. Plus, with the query you provided, if A was intended to be the SALARY table, it seems exceptionally unlikely that you really want to do a full scan on the salary table to look for what had better be a single row (otherwise your query would throw a "too many rows returned" exception).
    Justin

Maybe you are looking for