[b]HELP-Accessing REF CURSOR (select *   from *) from OCI[/b]

I have a stored procedure that returns a weak REF CURSOR as an out parameter. I want to access the rows that are returned, in an OCI application. I want a sample OCI program that does this. The PL/SQL code is as follows
PACKAGE TEST_PACKAGE AS
TYPE RCT IS REF CURSOR;
END;
PROCEDURE TEST_PROCEDURE (R OUT TEST_PACKAGE.RCT)
AS
BEGIN
OPEN r FOR
SELECT * FROM XXX;
END;
THANKS.

Hello,
I used in my application regular connections, I created
CallableStatement with these connections, later I got one cursor with:
mr = ((OracleCallableStatement)cstmt).getCursor(1)
where mr is ResultSet and cstmt is CallableStatement.
But, when I use the Commerce PoolConnection I get serialConnection
and it creates serialCallableStatement and the command:
mr = ((OracleCallableStatement)cstmt).getCursor(1)
get the next exception:
java.lang.ClassCastException:
weblogic.jdbc20.rmi.SerialCallableStatement at......
Are you working with Bea ConnectionPool
or regular Connections?
Thank you.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Matt Sivertson ([email protected]):
I'm having a very strange problem with some JDBC code. Basically, there is a StoredProcedure in the DB that we call through JDBC. One of the out parameters is a REF CURSOR. My user does not have select access to the table, but the stored procedure does. When I try and get the ResultSet corresponding to that RefCursor using the OracleCallableStatement.getCursor() method, and exception gets thrown saying it cannot find the table. We checked on the database, and it is actually performing a new select statement as My user, rather than as the StoredProcedure. If we open up the permissions on the table, everything works fine, but this defeats the whole purpose of what the DBA wants.
BTW, this same Stored Procedure works when fine when accesed through PL/SQL or SQL+. Only JDBC seems to have a problem with it. Any help is greatly appreciated.
Matt Sivertson
[email protected]<HR></BLOCKQUOTE>
null

Similar Messages

  • Is Ref Cursor Supported in Froms 10g . If not is there any built-ins

    Hi Experts,
    I need to use ref cursor in my from 10g. My cursor query should be dynamically append the "where clause column name". Hence I used the dynamic query with ref cursor.
    But my problem is , when I compile the form it gives error "this feature is not supported in clinet-side programs'
    Is there any solution for this in forms?
    Will "EXEC_SQL" package works.
    Is there any alternative other than writing pl/sql refcursor....
    Thanks
    Jana

    There are only strong ref cursors allowed in forms (they are not dynamic). you can use exec_sql in forms, or you can use a record group to do dynamic sql. Third option would be to write a database procedure where you can make use ref cursors.
    regards

  • Help in OPen Cursor select

    Hi,Anyone please help me in this code to rectify errors

    Hi,
    DECLARE
      ERRBUF VARCHAR2(200);
      RETCODE NUMBER;
      P_FROMDATE DATE;
      P_TODATE DATE;
      X_RETURN_STATUS VARCHAR2(200);
      X_MSG_COUNT NUMBER;
      X_MSG_DATA VARCHAR2(200);
    BEGIN
    --  P_FROMDATE :='2010-02-01';
    --  P_TODATE :='2010-03-20';
      XXTNT_CSD_CREATEORDER.SUBMIT_CREATE_ORDER(
        P_FROMDATE => '01-FEB-2010',
        P_TODATE => '20-MAR-2010',
        X_RETURN_STATUS => X_RETURN_STATUS,
        X_MSG_COUNT => X_MSG_COUNT,
        X_MSG_DATA => X_MSG_DATA
    --  DBMS_OUTPUT.PUT_LINE('ERRBUF = ' || ERRBUF);
    --  DBMS_OUTPUT.PUT_LINE('RETCODE = ' || RETCODE);
      DBMS_OUTPUT.PUT_LINE('X_RETURN_STATUS = ' || X_RETURN_STATUS);
      DBMS_OUTPUT.PUT_LINE('X_MSG_COUNT = ' || X_MSG_COUNT);
      DBMS_OUTPUT.PUT_LINE('X_MSG_DATA = ' || X_MSG_DATA);
    END;
    before header query..
    after header query..
    X_RETURN_STATUS = S
    X_MSG_COUNT =
    X_MSG_DATA = why the code is executing up to that line
    PROCEDURE submit_Create_order(--errbuf OUT VARCHAR2,
                                    --retcode OUT NUMBER,
                                    p_fromDate IN date,
                                    p_toDate IN date,
                                    x_return_status OUT NOCOPY VARCHAR2,
                                    x_msg_count OUT NOCOPY     NUMBER,
                                    x_msg_data OUT NOCOPY      VARCHAR2) as
    CURSOR C_GET_HDR_DATA (p_fromDate IN date,p_toDate IN date)
                                            IS
        SELECT A.TRACKING_NUMBER,
          B.CUST_ACCOUNT_ID,
          B.PARTY_ID,
          A.INCIDENT_NUMBER,
          C.INCIDENT_ID,
          A.CUST_PO_NUMBER,
          A.SHIP_METHOD_CODE,
          A.CARRIER_NAME,
          A.CREATION_DATE
        FROM XXTNT_CSD_INBOUND_TRACKING A,
          HZ_CUST_ACCOUNTS B,
          CS_INCIDENTS_ALL C
        WHERE A.CREATION_DATE between to_date(p_fromDate,'DD-MON-YYYY')
        AND to_date(p_toDate,'DD-MON-YYYY')
        AND B.ACCOUNT_NUMBER(+)    = A.ACCOUNT_NUMBER
        --AND a.source='external'
        AND A.INCIDENT_NUMBER   = C.INCIDENT_NUMBER(+)
        AND EXISTS
          (SELECT 'x'
          FROM xxtnt_csd_inbound_ord_lines_b C
          WHERE C.TRACKING_NUMBER = a.tracking_number
          AND repair_line_id     IS NULL
      l_hdr_rec         ORDER_HDR_REC;
      l_lines_Tbl       ORDER_LINE_REC_TBL;
      l_lines_tbl_tbl   ORDER_LINE_REC_TBL_TBL;
      l_index           NUMBER;
      l_ret_status      VARCHAR2(10);
      l_msg_count       NUMBER;
      l_incident_number VARCHAR2(64);
      l_incident_id     NUMBER;
      l_msg_data        VARCHAR2(2000);
      l_api_name        CONSTANT VARCHAR2(30) := 'submt_Create_order';
      l_curr_po         VARCHAR2(80);
      l_prev_po         VARCHAR2(80);
      l_hdr_po          VARCHAR2(80);
      l_super_index     NUMBER;
      l_super_index1    NUMBER;
      l_line_count      NUMBER;
      l_tracking_num varchar2(80);
      TYPE c_Get_Line_data IS REF CURSOR;
      r_Get_Line_data c_Get_Line_data;
    BEGIN
      SAVEPOINT submit_Create_Order;
      x_return_status             := FND_API.G_RET_STS_SUCCESS;
      IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
        fnd_log.STRING (fnd_log.level_procedure, 'CSD.PLSQL.XXTNT_CSD_CREATEORDER.SUBMIT_CREATE_ORDER.BEGIN', 'Enter - Submit_Create_order');
      END IF;
      --mo_global.set_policy_context('S', 81);
        dbms_output.put_line('before header query..');
      OPEN C_GET_HDR_DATA (p_fromDate,p_toDate) ;
      FETCH C_GET_HDR_DATA
      INTO l_hdr_Rec.Tracking_number,
        l_hdr_Rec.cust_account_id,
        l_hdr_Rec.party_id,
        l_hdr_Rec.incident_number,
        l_hdr_Rec.incident_id,
        l_hdr_rec.Customer_po_number,
        l_hdr_rec.SHIP_METHOD_CODE,
        l_hdr_Rec.CARRIER_NAME,
        l_hdr_Rec.CREATION_DATE;
        l_tracking_num :=l_hdr_Rec.Tracking_number;
        *dbms_output.put_line('after header query..');*
      CLOSE C_GET_HDR_DATA;
      IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
        fnd_log.STRING (fnd_log.level_statement, 'CSD.PLSQL.XXTNT_CSD_CREATEORDER.SUBMIT_CREATE_ORDER', 'trackingnumber['||l_hdr_Rec.Tracking_number||']');
        fnd_log.STRING (fnd_log.level_statement, 'CSD.PLSQL.XXTNT_CSD_CREATEORDER.SUBMIT_CREATE_ORDER', 'cust_account['||l_hdr_Rec.cust_account_id||']');
        fnd_log.STRING (fnd_log.level_statement, 'CSD.PLSQL.XXTNT_CSD_CREATEORDER.SUBMIT_CREATE_ORDER', 'party_id['||l_hdr_Rec.party_id||']');
      END IF;
      IF( l_hdr_rec.tracking_number IS NOT NULL) THEN
        l_index                     := 1;
        l_super_index               := 1;
        l_prev_po                   := nvl(l_hdr_rec.customer_po_number,'0');
        l_hdr_po                    := nvl(l_hdr_rec.customer_po_number,'0');
        l_super_index1              := 1;
        l_line_count                := 0;
        dbms_output.put_line('before  line query loop..');
        Open r_Get_Line_data for
    SELECT A.ORDER_LINE_ID ORDER_LINE_ID, A.CUSTOMER_REF_NUMBER CUSTOMER_REF_NUMBER,
                  A.INVENTORY_ITEM_ID INVENTORY_ITEM_ID, A.SERIAL_NUMBER SERIAL_NUMBER,
                  A.UNIT_OF_MEASURE UNIT_OF_MEASURE,
                  A.repair_type_id repair_type_id, A.REPAIR_ORG_ID REPAIR_ORG_ID,
                  A.WARRANTY_FLAG WARRANTY_FLAG, A.WARRANTY_EXP_DATE WARRANTY_EXP_DATE,
                  A.VENDOR_WARRANTY_FLAG VENDOR_WARRANTY_FLAG, A.VENDOR_WARRANTY_EXP_DATE VENDOR_WARRANTY_EXP_DATE,
                  A.PRIMARY_VENDOR PRIMARY_VENDOR, A.SECONDARY_VENDOR SECONDARY_VENDOR,
                  A.NORTEL_WARRANTY_FLAG NORTEL_WARRANTY_FLAG, A.NORTEL_WARRANTY_EXP_DATE NORTEL_WARRANTY_EXP_DATE,
                  A.SCRAP_DEFECTIVE_ITEM SCRAP_DEFECTIVE_ITEM, A.INVENTORY_ORG_ID INVENTORY_ORG_ID,
                  A.SUB_INVENTORY SUB_INVENTORY, B.INCIDENT_ID INCIDENT_ID,
                  A.repair_quantity repair_quantity, a.problem_description problem_description,
                  a.same4same_flag, A.CTRACS_CONTRACT_FLAG CTRACS_CONTRACT_FLAG,
                  A.CONTRACT_LINE_ID CONTRACT_LINE_ID, nvl(A.CUST_PO_NUMBER, C.CUST_PO_NUMBER) CUST_PO_NUMBER,
                  A.REV_IN,  A.WARRANTY_QUANTITY FROM xxtnt_csd_inbound_ord_lines_vl A,
                  CS_INCIDENTS_ALL B,  XXTNT_CSD_INBOUND_TRACKING C 
                  WHERE A.TRACKING_NUMBER = l_tracking_num
                   AND A.INCIDENT_NUMBER   = B.INCIDENT_NUMBER(+)
                   AND A.REPAIR_LINE_ID is NULL AND nvl(A.DISCREP_FLAG,'N') != 'Y'
                   AND C.TRACKING_NUMBER = A.TRACKING_NUMBER ORDER BY CUST_PO_NUMBER;
        LOOP
          l_line_count := l_line_count + 1;
          l_curr_po := nvl(l_lines_tbl_tbl(l_super_index)(l_super_index1).CUSTOMER_PO_NUMBER,l_hdr_po);
          if(l_curr_po <> l_prev_po) then
               if(l_super_index1 <> 1) then
                    l_super_index := l_super_index +1;
                    l_super_index1 := 1;
               end if;
               l_prev_po     := l_curr_po;
          end if;
    FETCH r_Get_Line_data INTO
         l_lines_tbl_tbl(l_super_index)(l_super_index1).LINE_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).CUSTOMER_REF_NUMBER,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).INVENTORY_ITEM_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).SERIAL_NUMBER,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).UNIT_OF_MEASURE,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).repair_type_id,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).REPAIR_ORG_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).TELMAR_WARRANTY_FLAG,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).TELMAR_WARRANTY_EXP_DATE,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).VENDOR_WARRANTY_FLAG,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).VENDOR_WARRANTY_EXP_DATE,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).PRIMARY_VENDOR,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).SECONDARY_VENDOR,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).NORTEL_WARRANTY_FLAG,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).NORTEL_WARRANTY_EXP_DATE,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).SCRAP_DEFECTIVE_ITEM,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).INVENTORY_ORG_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).SUB_INVENTORY,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).INCIDENT_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).repair_quantity,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).problem_description,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).s4s_flag,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).CTRACS_CONTRACT_FLAG,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).CONTRACT_LINE_ID,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).CUSTOMER_PO_NUMBER,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).REV_IN,
                    l_lines_tbl_tbl(l_super_index)(l_super_index1).WARRANTY_QUANTITY;
          l_super_index1                                := l_super_index1 + 1;
        END LOOP;
        dbms_output.put_line('after  line query loop..');

  • Help on REF Cursors

    Hi Folks,
    When i try to run the following piece of code i get errors saying :
    PLS-0221 : emp_cursor is not a procedure or is undefined
    PLS-00382 : expression is of the wrong type
    can you please help me figure out what is going wrong here ?
    Thanks very much in advance.
    Moses.
    declare
    /* REF Cursor for employee */
    emp_rec employee%ROWTYPE;
    TYPE EmpCurTyp IS REF CURSOR RETURN emp_rec%TYPE;
    emp_cursor EmpCurTyp;
    emp_id NUMBER;
    cursor dept_cursor is
    select distinct dept_id from dept;
    dept_rec dept_cursor%ROWTYPE;
    dep_id VARCHAR2(20);
    begin
    /* dept loop */
    for dept_rec in dept_cursor
    loop
    dep_id := dept_rec.dept_id;
    /* get employees for this dept */
    OPEN emp_cursor FOR
    select distinct emp_id from employee
    where dept_id = dep_id;
    /* employee loop */
    for emp_rec in emp_cursor
    loop
    emp_id := emp_rec.employee_id;
    '

    Hi Moses,
    looking at Yr code, I guess that the problem may be that You OPEN emp_cursor and after that You reopen the same cursor with the FOR statement.
    Try rewriting the LOOP in this way:
    OPEN emp_cursor FOR
    SELECT DISTINCT emp_id
    FROM employee
    WHERE dept_id = dep_id;
    FETCH emp_cursor INTO emp_record
    WHILE emp_cursor%FOUND
    LOOP
    -- Yr code here
    FETCH emp_cursor INTO emp_record;
    END LOOP;
    CLOSE emp_cursor;You can also convert the usage of the REF syntax using cursor variables.
    Hope thi helps
    Bye Max
    null

  • Need Help: Using Ref Cursor in ProC to call a function within a Package

    I'm calling a function within a package that is returning a REF CURSOR.
    As per the Oracle Pro*C Programmer's Guide, I did the following:
    1) declared my cursor with a: EXEC SQL BEGIN DECLARE SECTION and declared the cursor as: SQL_CURSOR my_cursor;
    2) I allocated the cursor as: EXEC SQL ALLOCATE :my_cursor;
    3) Via a EXEC SQL.....END-EXEC begin block
    I called the package function and assign the return value to my cursor
    e.g. my_cursor := package.function(:host1, :host2);
    Now, the only difference between my code and the example given in the Pro*C Programmer's Guide is that the example calls a PROCEDURE within a package that passes back the REF CURSOR as an OUT host variable.
    Whereas, since I am calling a function, the function ASSIGNS the return REF CURSOR in the return value.
    If I say my_cursor := package.function(:host1, :host2); I get a message stating, "PLS-00201: identifier MY_CURSOR" must be declared"
    If I say :my_cursor := package.function(:host1, :host2); I get a message stating, "ORA-01480: trailing null missing from STR bind value"
    I just want to call a package function and assign the return value to a REF CURSOR variable. There must be a way of doing this. I can do this easily in standard PL/SQL. How can this be done in Pro*C ???
    Thanks for any help.

    Folks, I figured it out. For those who may face this problem in the future you may want to take note for future reference.
    Oracle does not allow you to assign the return value of a REF CURSOR from a FUNCTION ( not Procedure - - there is a difference) directly to a host variable. This is the case even if that host variable is declared a CURSOR variable.
    The trick is as follows: Declare the REF CURSOR within the PL/SQL BEGIN Block, using the TYPE statement, that will contain the call to the package function. On the call, you then assign the return REF CURSOR value that the function is returning to your REF CURSOR variable declared in the DECLARE section of the EXEC SQL .... END-EXEC PL/SQL Block.
    THEN, assign the REF CURSOR variable that was populated from the function call to your HOST cursor varaible. Then fetch this HOST Cursor variable into your Host record structure variable. Then you can deference individual fields as need be within your C or C++ code.
    I hope this will help someone facing a deadline crunch. Happy computing !

  • Best practice: bulk update (inverse of REF CURSOR SELECT)??

    To move data from the database to the application, there are REF CURSORS. However, there is no easy way to move updates/inserts from a dataset back to the database.
    Could someone provide some guidelines or simple examples of how to do bulk updates (and I'm talking multiple columns for multiple rows).
    I guess the way to go is arraybind. Are there any guidelines on how to handle them in .Net and PL/SQL ?

    You don't use the DECLARE keyword when defining stored procedures. The IS/ AS keyword is what you use instead.
    CREATE OR REPLACE PROCEDURE TEST_REF
    IS
      TYPE REF_EMP IS REF CURSOR RETURN EMPLOYEES%ROWTYPE;
      RF_EMP REF_EMP;
      V_EMP EMPLOYEES%ROWTYPE;
    BEGIN
      DBMS_OUTPUT.ENABLE(1000000);
      OPEN RF_EMP FOR
        SELECT *
          FROM EMPLOYEES
         WHERE EMPLOYEE_ID > 100;
      FETCH RF_EMP INTO V_EMP;
      DBMS_OUTPUT.PUT_LINE(V_EMP.FIRST_NAME || ' ' || V_EMP.LAST_NAME);
      CLOSE RF_EMP;
    EXCEPTION
      WHEN OTHERS
        THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END TEST_REF;will compile. It seems a bit odd that you are opening a cursor and only fetching the first row from it. I would tend to suspect that you want to loop over every row that is returned.
    Justin

  • Need help with Ref Cursor

    Dear All,
    Version : '11.2.0.2.0'
    I have a procedure which gets called from a screen ( on .Net) if use pushes a particular button.
    The procedure takes 15 minutes to complete.
    My requirement is to intimate the front end(.Net) as soon as the procedures gets called successfully without waiting for its completion as it is going to take 15 mins.
    The reason being, the front end will popup a message saying that " The process is going to take long time, A mail will be sent to u after its completion"  once it has been intimated that the procedure has been called successfully.
    Could you please suggest can i return a cursor to front end without even manipulating the data.
    i hope my question is understandable.

    9876564 wrote:
    Dear All,
    Version : '11.2.0.2.0'
    I have a procedure which gets called from a screen ( on .Net) if use pushes a particular button.
    The procedure takes 15 minutes to complete.
    My requirement is to intimate the front end(.Net) as soon as the procedures gets called successfully without waiting for its completion as it is going to take 15 mins.
    The reason being, the front end will popup a message saying that " The process is going to take long time, A mail will be sent to u after its completion"  once it has been intimated that the procedure has been called successfully.
    Could you please suggest can i return a cursor to front end without even manipulating the data.
    i hope my question is understandable.
    It seems to me that your problem is not an Oracle one, but a user interface one.
    I'm assuming the slowness of the procedure is due to how long it's taking to query the data, and if you can't speed that up then, to have the procedure return a ref cursor, the connection between the front end and the procedure must be maintained (the process on Oracle must belong to a session, and the front end needs to be connected to that session).
    So, you can't have Oracle go off and start a seperate process and then pass back the ref cursor when it's finished, because even though you can spawn off seperate processes such as using DBMS_JOB or DBMS_SCHEDULER, they will run in their own 'session' and the calling code won't keep a hold on any of those sessions... they're effectively stand-alone and seperate.
    What you'll have to do is likely get your .net application to spawn off a child process to the main app, that presents the message saying it'll take some time, does the call to Oracle and waits for Oracle to return the resultant ref cursor, which it can then pass back to the main application etc.  Due to .net allowing for multi-tasking, that is where the split processing should take place.

  • Need help about ref cursor using like table

    Hi Guys...
    I am devloping package function And i need help about cursor
    One of my function return sys_refcursor. And the return cursor need to be
    join another table in database . I don't have to fetch all rows in cursor
    All i need to join ref cursor and another table in sql clause
    like below
    select a.aa , b.cc form ( ref_cursor ) A, table B
    where A.dd = B.dd
    I appeciate it in advance

    My understanding is that you have a function that returns a refcursor and is called by a java app.
    Because this is a commonly used bit of code, you also want to reuse this cursor in other bits of sql and so you want to include it like table in a bit of sql and join that refcursor to other tables.
    It's not as easy as you might hope but you can probably achieve this with pipelined functions.
    Is it a direction that code should be going down? yes, eventually. I like the idea of pulling commonly used bits of code into a SQL statement especially into the WITH section, provided it could be used efficiently by the CBO.
    Is it worth the effort given what you have to do currently to implement it? possibly not.
    what else could you do? construct the sql statement independently of the thing that used it and reuse that sql statement rather than the refcursor it returns?
    Message was edited by:
    dombrooks

  • [Help Accessing External usb 1TB HD from windows 7 on Imac with Lion]

    Hello to everyone, i would like some help and im not finding any solution on how to solve the problem. I upgraded from snow leopard to Lion, where i could share without any problem every file on mac hd or the external hd, no problems at all. Now using osx lion and its such a headache to share anything, i created a "sharing only" account and added it on the "file sharing" after enable "Share files and folders using SMB".
    Now the problem is, i went to the "+" add button on the "Shared Folders" and added all folders there that i would like to use from my windows 7 PC, i can access everything that is on the macintosh HD, but i cant access anything that is on my external HD. I dont know if this information is relevant but im using paragon ntfs 9.0.5 to manage the use of the external ntfs HD. I tried "Apply permissions to enclosed items" on every user listed for the folders i want to access, but it didnt help either.
    Thanks in advance.

    Holding alt key does bring up the choices, but I never see the bootable USB or external DVD drive as options... I only see the 2 partitions - the main iMac and the partition created by Bootcamp to install windows.

  • Time Capsule:  Need help accessing my video surveillance DVR from the Internet.

    I am using the latest 4th Generation Time Capsule attached to a DSL Modem.  My 4 video Survilance DVR is connected to a switch then to the Time Capsule.  How or what is needed to be able to access the DVR via the internet.  I am able to access the DVR from within the home network only.  Would appreciate some guidance.
    Thanks in advance.

    Is the modem bridged?
    If not and working in router mode then the TC should be bridged.. this will never work if you have double NAT.
    Whichever box is the main router will need to forward the required ports for the camera dvr.. does the software use port 80 ie html?? That means you just forward port 80 to the IP address of the dvr. But find out the port.. the dvr instructions should tell you. Port forwarding on the TC.. ain't hard.. just google for the instructions. If the dsl modem is router, read its manual.
    You will need to lock the ip of the dvr so it doesn't shift. Do that in the router if possible but I am not sure you can on the TC. You will need to do it on the device using a static ip.
    The other thing is public IP .. do you have a static public address.. if not you will need to run dyndns. this is not available in the TC.. as most things are not available. So you will also need to check the dvr remote access instructions as it might have a dyndns client.. or you will have to use dsl modem as router even if you currently bridge it.
    Sorry this is making it complicated.
    Give some feedback and we can go from there.
    What is the main router?
    What modem is it exactly?
    What make and model is the DVR? A URL to the pdf manual will help if it gets complicated.
    What port do you use to access the DVR?
    Is there a dyndns client in the dvr?

  • Help with building a select box from a query?

    New thread from a topic I started yesterday. From the responses, and a search of other threads, I realized that I was way off base:-) So, I went back and verified that my TomCat setup was alright. After a few tweeks I verified that I could display the index page and successfully run all of the example servlets and jsps. I then built a simple login.jsp and an associated bean to verify a user id and password on an ldap db. That works good. Next, I built a bean which runs a query against the same ldap db and returns a list of last names. What I want to do is use the last names in the bean to populate my select box. At first I was trying to build the html with the list from my bean, i quickly realized you guys didn't like that approach. So, can someone explain, in some detail (because I'm really dense), just how I can return the values from my bean and build a select box with those values.
    regards,
    Mat
    BTW Gone to see Lord of The Rings...back in about 5 hours :-)

    Just in general, I prefer knowing how to do things the "old-fashioned way" first before using other tools, because if it comes time for you to take over someone else's code, you'll probably find that they did it the old way and you'll want to understand that. Further, the new ways are based on the old ways for many things.
    Struts is a good system, but unless you have some understanding of the basics, it's probably going to be harder to understand it. If you have the time, I'd say at least go thru one book on JSP/servlets (which should be all about the basics, maybe a slightly older book) and go thru the examples in it.

  • Stored procedure call with REF CURSOR from JDBC

    How can I call a SP with a REF CURSOR OUT parameter from JDBC?

    This is a breeze.
    CallableStatement oraCall = oraConn.prepareCall("BEGIN PKG_SOMETHING.RETURNS_A_SP(?);END;");
    oraCall.registerOutParameter(1,oracle.jdbc.driver.OracleTypes.CURSOR);
    oraCall.execute();
    ResultSet rsServList = (ResultSet) oraCall.getObject(1);
    ... use ResultSet ...
    rsServList.close();
    oraCall.close();
    slag

  • How to pass PL/SQL ref cursor to Access DB

    We have a package in Oracle with a stored procedure in it. This procedure has a ref cursor that returns a value from table in Oracle.
    How can we pass this ref cursor to our tables in Access?

    The same way you pass any other parameter to Access. I don't know enough enough about Access to answer the specific question, but you'll find oodles of samples for working with ref cursors and ODBC/ASP/OCI/MFC over at Tom Kyte's place.
    Cheers, APC

  • [Solved] 27.8.4 How to Create a VO on a REF CURSOR - Missing first row

    Searching the forum I found: BC4J - Get one less row from view object.
    Dive into BC4J related  --REF CURSOR (Resultset)
    The first message did not have any answers, and the second had a follow up question - still no answers though - and I thought I would try a different title.
    (This is off topic, but it would be a great help if the search results also displayed the number of replys in the thread. That way, I wouldn't have to view the messages that don't have responses.)
    (This will be deployed on a server that has the ADF for JDeveloper 10.1.2 installed, so using that version of JDeveloper to develop the app.)
    Okay, back to the problem ==>
    I created a VO from a ref cursor, using the manual as a guide. When I run a page that displays a read only table of the view object, I am missing the first row. (Always the first row!) I don't have any order set, and if I call the ref cursor in a Java program for testing, I see all rows and the count is correct.
    One other point, when I call the page, I get the following validation error:
    Validation Error
    You must correct the following error(s) before proceeding:
    * JBO-29000: Unexpected exception caught: java.lang.ClassCastException, msg=null
    * null
    I still see the table, it is just missing the first row of data.
    In my form I have first, previous set, next set , and last
    navigation buttons. If I press last then first, the error goes away. I still don't see the missing row though.
    Any guidance would be appreciated! I can post my code, but it is pretty much the same code in the AdvancedViewObjectExamples.zip in the ViewObjectOnRefCursor example. I just substituted my two package calls (getRefCursor and getRefCursorCount).
    Thanks, Ken

    Went back to a backup copy of the source. Fixed the error. Now I'm back to just not being able to see the first row of data.
    Additional Note: I had removed fields in the display. Once I truncated the ps_txn table in the schema defined by the model, the data would display (Still without the first record.)
    Are there any examples that are more in depth than the few pages in the developer guide?
    Here is the code for my VOImpl class:
    package newslinearchive.model.datamodel;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.InvalidParamException;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Date;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.QueryCollection;
    import oracle.jbo.server.SQLBuilder;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    // --- Warning: Do not modify method signatures of generated methods.
    public class SearchRefCursorImpl extends ViewObjectImpl {
    * This is the default constructor (do not remove)
    public SearchRefCursorImpl() {
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will PRECEED the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    storeNewResultSet(qc,retrieveRefCursor(qc,params));
    super.executeQueryForCollection(qc, params, numUserParams);
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overridden framework method.
    * The role of this method is to "fetch", populate, and return a single row
    * from the datasource by calling createNewRowForCollection() and populating
    * its attributes using populateAttributeForRow().
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    // populateAttributeForRow(r,0, rs.getLong(1));
    // populateAttributeForRow(r,1, rs.getString(2));
    // populateAttributeForRow(r,2, rs.getString(3));
    // MASTERID NOT NULL NUMBER
    populateAttributeForRow(r,0, rs.getBigDecimal(1));
    //ID NOT NULL NUMBER
    populateAttributeForRow(r,1, rs.getBigDecimal(2));
    // CAID NOT NULL NUMBER
    populateAttributeForRow(r,2, rs.getBigDecimal(3));
    // LANGUAGE NOT NULL VARCHAR2(30)
    populateAttributeForRow(r,3, rs.getString(4));
    // IS_CURRENT_VERSION NOT NULL NUMBER(1)
    populateAttributeForRow(r,4, rs.getBigDecimal(5));
    // FOLDER_ID NOT NULL NUMBER
    populateAttributeForRow(r,5, rs.getBigDecimal(6));
    // FOLDER_REGION_ID NOT NULL NUMBER
    populateAttributeForRow(r,6, rs.getBigDecimal(7));
    // NAME NOT NULL VARCHAR2(256)
    populateAttributeForRow(r,7, rs.getString(8));
    // DISPLAY_NAME VARCHAR2(256)
    populateAttributeForRow(r,8, rs.getString(9));
    // ITEMTYPE NOT NULL VARCHAR2(30)
    populateAttributeForRow(r,9, rs.getString(10));
    // SUBTYPE VARCHAR2(40)
    populateAttributeForRow(r,10, rs.getString(11));
    // SUBTYPE_CAID NUMBER
    populateAttributeForRow(r,11, rs.getBigDecimal(12));
    // PARENT_ITEM_ID NUMBER
    populateAttributeForRow(r,12, rs.getBigDecimal(13));
    // CATEGORY_ID NUMBER
    populateAttributeForRow(r,13, rs.getBigDecimal(14));
    // CATEGORY_CAID NUMBER
    populateAttributeForRow(r,14, rs.getBigDecimal(15));
    // AUTHOR VARCHAR2(50)
    populateAttributeForRow(r,15, rs.getString(16));
    // DESCRIPTION VARCHAR2(2000)
    populateAttributeForRow(r,16, rs.getString(17));
    // PUBLISH_DATE NOT NULL DATE
    populateAttributeForRow(r,17, rs.getDate(18));
    // EXPIREMODE VARCHAR2(90)
    populateAttributeForRow(r,18, rs.getString(19));
    // EXPIRENUMBER NUMBER
    populateAttributeForRow(r,19, rs.getBigDecimal(20));
    // EXPIREDATE DATE
    populateAttributeForRow(r,20, rs.getDate(21));
    // IMAGE VARCHAR2(350)
    populateAttributeForRow(r,21, rs.getString(22));
    // KEYWORDS VARCHAR2(2000)
    populateAttributeForRow(r,22, rs.getString(23));
    // URL VARCHAR2(4000)
    populateAttributeForRow(r,23, rs.getString(24));
    // FILENAME VARCHAR2(350)
    populateAttributeForRow(r,24, rs.getString(25));
    // TEXT CLOB()
    populateAttributeForRow(r,25, rs.getClob(26));
    // FOLDER_LINK_ID NUMBER
    populateAttributeForRow(r,26, rs.getBigDecimal(27));
    // FOLDER_LINK_CAID NUMBER
    populateAttributeForRow(r,27, rs.getBigDecimal(28));
    // ACTIVE NOT NULL NUMBER(1)
    populateAttributeForRow(r,28, rs.getBigDecimal(29));
    // CAN_BE_CHECKEDOUT NUMBER(1)
    populateAttributeForRow(r,29, rs.getBigDecimal(30));
    // IS_ITEM_CHECKEDOUT NUMBER(1)
    populateAttributeForRow(r,30, rs.getBigDecimal(31));
    // CHECKER_USERNAME VARCHAR2(256)
    populateAttributeForRow(r,31, rs.getString(32));
    // CHECKOUT_DATE DATE
    populateAttributeForRow(r,32, rs.getDate(33));
    // FULLSCREEN NOT NULL NUMBER(1)
    populateAttributeForRow(r,33, rs.getBigDecimal(34));
    // INPLACE NOT NULL NUMBER(1)
    populateAttributeForRow(r,34, rs.getBigDecimal(35));
    // CREATEDATE NOT NULL DATE
    populateAttributeForRow(r,35, rs.getDate(36));
    // CREATOR NOT NULL VARCHAR2(256)
    populateAttributeForRow(r,36, rs.getString(37));
    // UPDATEDATE DATE
    populateAttributeForRow(r,37, rs.getDate(38));
    // UPDATOR VARCHAR2(256)
    populateAttributeForRow(r,38, rs.getString(39));
    // SECURITY VARCHAR2(25)
    populateAttributeForRow(r,39, rs.getString(40));
    // VISIBLE NOT NULL NUMBER(1)
    populateAttributeForRow(r,40, rs.getBigDecimal(41));
    // SEQUENCE NOT NULL NUMBER
    populateAttributeForRow(r,41, rs.getBigDecimal(42));
    // CATEGORY_SEQUENCE NOT NULL NUMBER
    populateAttributeForRow(r,42, rs.getBigDecimal(43));
    // AUTHOR_SEQUENCE NOT NULL NUMBER
    populateAttributeForRow(r,43, rs.getBigDecimal(44));
    // CREATE_DATE_SEQUENCE NOT NULL NUMBER
    populateAttributeForRow(r,44, rs.getBigDecimal(45));
    // ITEMTYPE_SEQUENCE NOT NULL NUMBER
    populateAttributeForRow(r,45, rs.getBigDecimal(46));
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    * Overridden framework method.
    * Return true if the datasource has at least one more record to fetch.
    protected boolean hasNextForCollection(Object qc) {
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    * Overridden framework method.
    * The framework gives us a chance to clean up any resources related
    * to the datasource when a query collection is done being used.
    protected void releaseUserDataForCollection(Object qc, Object rs) {
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    * Overridden framework method
    * Return the number of rows that would be returned by executing
    * the query implied by the datasource. This gives the developer a
    * chance to perform a fast count of the rows that would be retrieved
    * if all rows were fetched from the database. In the default implementation
    * the framework will perform a SELECT COUNT(*) FROM (...) wrapper query
    * to let the database return the count. This count might only be an estimate
    * depending on how resource-intensive it would be to actually count the rows.
    public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
    Long result = (Long)callStoredFunction(NUMBER,
    "PORTAL.SEARCH_REFCURSOR.getRefCursorCount",
    viewRowSet.getParameters(true));
    return result.longValue();
    // ------------- PRIVATE METHODS ----------------
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    * new Object[]{getNamedBindParamValue("Email",params)}
    private ResultSet retrieveRefCursor(Object qc, Object[] params) {
    ResultSet rs = (ResultSet)callStoredFunction(OracleTypes.CURSOR,
    "PORTAL.SEARCH_REFCURSOR.getRefCursor",
    null);
    return rs ;
    private Object getNamedBindParamValue(String varName, Object[] params) {
    Object result = null;
    if (getBindingStyle() == SQLBuilder.BINDING_STYLE_ORACLE_NAME) {
    if (params != null) {
    for (Object param : params) {
    Object[] nameValue = (Object[])param;
    String name = (String)nameValue[0];
    if (name.equals(varName)) {
    return (String)nameValue[1];
    throw new JboException("No bind variable named '"+varName+"'");
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Date
    private static Date nullOrNewDate(Timestamp t) {
    return t != null ? new Date(t) : null;
    * Return either null or a new oracle.jbo.domain.Number
    private static Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new Number(b) : null;
    catch (SQLException s) { }
    return null;
    //----------------[ Begin Helper Code ]------------------------------
    public static int NUMBER = Types.NUMERIC;
    public static int DATE = Types.DATE;
    public static int VARCHAR2 = Types.VARCHAR;
    public static int CLOB = Types.CLOB;
    * Simplifies calling a stored function with bind variables
    * You can use the NUMBER, DATE, and VARCHAR2 constants in this
    * class to indicate the function return type for these three common types,
    * otherwise use one of the JDBC types in the java.sql.Types class.
    * NOTE: If you want to invoke a stored procedure without any bind variables
    * ==== then you can just use the basic getDBTransaction().executeCommand()
    * @param sqlReturnType JDBC datatype constant of function return value
    * @param stmt stored function statement
    * @param bindVars Object array of parameters
    * @return function return value as an Object
    protected Object callStoredFunction(int sqlReturnType, String stmt,
    Object[] bindVars) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement("begin ? := " + stmt +
    "; end;", 0);
    st.registerOutParameter(1, sqlReturnType);
    if (bindVars != null) {
    for (int z = 0; z < bindVars.length; z++) {
    st.setObject(z + 2, bindVars[z]);
    st.executeUpdate();
    return st.getObject(1);
    catch (SQLException e) {
    throw new JboException(e);
    finally {
    if (st != null) {
    try {
    st.close();
    catch (SQLException e) {}
    /**Gets the bind variable value for Email
    public String getEmail() {
    return (String)getNamedWhereClauseParam("Email");
    /**Sets <code>value</code> for bind variable Email
    public void setEmail(String value) {
    setNamedWhereClauseParam("Email", value);
    /**getEstimatedRowCount - overridden for custom java data source support.
    public long getEstimatedRowCount() {
    long value = super.getEstimatedRowCount();
    return value;
    Thanks, Ken

  • Dynamic Columns in Ref Cursor

    Hi All,
    I have a requirement that i need to execute query having dynamic number of columns using Ref Cursor e.g.
    v_string := 'PO_NUMBER , ORG_ID' ;
    v_query := 'SELECT '|| v_string || 'FROM table_name';
    Can someone please quide me how to define Type dynamically for the above requirement ?
    Thanks
    Vipul Maheshwari

    hope you understand how to use this with the help of ref cursor
    CURSOR Expressions
    A CURSORexpression returns a nested cursor. This form of expression is equivalent to
    the PL/SQL REF CURSORand can be passed as a REF CURSORargument to a function.
    A nested cursor is implicitly opened when the cursor expression is evaluated. For
    example, if the cursor expression appears in a select list, a nested cursor will be
    opened for each row fetched by the query. The nested cursor is closed only when:
    ■ The nested cursor is explicitly closed by the user
    ■ The parent cursor is reexecuted
    ■ The parent cursor is closed
    ■ The parent cursor is cancelled
    ■ An error arises during fetch on one of its parent cursors (it is closed as part of the
    clean-up)
    Restrictions on CURSOR Expressions The following restrictions apply to CURSOR
    expressions:
    ■ If the enclosing statement is not a SELECTstatement, then nested cursors can
    appear only as REF CURSORarguments of a procedure.
    ■ If the enclosing statement is a SELECTstatement, then nested cursors can also
    appear in the outermost select list of the query specification or in the outermost
    select list of another nested cursor.
    ■ Nested cursors cannot appear in views.
    ■ You cannot perform BINDand EXECUTEoperations on nested cursors.
    Examples The following example shows the use of a CURSORexpression in the
    select list of a query:
    SELECT department_name, CURSOR(SELECT salary, commission_pct
    FROM employees e
    WHERE e.department_id = d.department_id)
    FROM departments d
    ORDER BY department_name;
    The next example shows the use of a CURSORexpression as a function argument. The
    example begins by creating a function in the sample OEschema that can accept the
    REF CURSORargument. (The PL/SQL function body is shown in italics.)
    CREATE FUNCTION f(cur SYS_REFCURSOR, mgr_hiredate DATE)
    RETURN NUMBER IS
    emp_hiredate DATE;
    before number :=0;
    after number:=0;
    begin
    loop
    fetch cur into emp_hiredate;
    exit when cur%NOTFOUND;
    if emp_hiredate > mgr_hiredate then
    after:=after+1;
    else
    before:=before+1;
    end if;
    end loop;
    close cur;
    if before > after then
    return 1;
    else
    return 0;
    end if;
    end;
    The function accepts a cursor and a date. The function expects the cursor to be a query
    returning a set of dates. The following query uses the function to find those managers
    in the sample employeestable, most of whose employees were hired before the
    manager.
    SELECT e1.last_name FROM employees e1
    WHERE f(
    CURSOR(SELECT e2.hire_date FROM employees e2
    WHERE e1.employee_id = e2.manager_id),
    e1.hire_date) = 1
    ORDER BY last_name;

Maybe you are looking for

  • Not able to clear material from quality stock

    Hi, There is a stock inconsistency between inspection stock in materials management and inspection stocks managed in inspection lots.Due to this, unable to clear inspection stock. I tried with QA08 ,MB1B also assiging inspection type 08 but still pos

  • How to debug to observe how query collect the data

    Hi, I have a query with serveral variables, which I restrict the values through master data read class on info object level. Our problem is that the query can not find data in infoprovider with the resticted values whild running. I want to know how q

  • IDOC monitor for shipping notification- EMASN

    Hello experts, Anybody know that is IDOC monitor for shipping notification-EMASN. what are the input we have to enter as defualt for this transaction. can anybody help, very urgent.

  • How do I automatically print emails in outlook?

    Hello, I recently starting using Microsoft outlook again for emails.  I am not very competent in how it works just yet, however, I would like to know if there was a way I can set up incoming email to automatically print when I am out of the office. 

  • PO header level error

    Gurus, I have an issue on the header level which says Source system is required field. Please specify. Can some one tell me what this error is? Regards MV