Cursor type?

Hey all.. the ASP connection code that DW used to generate
listed a cursor
type that I could change to 'optimistic' but the new code its
spewing
doesn't show these variables anymore.. where is it hiding
them, or how can I
modify what its generating to get there again (though I
shouldn't have to?)

Hey all.. does anyone know how to set the cursor type in this
ASP code to
"optimistic"?
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_NorthDirectory_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.list_active"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

Similar Messages

  • WEAK REF CURSOR type

    This is the first time I have a need at work to use a REF CURSOR type of the weak variety. After reading documentation
    in SF's 'bible' Oracle PL/SQL Programming, I did everything right. Here's the code snippet:
    -- TYPES
    TYPE content_ID_curtype IS
    REF CURSOR;
    -- VARIABLES
    c_SEARCH_STRING CONSTANT VARCHAR2(12) := 'v_content_id';
    content_ID_cur content_ID_curtype;
    v_content_ID am_content_content.content_ID%TYPE;
    BEGIN
    cache_sql_rec.sql_stmt := REPLACE(cache_sql_rec.sql_stmt, c_SEARCH_STRING, template_name_rec.content_ID);
    OPEN content_ID_cur FOR cache_sql_rec.sql_stmt;
    LOOP
    FETCH content_ID_cur
    INTO v_content_ID;
    EXIT WHEN content_ID_cur%NOTFOUND;
    END LOOP;
    CLOSE content_ID_cur;
    END;
    Now the error I get is.... ORA-00911: invalid character When I used DBMS_OUTPUT to see the actual value of
    "cache_sql_rec.sql_stmt", the SQL query looks fine. Even when I hardcoded the sql statement after the FOR keyword, it
    worked fine. It's only when I use a variable to hold the whole SQL statement does it fail. Here's one value for the
    variable cache_sql_rec.sql_stmt:
    SELECT b.content_id
    FROM am_content_mofcollection a,
    am_content_collection b
    WHERE a.content_id = 149090
    AND a.collection_id = b.collection_id;
    Basically I replace the string with an actual content_ID. Now content_ID is of type NUMBER(12) as is the variable
    v_content_ID declared so that I FETCH INTO that variable, but the problem is, is that the exception gets raised during
    the OPEN...cursor...FOR....sql_statement command.
    Any thoughts on this bug?
    Thanks,
    Gio
    Giovanni Jaramillo
    Senior Software Engineer
    Oracle Database Group
    Amplified Holdings, Inc.
    5750 Wilshire Blvd., Ste 501
    Los Angeles, CA 90036-3638
    (323)-556-8792
    [email protected] http://www.amplified.com

    Yes it turns out that the data had a semicolon at the end since it's being inserted by someone else. I know when executing DDL or DML statements via NDS you omit the semicolon. But didn't know it applied to REF CURSORS.
    Also I added a colon to the variable that I was REPLACING since it can act as a bind variable.
    Thanks Andrew.
    Gio
    null

  • Changing the Cursor Type

    Good Morning Everyone,
    I am creating a report with a barchart in a column of the report. i have been following these for reference. (mainly the first link)
    http://htmldb.oracle.com/pls/otn/f?p=31517:183:5430906720971021::NO
    http://apex.oracle.com/pls/otn/f?p=220:1:1602821811068326
    http://apex.oracle.com/pls/otn/f?p=220:2:8706839551396459
    I have sucessfully got the "progress bar" in place on my report. Now what i would like to do is change the cursor type, but im struggling.
    This is the basic lay out of the code which i am using,
              '<img src="'
           || '#WORKSPACE_IMAGES#'
           || 'green.gif" height="20" width="'
           || TO_CHAR (random_value)
           || '" '
           || 'title="'
           || TO_CHAR (random_value)
           || '% completed'
           || '" />'
           || '<img src="'
           || '#WORKSPACE_IMAGES#'
           || 'red.gif" height="20" width="'
           || TO_CHAR (100 - random_value)
           || '" '
           || 'title="'
           || TO_CHAR (100 - random_value)
           || '% open'
           || '" />' progress_barPlease could someone help me :)
    Thanks in Advance,
    -N.S.N.O.

    Hey Guys,
    Thanks for your input, i solved my problem :D The style part of the code at the bottom did the trick.
    -N.S.N.O.
    '<img src="'
    || '#WORKSPACE_IMAGES#'
    || 'green.gif" height="20" width="'
    || TO_CHAR (UKXP)
    || '" '
    || 'title="'
    || TO_CHAR (UKXP)
    || '% of tables turned on'
    || '" '
    || 'style="cursor:help";'
    || '" />'
    || '<img src="'
    || '#WORKSPACE_IMAGES#'
    || 'red.gif" height="20" width="'
    || TO_CHAR (100 - UKXP)
    || '" '
    || 'title="'
    || TO_CHAR (100 - UKXP)
    || '% of tables turned off'
    || '" '
    || 'style="cursor:help";'
    || '" />'

  • Can we register a cursor type as a folder in discoverer....

    Hi,
    I have a function that returns a cursor type variable.
    It is possible in oracle reports to make a function call and capture the "return type" of cursor type as the input to the "datamodel" using "plsql query" option, instead of a table or a query.
    Do we have any option in discoverer to get a similar effect???
    I need to call a function which returns a cursor type variable as the input to the discoverer report. How can I achieve that in discoverer???
    Any input is appreciated.
    Thanks in advance,
    Kiran

    Hi,
    Cursor types are not supported by Discoverer or Reports. This is because Discoverer needs to know the number and format of the columns that are to be displayed in the report before the report is run.
    You can work around this by defining your own type and view where the function is called from within the view. Then import the view into Discoverer and use this view in your reports.
    Rod West

  • WAd Report - How to change Cursor Type...

    Hi,
    In BI WAD report output, the cursor type is Pointer (Hand sign). I wanted to change it to some other type, is this possible, If yes, could u pls let how can i do that. I tried a lot but didn't suceed.
    Thanks...

    I think this would be possible by having custom CSS embedded in web template. E.g. see here:
    http://www.zimmertech.com/tutorials/css/20/changing-cursors-tutorial.php

  • How to change the cursor type when a TableView class was added to a Swing application?

    We can resize column width by dragging the column divider in the table header. This is a built-in feature of the TableView class.
    Normally, the cursor will become to east-resize (or west-resize) type with positioning the cursor just to the right of a column header.
    However, I found that the cursor is remaining the default type at the same position if I integrate JavaFX into Swing Application. That is adding the TableView to a Scene, and then adding this Scene to a JFXPanel, finally, adding this JFXPanel to the JFrame.
    The sample codes are listing below:
    public class Run extends JFrame {
        Run() {
            setSize(600, 450);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            initComponents();
        private void initComponents() {
            final JFXPanel fxPanel = new JFXPanel();
            this.getContentPane().add(fxPanel);
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    initFX(fxPanel);
        private void initFX(JFXPanel fxPanel) {
            Scene scene = null;
            try {
                scene = FXMLLoader.load(
                    new File("res/fxml_example.fxml").toURI().toURL()
            } catch (Exception ex) {
                ex.printStackTrace();
            fxPanel.setScene(scene);
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    new Run().setVisible(true);
    fxml_example.fxml:
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.Scene?>
    <?import javafx.scene.control.TableView?>
    <?import javafx.scene.control.TableColumn?>
    <Scene xmlns:fx="http://javafx.com/fxml">
        <TableView fx:id="tableView"
                   editable="true">
            <columns>
                <TableColumn text="COL1">
                </TableColumn>
                <TableColumn text="COL2">
                </TableColumn>
                <TableColumn text="COL3">
                </TableColumn>
                <TableColumn text="COL4">
                </TableColumn>
                <TableColumn text="COL5">
                </TableColumn>
            </columns>
        </TableView>
    </Scene>
    So, are there anyone can advise how to fix these codes; make the cursor can change to east-resize (or west-resize) type when this TableView class was added to a Swing application?

    Thanks for the report. I've just filed a JIRA issue: https://javafx-jira.kenai.com/browse/RT-34009
    //Anton.

  • Calling the package having cursor type and record type variables

    Hi ,
    I tried the following pacakge ,which is similar to my requriement ,the package got created succesfully, while calling it is giving me the error, Wrong no.of arguments
    CREATE OR REPLACE PACKAGE Pkg_test1
    IS
      ----- Record Variable ----
      TYPE rec_job IS RECORD
       ( job varchar2(50),
         ename varchar2(50),
         sal number
      TYPE typ_job IS TABLE OF rec_job;
      -- cursor declaration
      cursor emp_cur is select empno from  emp;
      TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
      ---- Procedure Declaration ----
    PROCEDURE proc_job ( p_cur IN   emp_ttyp,
                         o_Rat     OUT  typ_job );
    END Pkg_test1;
    CREATE OR REPLACE PACKAGE BODY Pkg_test1
    IS
    PROCEDURE proc_job ( p_cur IN   emp_ttyp, o_Rat     OUT  typ_job )
      IS
        -- Declare collection variable
        l_typ_job typ_job;
    BEGIN
       for i  in 1..p_cur.count loop
        select job,ename,sal bulk collect into l_typ_job
          from emp
          where empno=p_cur(i).empno ;
    o_Rat:= l_typ_job;
    end loop;
    --Output
    for i in 1..o_rat.count loop
    DBMS_OUTPUT.PUT_LINE ( 'Output :'||o_rat(i).job||','||o_rat(i).ename||','||o_rat(i).sal );
      end loop;
    EXCEPTION
      WHEN OTHERS THEN
           DBMS_OUTPUT.put_line('Procedure proc_job  - '|| SQLCODE|| '-'|| SQLERRM);
    END proc_job;
      end pkg_test1;
    /The package is created without errors
    But while calling it is giving me the errors
    DECLARE
      P_CUR PKG_TEST1.emp_ttyp;
      O_RAT PKG_TEST1.rec_job;
    BEGIN
      PKG_TEST1.PROC_JOB ( P_CUR, O_RAT );
      COMMIT;
    END; Error is ::
    PLS-00306: wrong number or types of arguments in call to 'PROC_JOB'Could you hint me how to overcome this error..
    Thank you..
    Edited by: Smile on May 9, 2012 7:27 AM

    # If p_cur input parameter is uninitialized and NULL then you cannot use any nested table function like count, first, last. Hence call to "p_cur.count " failes with error - "ORA-06531: Reference to uninitialized collection"
    # Always check uninitialized collection using "IS NULL or IS NOT NULL" condition
    # There is one more logic error:
    for i  in 1..p_cur.count loop
        select job,ename,sal bulk collect into l_typ_job
          from emp
          where empno= SELECT column_value FROM (p_cur); (i).empno ;
       o_Rat:= l_typ_job;# You Iterate through all employees inp_cur but the o_Rat will contain only employee details for last employee in the p_cur table. You must use statement like "o_Rat := o_Rat MULTISET UNION l_typ_job;" to append the values into existing collection
    Your package should look like:
    CREATE OR REPLACE PACKAGE pkg_test1 IS
       ----- Record Variable ----
       TYPE rec_job IS RECORD(
          job   VARCHAR2(50),
          ename VARCHAR2(50),
          sal   NUMBER);
       TYPE typ_job IS TABLE OF rec_job;
       -- cursor declaration
       CURSOR emp_cur IS
          SELECT empno FROM emp;
       TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
       ---- Procedure Declaration ----
       PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job);
    END pkg_test1;
    CREATE OR REPLACE PACKAGE BODY pkg_test1 IS
    PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job) IS
    -- Declare collection variable
    l_typ_job typ_job;
    BEGIN
    IF p_cur IS NULL THEN
       dbms_output.put_line('No employees as p_cur is NULL');
    END IF;
    IF p_cur IS NOT NULL THEN
      FOR i IN 1 .. p_cur.count LOOP
        SELECT job, ename, sal BULK COLLECT INTO l_typ_job
        FROM emp
        WHERE empno = p_cur(i).empno;
        o_rat := o_rat MULTISET UNION l_typ_job;
      END LOOP;
      --Output
      FOR i IN 1 .. o_rat.count LOOP
        dbms_output.put_line('Output :' || o_rat(i).job || ',' || o_rat(i).ename || ',' || o_rat(i).sal);
      END LOOP;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
       dbms_output.put_line('Procedure proc_job  - ' || SQLCODE || '-' || SQLERRM);
    END proc_job;
    END pkg_test1;
    {code}
    Edited by: Himanshu Binjola on May 9, 2012 3:40 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can't registerOutParameter of cursor type in SQL Server 2000

    Hi, there,
    I'm using SQL Server 2000 and a type 4 JDBC driver for it from JRun 3.1. I wrote a stored procedure which has a Cursor (ResultSet) as an output parameter. But I used callStmt.registerOutParameter(1, java.sql.Types.OTHER);
    I got an exception:
    callable stmt class: allaire.jrun.db.jdbc.base.BaseCallableStatement
    java.sql.SQLException: [JRun][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.
    I definitely want the cursor to be an output parameter in my SQL 2000 store procedure, rather than defining a store procedure without an output Cursor parameter and then use callStmt.getResultSet();
    Does any one knows a way to register an output parameter of type CURSOR in SQL Server 2000 JDBC?
    I know that with in Oracle JDBC driver, you can do this:
    callStmt.registerOutParameter(1, OracleTypes.CURSOR);
    ButI failed to find a equivalent in SQL Server 2000 JDBC driver.
    Thanks a lot.

    If you found any solution to this, would you please let me know too? It'll help a tonne.

  • Generic cursor type // generic datatype

    Hi,
    I would like to dynamically declare a cursor in my procedure and retrieve rows from it for firing insert / update statements on another table. The procedure should take a table_name in VARCHAR2 and use it to declare a cursor like:
    procedure thisProcedure (table_name in VARCHAR2) is
    cursor thisCursor is select * from <table_name>;
    thisRow thisCursor%ROWTYPE;
    begin
    loop
    fetch thisCursor into thisRow
    -- exit when empty
    -- do sth. with this record (insert or update on another table depending on data in thisRow)
    end loop;
    end thisProcedure;
    I have been around in several forums and have got as far as declaring a weak cursor variable (one declared without return clause) and then opening this cursor with dynamic SQL. However, the moment I want to fetch a row of that cursor into a record, I would fail as weak cursor variables do not know their ROWTYPE. So in that case, I would have the cursor correct, but I would not have the corresponding - generically and dynamically declared - datatype:
    procedure thisProcedure (table_name in VARCHAR2) is
    type thisCursorType is ref cursor;
    thisCursor thisCursorType;
    thisRow <table_name>%ROWTYPE;????
    begin
    open thisCursor for 'my dynamic SQL';
    loop
    fetch thisCursor into WHAT???????
    -- exit when empty
    -- do sth. with this record (insert or update on another table depending on data in thisRow)
    end loop;
    end thisProcedure;
    Anybody know a solution or a workaround? Anything?
    Cheers
    Sebastian

    Maybe you can use object types and ANYDATA/ANYTYPE types. For example:
    CREATE TYPE dept_obj_type AS OBJECT (
       deptno NUMBER (2),
       dname  VARCHAR2 (20)
    CREATE TABLE dept_obj_table OF dept_obj_type
    CREATE TYPE emp_obj_type AS OBJECT (
       empno  NUMBER (4),
       ename  VARCHAR2 (20),
       deptno NUMBER (2)
    CREATE TABLE emp_obj_table OF emp_obj_type
    -- procedure inserts a "generic object type" variable
    CREATE OR REPLACE PROCEDURE gen_insert1 (
       p_table   VARCHAR2,
       p_anydata ANYDATA)
    IS
       l_statement VARCHAR2 (32000);
    BEGIN
       l_statement :=
       '  DECLARE' ||
       '     l_anydata ANYDATA := :p_anydata;' ||
       '     l_object ' || p_anydata.GetTypeName || ';' ||
       '     l_result_code PLS_INTEGER;' ||
       '  BEGIN ' ||
       '     l_result_code := l_anydata.GetObject (l_object);' ||
       '     INSERT INTO ' || p_table || ' VALUES (l_object);' ||
       '  END;';
       EXECUTE IMMEDIATE l_statement USING IN p_anydata;
    END;
    -- unnamed PL/SQL block for testing
    DECLARE
       l_dept dept_obj_type;
       l_emp  emp_obj_type;
    BEGIN
       -- creates objects
       l_dept := dept_obj_type (10, 'dept 10');
       l_emp  := emp_obj_type (2000, 'emp 2000', 10);
       -- inserts objects
       gen_insert1 (
          p_table   => 'dept_obj_table',
          p_anydata => ANYDATA.ConvertObject (l_dept));
       gen_insert1 (
          p_table   => 'emp_obj_table',
          p_anydata => ANYDATA.ConvertObject (l_emp));
    END;
    /For (very complicated) relational version see
    Inserting a "Generic Record Type" Using ANYDATA/ANYTYPE Types
    http://www.quest-pipelines.com/pipelines/plsql/tips04.htm#MARCH
    Regards,
    Zlatko Sirotic

  • Declaration of cursor type in package/sp

    Hi,
    I'm using package with sp that using cursor like below:
    --#1============================ PACKAGE
    {PACKAGE                                ORA_PK_TR2 AS
      Type CURS_01  IS REF CURSOR;  --- return RYBB.T_COLLECT%rowtype;
      Procedure ORA_SP_CUST (EXP_DATE IN date,                    
    END
    --#2============================  BODY
    create or replace
    PACKAGE BODY                           ORA_PK_TR2  as
         Procedure ORA_SP_CUST (EXP_DATE IN date,                    
                                          open_CURS_01 OUT CURS_01 )   IS
    BEGIN
    SQL_string = '(select * from RYBB.T_COLLECT where col='||EXP_DATE)'
    OPEN open_CURS_01 FOR  SQL_STRING;
    END;
    --#3=============================  RUN_PORTION
    DECLARE
      EXP_DATE DATE;
    OPEN_CURS_01 RYBB.ORA_PK_TR2.CURS_01;
      TYPE_IN RYBB.T_COLLECT%ROWTYPE;       --/***** <==== need to move into package
    BEGIN
    EXP_DATE := '10-sep-10';
    RYBB.ORA_PK_TR2.ORA_SP_CUST(
        EXP_DATE => EXP_DATE,
       OPEN_CURS_01 => OPEN_CURS_01
    LOOP
        FETCH open_CURS_01 INTO TYPE_IN;
        EXIT WHEN open_CURS_01%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(TYPE_IN.COL1||' '||TYPE_IN.COL2);    --/ for sample
    END LOOP; 
    END;}
    I need to put TYPE_IN declation for cursor inside the package, so user who will run this pack/sp won't deal with this structure. How I can do this,
    I tried to use <return RYBB.T_COLLECT%rowtype;> in package but then I get :
    Error(122,6): PLS-00455: cursor 'open_CURS_01' cannot be used in dynamic SQL OPEN statement.
    Not sure can I put it somehow into the BODY and make it available for user ?
    Appreciate you help.
    BEst
    Trent
    Edited by: trento on Sep 13, 2010 2:36 PM

    --#1============================ PACKAGE
    PACKAGE ORA_PK_TR2 AS
    Type CURS_01 IS REF CURSOR; --- return RYBB.T_COLLECT%rowtype;
    Type CURS_01_TYP IS RYBB.T_COLLECT%rowtype;
    --#3============================= RUN_PORTION
    DECLARE
    EXP_DATE DATE;
    OPEN_CURS_01 RYBB.ORA_PK_TR2.CURS_01;
    TYPE_IN RYBB.ORA_PK_TR2.CURS_01_TYP;
    BEGIN
    Difficult to read, don't you think?
    Try use the tags B-)
    Your code has other issues and (as shown here) won't compile. If you have a working solution, why not paste that instead?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Possible Bug? SQL query changing the Cursor Type from Scrollable to non Scrollable in a ResultSet

    Hi all,
    I've been beating my head against this for a few days now, and while
    there is a workaround, I haven't found out what's causing this to
    happen.
    Every other SQL query except for this one particular query works fine
    and returns a scrollable result set. That one query on the other hand,
    returns a non-scrollable result set.
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

    Ryan D'Silva wrote:
    Hi Joe,
    I'm using the Oracle thin driver -
    oracle.jdbc.driver.OracleDriver - version #8.1.6.0.0
    and the DBMS is
    "Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.2.0 - Production"
    Does that help?Yes. Two things: TYou should probably upgrade the oracle thin
    driver, by downloading the latest appropriate one from their site,
    and make sure it's ahead of all weblogic jars in the classpath the
    server builds for itself. Also, let's see how simple we can make the
    problem. Would you please repeat the JDBC that demonstrated the problem,
    in a small standalone java program that uses a direct thin driver connection,
    getting weblogic out of the picture? (The problem does sound like
    and oracle driver issue).
    Joe
    >
    >
    Thanks,
    - ryan
    You don't say what DBMS and what JDBC driver you're using for the pool.
    That is likely to be the issue. Let me know.
    Joe
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

  • Stored PL/SQL function that returns REF CURSOR type

    Hello everyone,
    I've come through the following problem:
    1.- I created an PL/SQL stored procedure which returns a REF CURSOR element, definition looks like this:
    PACKAGE PKG_LISTADOS AS
    TYPE tuplas IS REF CURSOR;
    /* Procedimientos exportados por el paquete */
    PROCEDURE inicializarModuloListados;
    FUNCTION recaudacionUltimoMes(medioPago DEF_MEDIO_PAGO.MEDIO_PAGO%TYPE)
    RETURN tuplas;
    2.- Now I would like to call the stored procedure and retrieve the PL/SQL cursor as a ResultSet Java Object. The code I wrote is this:
    Connection conn;
    XmlDocument paramDef;
    conn=poolMgr.getConnection str_poolDBConnection);
    try
    CallableStatement cstmt=conn.prepareCall("{?=call PKG_LISTADOS.recaudacionUltimoMes(?)}");
    cstmt.registerOutParameter(1, java.sql.Types.OTHER);
    cstmt.setString(2, "MONEDA");
    cstmt.executeQuery();
    ResultSet rs=(ResultSet)cstmt.getObject(1);
    catch(SQLException sqlE)
    3.- However, I can't make it OK, all the time I get the following error:
    SQL Error(17004), java.sql.SQLException: Non valid column type
    May anyone help me with this, thanks in advance:
    Miguel-Angel

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by angelrip:
    Hello everyone,
    I've come through the following problem:
    1.- I created an PL/SQL stored procedure which returns a REF CURSOR element, definition looks like this:
    PACKAGE PKG_LISTADOS AS
    TYPE tuplas IS REF CURSOR;
    /* Procedimientos exportados por el paquete */
    PROCEDURE inicializarModuloListados;
    FUNCTION recaudacionUltimoMes(medioPago DEF_MEDIO_PAGO.MEDIO_PAGO%TYPE)
    RETURN tuplas;
    2.- Now I would like to call the stored procedure and retrieve the PL/SQL cursor as a ResultSet Java Object. The code I wrote is this:
    Connection conn;
    XmlDocument paramDef;
    conn=poolMgr.getConnection str_poolDBConnection);
    try
    CallableStatement cstmt=conn.prepareCall("{?=call PKG_LISTADOS.recaudacionUltimoMes(?)}");
    cstmt.registerOutParameter(1, java.sql.Types.OTHER);
    cstmt.setString(2, "MONEDA");
    cstmt.executeQuery();
    ResultSet rs=(ResultSet)cstmt.getObject(1);
    catch(SQLException sqlE)
    3.- However, I can't make it OK, all the time I get the following error:
    SQL Error(17004), java.sql.SQLException: Non valid column type
    May anyone help me with this, thanks in advance:
    Miguel-Angel<HR></BLOCKQUOTE>
    Do something like the following:
    cstmt = conn.prepareCall("{call customer_proc(?, ?)}");
    //Set the first parameter
    cstmt.setInt(1, 40);
    //Register to get the Cursor parameter back from the procedure
    cstmt.registerOutParameter(2, OracleTypes.CURSOR);
    cstmt.execute();
    ResultSet cursor = ((OracleCallableStatement)cstmt).getCursor(2);
    while(cursor.next())
    System.out.println("CUSTOMER NAME: " + cursor.getString(1));
    System.out.println("CUSTOMER AGE: " + cursor.getInt(2));
    cursor.close();
    null

  • Change cursor type in Yosemite

    Is there any way to change the type of cursor in Yosemite?  Not the arrow pointer for the mouse or trackpad, but i mean the cursor -- right now it's just the default vertical line, but could I change it to a block, like in the Terminal application?  I can't find anything in the accessibility window of preferences.

    You can't. The recordset returned by a command object (which
    is what's used
    in the 8.02 update) is always a read-only, forward-only,
    server-side cursor.
    If you need to change any of that, don't use the Execute
    method of the
    command object. Construct a recordset with the options you
    want. Do NOT
    set the active connection on the recordset; leave that out.
    Pass the
    command object as the source of the recordset object, then
    use the
    recordset's Open method. That's pretty convoluted, but it
    lets you retain
    the most DW-generated code.
    Your other option is to use the recordset object only and
    plain text
    parameters like DW 8.01 rather than a command object with
    parameter objects
    like DW 8.02.
    That change was fundamental to the ASP server model and
    probably should not
    have been part of any update, but saved for the next release.
    It at least
    deserved more than a .0x update to the version number. At
    least call it
    8.1.
    "riprod7" <[email protected]> wrote in
    message
    news:e8jdb6$ou0$[email protected]..
    >I have never been more unhappy with an update in my live,
    I basically have
    >to
    > learn everything from scratch again with DW 8.02.
    >
    > When pulling a recrodset you used to be able to set the
    CursorType in the
    > code. That is gone now.
    > As a result I cannot use rs.MoveFirst or rs.Move -2 to
    browse around
    > records.
    > I get the following error.
    >
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e24'
    > Rowset does not support fetching backward.
    >
    > How do I change the CursorType in this horrible update!
    Thanks
    >

  • Can stored function return record type or cursor type?

    Hi everybody,
    I am working with a stored function now.
    Can the function output more that ONE result? i.e. cursor or record type.
    Thanks.
    Brigitta.

    Brigitta,
    If you are calling the stored function from SQL then the function can only return one of the base datatypes, as Murali has said. However, if you are calling the function from PLSQL you can return any complex datatype, eg:
    package test_package is
    type rec_test is
      ( col_a number
      , col b varchar2(30) );
    type tab_test is
      table of rec_test
      index by binary ineteger;
    function test_function (.....)
    return tab_test;
    end test_package;and to call this function:
    declare
    l_table test_package.tab_test;
    begin
    l_table := test_package.test_function(....);
    end;Hope that helps!

  • Ref cursor type

    Hello All,
    I have a small procedure like the following.
    CREATE OR REPLACE procedure PROC_DEPT_SALE(SALEC_CUR out sys_refcursor)
    as
    begin
    open sale for select * from dept_sale where dept_no='Z2341324';
    end;
    I just want to execute it from toad like
    exec PROC_DEPT_SALE( C1);
    In order to do that i need to have a sys_refcursor c1 created in my DB. I know that i can execute it as a plsql block like this
    DECLARE
    SALE SYS_REFCURSOR;
    BEGIN
    PROC_DEPT_SALE( SALE );
    END;
    Could anyone please let me know how can i create a TYPE REF cursor which is permanantly stored in the DB and then execute the proc the way i wanted to using the first statement.
    Thanks

    Actually, you had it correct with
    CREATE OR REPLACE package cur_type as
       TYPE ref_cur IS REF CURSOR;
    end;but you still need to declare a variable of the type to pass the the procedure since the procedure needs to have a cursor variable to open. Given your package, the call would be more like:
    DECLARE
       l_cur cur_type.ref_cur;
    BEGIN
       proc_dept_sale(l_cur);
       <do something with l_cur>
    END;Forget about the cursor for a minute and think through this example. If I have a procedure that looks like:
    CREATE PROCEDURE get_name (p_id    IN NUMBER,
                               p_name OUT VARCHAR2) AS
    BEGIN
       SELECT last_name||', '||first_name
       INTO p_name
       FROM employee
       WHERE emp_id = p_id;
    END;I can pass a literal value to the procedure for the p_id parameter (e.g. 42) or I could pass a variable holding a value.
    What do I need to pass to the procedure in p_name to get the name back out? A procedure returning a cursor is no different than this in concept.
    John

Maybe you are looking for

  • As a result of very poor customer service, I am a ...

    I decided to come back to BT after a 2-year stint with Virginmedia. I think I've made a huge mistake ! It all started so well, too. I signed up to the Anytime Call Plan and Broadband Option 3, with a discount for the first 3 months. It all started ve

  • Getting not enough storage msg when downloading itunes movie to ipad2

    First attempt to download iTunes movie to my iPad2.  Got msg saying not enough storage.  I'm new to the whole Apple world and am not sure what to do to fix this problem.

  • MBA wireless shows not connected

    Hi, my MacBook Air (early 2014) connects to the Internet and then for several minutes scrolls looking for a wifi to connect to. It then tells me that there is no Internet connection ans puts an exclamation mark over the grayed bars of the wifi symbol

  • BRFplus: How to create an instance of User-Defined Expression Type?

    Hi,   I've created an expression type in a System Application and marked its Access Level as Global. I've created a Class & Interface and assigned it to my Expression Type, and activated it successfully. Now how do use this Expression Type to create

  • Print of Storage Bin details in GR slip

    We have done goods receipt (GR) in a Storage location with is Warehouse managed. We have setting where the Transfer order is created and confirmed automatically as soon as GR is posted. We print the GR slip and we need the Storage bin to be printed f