How to get at cursor embedded in cursor?

Hello
I have a PL/SQL function that returns a cursor that has an embedded cursor in it.
eg...PL/SQL
select id,
name,
primary_contact,
time_stamp ,
cursor
select id,
name,
regi_region,
time_stamp
from offices o
where o.supp_id = s.id
) offices
from suppliers s
In my DAO I am using getObject() on the statement to return the main cursor as a resultset. I am getting an exception thrown when I try to get at the embedded cursor. Ive search ed through a load of docs so far and cant find any references to how I might go about getting at this embedded resultset.
Im not sure what happens to this embedded cursor when I cast the main cursor to a resultset using getObject(). Does this embedded cursor also get cast to a rsultset implicitly?
Any advice would be appreciated since Im at a loss on this one now.
Thanks
Jon
Java stuff:
statement.registerOutParameter(1, OracleTypes.CURSOR);
statement.execute();
ResultSet rs = (ResultSet)statement.getObject(1);
while (rs.next()) {
log.info("### in rs loop");
rs.getLong("id");
log.info("### about to get offices");
//ResultSet officesRs = (ResultSet)statement.getObject(2);
ResultSet officesRs = (ResultSet)statement.getObject("office");
while (officesRs.next()) {                     
log.info("### in office loop - must have got embedded cursor ok");
.....................................................

Hi Miya,
Write your own textSelectionSuite for this.
and use ITextTarget->GetRange() function.
Thanks and Regards,
Yopangjo.

Similar Messages

  • How to get collection of embeded fonts using plugins in acrobat reader?

    I am trying to create a plugin for acrobat reader to display embedded fonts on opened document and will do business logic afterward, but not sure whats the method to get the collection of embedded fonts.
    Please give me example of code snippet how to get collection of embedded fonts of opened document.
    Thanks

    PDDocEnumFonts() will enumerate the fonts in a document for you.  You will have to look at each font to determine if it's embedded or not.
    Don't forget that to build a plugin for Reader, you need a license from Adobe.

  • How to get highest number of open cursors within the current calendar day

    Hi all ,
    i need to know how to get the highest number of open cursors within the current calendar day.
    Thanks ,

    823030 wrote:
    the issue is my customer is getting the error ORA-01000: maximum open cursors exceeded and we need an sql statment that gets the following values :
    -highest number of open cursors experienced in the current calendar day.
    -current open cursors
    -and maximum open cursorsThis error is rare. It happens when
    a) the value of the open cursor parameter is set extremly low (default is something like 1000). Low would be something like 10.
    b) <strike>you have many concurrent users(=sessions) and </strike>the application does not use bind values
    In this case each select will open a new cursor, instead of reusing it.
    c) you have a select that opens a cursor for each line. This can happen with a statement where you have the CURSOR keyword somewhere in the select or where clause. Those cursors will be closed when the select is finished. But during the run time of the select, all cursors stay open.
    To track the number of "open cursors" during the day you would need to implement some monitoring. Maybe based on the view that was already mentioned.
    Edited by: Sven W. on May 16, 2011 2:30 PM - since the parameter is on session level, other open cursors should not influence it much.

  • How to get rowtype of a ref cursor?

    Hello again,
    I need your help once more.
    I have a function in a package which returns a SYS_REFCURSOR. Now I am trying to open that cursor from the application (currently sql_developer) to show the data. For starting I have a simple query in the statement: select * from emp;
    Later it will be a complex query which returns results of multiple joined tables.
    I have the following package:
    >
    CREATE OR REPLACE
    PACKAGE P_TEST_ASP AS
    FUNCTION test_asp_1 (dti_id in NUMBER)
    RETURN SYS_REFCURSOR;
    END P_TEST_ASP;
    >
    And here comes the package body:
    >
    CREATE OR REPLACE
    PACKAGE BODY P_TEST_ASP AS
    FUNCTION test_asp_1 (dti_id in NUMBER)
    RETURN SYS_REFCURSOR AS
    resultCursor SYS_REFCURSOR;
    BEGIN
    OPEN resultCursor FOR select * from emp;
    RETURN resultCursor;
    END test_asp_1;
    END P_TEST_ASP;
    >
    Now my Problem is that I do not know how to get the cursor's rowtype to assign it to the collection:
    I Managed to access the cursor when I set the rowtype of my collection res to emp%rowtype.
    >
    set serveroutput on
    DECLARE
    type        testtype is TABLE OF emp%rowtype;
    myCursor SYS_REFCURSOR;
    res testtype;
    BEGIN
    -- Get ref cursor from function
    myCursor := p_test_asp.test_asp_1(9);
    FETCH myCursor BULK COLLECT into res;
    dbms_output.put_line('Value from cursor:' );
    CLOSE myCursor;
    END;
    >
    But that will not work with the final statement.
    I would like to set the rowtype to myCursor%rowtype -> But I don't know how to do it:
    >
    set serveroutput on
    DECLARE
    type        testtype is TABLE OF myCursor%rowtype;
    myCursor SYS_REFCURSOR;
    res testtype;
    BEGIN
    -- Get ref cursor from function
    myCursor := p_test_asp.test_asp_1(9);
    FETCH myCursor BULK COLLECT into res;
    dbms_output.put_line('Value from cursor:' );
    CLOSE myCursor;
    END;
    >
    this statement throws the following errors:
    Fehlerbericht:
    ORA-06550: line 2, column 36:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 2, column 3:
    PL/SQL: Item ignored
    ORA-06550: line 11, column 36:
    PLS-00597: expression 'RES' in the INTO list is of wrong type
    ORA-06550: line 11, column 3:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    Edited by: Andreas S. on 13.12.2011 04:56

    Why do you want to use a collection? I dont see any need for that.
    Lets say your client is SQL Plus. SQL Plus provides a API called PRINT that prints the cursor. You can use that.
    SQL> var rc refcursor
    SQL>
    SQL> exec open :rc for select level from dual connect by level <= 10;
    PL/SQL procedure successfully completed.
    SQL> print rc
         LEVEL
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.
    SQL>Like wise whatever is your client use the correct API that offers to handle cursors.

  • How to get query text from reference cursor

    Oracle 9.2.0.5
    create or replace procedure test3
    is
       lcur sys_refcursor;
       lquery varchar2(2000);
    begin
       OPEN lcur FOR
          SELECT CONTRACT_ID FROM CONTRACT;
       lquery := lcur.Query;     -- <= Pseudocode           
    end;Basically, if someone passes a reference cursor, how can I get the "text" of the cursor. I want to pass it to DBMS_DESCRIBE.PARSE...so that I eventually call DBMS_SQL.DESCRIBE_COLUMNS.
    Thanks,
    Jason

    Do you have a code example?
    Ideally, I'd like to use Pl/SQL only, but if I have to do it in Java, I will.
    Thanks,
    Jason

  • How to get values from a ref cursor in a procedure

    I have a procedure that returns a cursor type of values, but I cannot get the values.
    I got error when on how to define the output cursor. Could someone please look at the code and tell me how to correct it?
    Thanks in advance.
    ******************************8
    --This is the package
    CREATE OR REPLACE PACKAGE Test_SECURITY2 as
    type T_RoleTest is ref cursor;
    Procedure P_GetUserRole(userID in number, p_cur out T_RoleTest);
    end;
    CREATE OR REPLACE PACKAGE BODY Test_SECURITY2 as
    Procedure P_GetUserRole(userID in number, p_cur out T_RoleTest) as
    begin
         open p_cur for
         select PREO_Role.ROLE_ID,PREO_Role.ROLE_NAME
         from preorder.PREO_Role, preorder.PREO_User_Role
         where PREO_Role.Role_id = PREO_User_Role.Role_id
         and PREO_User_Role.user_id = userid;
    end;
    end;
    --This is the testing code. I got error here
    SQL> set serveroutput on;
    SQL> execute dbms_output.enable;
    PL/SQL procedure successfully completed.
    SQL> declare
    2 type T_RoleTest is ref cursor;
    3 V_UserRole is ref cursor; --how to define the output cursor
    4 v_userId number := 42;
    5 V_Role_Id number;
    6 v_Role_name varchar2(20);
    7 begin
    8 Test_SECURITY2.P_GetUserRole(v_userId, V_UserRole);
    9
    10 open V_UserRole;
    11 loop
    12 fetch V_UserRole into V_Role_Id, v_Role_name;
    13
    14 EXIT WHEN V_UserRole%NOTFOUND;
    15 dbms_output.put_line('RoleID'||v_Role_ID);
    16 dbms_output.put_line('Rolename'||v_Role_name);
    17
    18 end loop;
    19
    20 end;
    21 /
    V_UserRole is ref cursor;
    ERROR at line 3:
    ORA-06550: line 3, column 13:
    PLS-00103: Encountered the symbol "IS" when expecting one of the following:
    constant exception <an identifier>

    declare
      type T_RoleTest is ref cursor;
      v_UserRole T_RoleTest;or just:
    declare
      v_UserRole  Test_Security2.T_RoleTest;And, if you are on 9i or later, you can just use the built-in sys_refcursor type.

  • How to get SQL text from dbms_sql cursor ID

    Hello,
    I have a progam using dbms_sql. A cursor is built by dbms_sql.parse (cur_id, v_query, dbms_sql.native);From now on I have only the internal ID cur_id of the cursor. Is there a way to get back the original query the cursor is built from when the cursor is passed to another package?
    Regards
    Marcus

    Oracle provides several views that show part or all of the SQL statement. See your Oracle version# Reference manual for v$sql...
    v$sqltext is one view that displays the full text but the text is contained in multiple rows.
    HTH -- Mark D Powell --

  • AS3: TextField - How do get rid of text select cursor

    SC3 - AS3
    How do we turn off the text select cursor?
    I have a button object that has dynamic text, and the hand
    cursor works fine outside of the text object but over the text
    object the cursor is changing to a text select cursor!
    I am setting selectable to false for the text field.

    Is your dynamic text field part of a button? I just created a
    test file with a dynamic text field set to not selectable and it is
    not showing the text cursor.
    Also, are you dynamically generating the text field or are
    you drawing it on the stage?

  • How to get cumulative in reports

    Hi There..
    I am supposed to get the following format.
    The Data which I retrieved frm the query is
    'a' and 'Total'.For 'Cumulative Total' I have to get it frm 'a' and 'total'.....
    I hope u guys got the point...
    a Total Cumulative Total
    a100 100 0
    150 250
    200 450
    a101 50 0
    100 150
    40 190
    and so on....
    I don't know how to get the value stored in cursor and then get the cumulative...
    I will be very grateful if u guys help me out of these....
    Thanx for ur time,
    sharad

    I guess the table which i have drawn is confusing.
    it is like this
    a100 100 0
    150 250
    200 450
    a101 50 0
    100 150
    40 190
    bye
    null

  • How to get the number of rows in a DB-Cursor

    When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
    Please help!
    Thanx a lot

    In order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
    select count(*) over() as row_count, <rest of your columns> FROM <your table>
    which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
    Have a look on asktom for some very usefull info about all this.
    HTH

  • How to get information about cursor? I had only a reference on it.

    Hello
    How to get information about cursor, that I receive in my procedure as a reference. For example I need to know, a number of columns. I know nothing about this cursor, except the link on it.
    Best Regards, Kostya Proskudin!

    However, I would seriously reconsider what you are trying to achieve.
    It looks like you are trying to write some ultimately generic cursor processor. i.e. pass any cursor and process it in some generic way.
    Good design should include knowledge of what is expected to be passed and that knowledge can be put into the code.
    Generic code is inherently difficult to maintain and debug and will never 100% deal with all possible situations e.g. even if you know the table being queried in the cursor you can't rely on the data dictionary to give you all the returned columns if some of the returned columns of the cursor are computed columns.
    Be careful you aren't writing something that's going to cause problems later.

  • How to get the plsql table data into output cursor

    Hi,
    Could anybody please help me.
    Below is an example of the scenario..
    CREATE OR REPLACE PACKAGE chck IS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
    TYPE get_rec is record (ename varchar2(20),
    eno number(12));
    TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
    emp_tab t_recs;
    END chck;
    CREATE OR REPLACE PACKAGE BODY chck AS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
    is
    BEGIN
    select ename, eno
    bulk collect into emp_tab
    from emp;
    open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
    END;
    END chck;
    the above package is giving me an error:
    LINE/COL ERROR
    10/29 PL/SQL: SQL Statement ignored
    10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
    item
    let me know what needs to be changed
    Thanks
    Manju

    manjukn wrote:
    once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
    It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
    It is an extremely primitive structure - and should never be confused as being just like a table.
    Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it.

  • Quick doubt.. from cursor vairable how to get into page vairable

    Hello
    i am creating an apex page where i have 2 regions. From the Top region stores all fields entered into the bottom region
    Text fields like first name and last name and address fields are in region 2(bottom).After region 2, i have a add person button.
    Once i click add person, that person will get into top i.e region 1.
    Now, Region 1 got person1 first name ,last name
    person2, first name,last name
    etc..
    I am not able to display like p1_first_name,p1_laast_name as the list is not stable..it is growing and not showing the person who already got saved..I can retrieve them from DB using a cursor..But from cursor vairable how to get into page vairable..
    appreciate ur help..
    kp

    Your explanation is not good enough. You have to make a better description of your problem or create an example at apex.oracle.com.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to get the cursor position in the text edit box?

    Hi, all.
    I want to get the cursor position in the text edit box
    to insert some data.
    But I don't know how to get.
    Can someone give me some advice?
    BestRegard.
    Miya.

    Hi Miya,
    Write your own textSelectionSuite for this.
    and use ITextTarget->GetRange() function.
    Thanks and Regards,
    Yopangjo.

  • I have a problem mackeeper keep opening up another tab and these little green circle stuff keep popping up on the page and overtime my cursor hover over it it pops up a little box with stuff in it does anyone have an idea how to get rid of it?

    i have a problem mackeeper keep opening up another tab and these little green circle stuff keep popping up on the page and overtime my cursor hover over it it pops up a little box with stuff in it does anyone have an idea how to get rid of it?

    You installed a variant of the "VSearch" trojan. Remove it as follows.
    This malware has many variants. Anyone else finding this comment should not expect it to be applicable.
    Back up all data before proceeding.
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.2c232f1e4d12129e.agent.plist
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.2c232f1e4d12129e.daemon.plist
    /Library/LaunchDaemons/com.2c232f1e4d12129e.helper.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/2c232f1e4d12129e
    /System/Library/Frameworks/v.framework
    The trouble may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
    This trojan is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow. Never install any software that you downloaded from a bittorrent, or that was downloaded by someone else from an unknown source.
    In the Security & Privacy pane of System Preferences, select the General tab. The radio button marked Anywhere  should not be selected. If it is, click the lock icon to unlock the settings, then select one of the other buttons. After that, don't ignore a warning that you are about to run or install an application from an unknown developer.
    Then, still in System Preferences, open the App Store or Software Update pane and check the box marked
              Install system data files and security updates (OS X 10.10 or later)
    or
              Download updates automatically (OS X 10.9 or earlier)
    if it's not already checked.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

Maybe you are looking for

  • Moving activities from one track to another

    Hi, I was wondering whether it's possible to move activities (not activated nor transported yet) from one track to another. Here's our setup: Project is divided into 2 phases: Phase A is completed developed - Still waiting for the results of UAT. Pha

  • Display enlarged after connecting to projector

    Connected my iMac G5 to a projector for a slide show - the image onscreen enlarged while connected...but now disconnected, won't revert to normal size...any ideas what I can do please? Thanks a lot!

  • Multi language not supporting while create pdf report

    When we click on print button its creating xml file successfully in multi language for the template and its generating report in html and rtf formats.. when we try for pdf its not showing correct format...also its creating pdf when we try with bi pub

  • Problem With Alert Category SCM EM 5.0

    I have just updated my EM 4,0 to 5,0 and I have problems with the categories of alert, in the part of messages by mail. I do it correctly when configuring them like was doing it in the version 4 declaring in the containers the name of the paraameter

  • Virtuoso package

    why do i need virtuoso (soprano dependency):      A scalable cross-platform server that combines SQL/RDF/XML Data Management with Web Application Server and Web Services Platform functionality on the laptop that is used as a basic tool with kde DE? v