How to reset a cursor in PL/SQL?

Hi everyone
I have a CURSOR in PL/SQL with a number N of rows. I fetch all these rows in a bucle, but, when the last row is arrived, and the condition NOTFOUND is true, I'd like to return to the first row, and do the same process again. I mean, fetching every row a number of times k. For example, in a cursor of 3 rows:
Row 1
Row 2
Row 3
Row 1
Row 2
... and on
If I close the cursor and then I open it, there is no data, because the cursor is in the last row and the FETCH return NOTFOUND, so I'd like to "reset" the cursor and begin from the first row again.
How could I do this?
Thank you very much and sorry for my english

Hi,
This is not really a question for the APEX forum but with that said...
What defines k?
Your requirement looks a little fraught with danger as you could end up in a tight (endless) loop...
What are you really trying to achieve with this logic?
If you have a maximum number of iterations that you want to loop through then perhaps try declaring an explicit cursor, loop through this cursor inside another (nested) loop.
Eg
DECLARE
l_char table1.col1%TYPE;
cnt PLS_INTEGER := 0;
CURSOR x IS
SELECT col1
FROM table1;
BEGIN
FOR m IN 1..3 LOOP
FOR i IN x LOOP
l_char := i.col1;
cnt := cnt + 1;
dbms_output.put_line(cnt||' '||l_char);
END LOOP;
END LOOP;
END;
Mike

Similar Messages

  • How to pass a col of pl/sql tab to a parametrized cursor?

    Hi,
    I'm getting this error constantly:
    Error on line 1
    declare
    j number :=1;
    cursor f
    ORA-06550: line 9, column 20:
    PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table LONG_ double ref
    char time timestamp interval date binary national character
    nchar
    Code Snippet:
    declare
    j number :=1;
    cursor firstquery (c_item in varchar2) is
    SELECT SEARCH, NAME, ID FROM tablename
    WHERE name LIKE c_item;
    first_rec_tbl_type is table of firstquery%rowtype index by binary_integer;
    first_rec_tbl first_rec_tbl_type;
    type act_str_tbl_type is table of varchar2(50) index by binary_integer;
    act_put_str_tbl act_str_tbl_type;
    begin
    this is executing fine as i have executed it as a standalone script also
    act_put_str_tbl table has values here.passing these to below:
    ----------------------------------- i guess the problem lies here------------------------
         begin
              dbms_output.put_line('reached second begin');
    For i in act_put_str_tbl.first..act_put_str_tbl.last
         loop
         dbms_output.put_line('inside loop of second begin');
         open firstquery(act_put_str_tbl(i));
              loop
              fetch firstquery into first_rec_tbl(j);
              j:=j+1;
              exit when firstquery%notfound or firstquery is null;
              end loop;
         close firstquery;
         end loop;
    How to use parametrized cursor with PL/SQL table, any help is appreciated in the above snippet.
    Thanks

    Satyaki_De wrote:
    first_rec_tbl_type is table of firstquery%rowtype index by binary_integer;Create this type in side any package like ->
    create or replace package patch_array
    is
    first_rec_tbl_type is table of firstquery%rowtype index by pls_integer;
    end;But, you have to use explicit record type instead of firstquery%rowtype here.
    And, then refer this type inside your parametrized cursor to use that properly, that might solve your current problem - i guess.
    So, you cursor should look something like this ->
    cursor firstquery (c_item in patch_array.first_rec_tbl_type)
    is
    SELECT SEARCH, NAME, ID
    FROM tablename
    WHERE name LIKE c_item; N.B.:Not Tested...
    Regards.
    Satyaki De.
    Edited by: Satyaki_De on Dec 28, 2008 1:32 AM??? No package is needed:
    SQL> declare
      2      j number := 1;
      3      cursor firstquery(
      4                        c_item in varchar2
      5                       )
      6        is
      7          SELECT  ename,
      8                  sal
      9            FROM  emp
    10            WHERE ename LIKE c_item;
    11      type first_rec_tbl_type is table of firstquery%rowtype index by binary_integer;
    12      first_rec_tbl first_rec_tbl_type;
    13      type act_str_tbl_type is table of varchar2(50) index by binary_integer;
    14      act_put_str_tbl act_str_tbl_type;
    15  begin
    16      act_put_str_tbl(1) := 'S%';
    17      act_put_str_tbl(2) := '%L%';
    18      act_put_str_tbl(3) := 'KING';
    19      begin
    20          dbms_output.put_line('reached second begin');
    21          For i in 1..nvl(act_put_str_tbl.count,0) loop
    22            dbms_output.put_line('inside loop of second begin');
    23            dbms_output.put_line('act_put_str_tbl(' || i || ') = ' || act_put_str_tbl(i));
    24            open firstquery(act_put_str_tbl(i));
    25            loop
    26              fetch firstquery into first_rec_tbl(j);
    27              exit when firstquery%notfound;
    28              dbms_output.put_line('first_rec_tbl(' || j || ').ename = ' || first_rec_tbl(j).enam
    e);
    29              dbms_output.put_line('first_rec_tbl(' || j || ').sal = ' || first_rec_tbl(j).sal);
    30              j:=j+1;
    31            end loop;
    32            close firstquery;
    33          end loop;
    34      end;
    35  end;
    36  /
    reached second begin
    inside loop of second begin
    act_put_str_tbl(1) = S%
    first_rec_tbl(1).ename = SMITH
    first_rec_tbl(1).sal = 800
    first_rec_tbl(2).ename = SCOTT
    first_rec_tbl(2).sal = 3000
    inside loop of second begin
    act_put_str_tbl(2) = %L%
    first_rec_tbl(3).ename = ALLEN
    first_rec_tbl(3).sal = 1600
    first_rec_tbl(4).ename = BLAKE
    first_rec_tbl(4).sal = 2850
    first_rec_tbl(5).ename = CLARK
    first_rec_tbl(5).sal = 2450
    first_rec_tbl(6).ename = MILLER
    first_rec_tbl(6).sal = 1300
    inside loop of second begin
    act_put_str_tbl(3) = KING
    first_rec_tbl(7).ename = KING
    first_rec_tbl(7).sal = 5000
    PL/SQL procedure successfully completed.
    SQL> To OP. It is better to use BULK COLLECT:
    SQL> declare
      2      cursor firstquery(
      3                        c_item in varchar2
      4                       )
      5        is
      6          SELECT  ename,
      7                  sal
      8            FROM  emp
      9            WHERE ename LIKE c_item;
    10      type first_rec_tbl_type is table of firstquery%rowtype index by binary_integer;
    11      first_rec_tbl first_rec_tbl_type;
    12      type act_str_tbl_type is table of varchar2(50) index by binary_integer;
    13      act_put_str_tbl act_str_tbl_type;
    14  begin
    15      act_put_str_tbl(1) := 'S%';
    16      act_put_str_tbl(2) := '%L%';
    17      act_put_str_tbl(3) := 'KING';
    18      begin
    19          dbms_output.put_line('reached second begin');
    20          For i in 1..nvl(act_put_str_tbl.count,0) loop
    21            dbms_output.put_line('inside loop of second begin');
    22            dbms_output.put_line('act_put_str_tbl(' || i || ') = ' || act_put_str_tbl(i));
    23            open firstquery(act_put_str_tbl(i));
    24            fetch firstquery bulk collect into first_rec_tbl;
    25            for j in 1..nvl(first_rec_tbl.count,0) loop
    26              dbms_output.put_line('first_rec_tbl(' || j || ').ename = ' || first_rec_tbl(j).enam
    e);
    27              dbms_output.put_line('first_rec_tbl(' || j || ').sal = ' || first_rec_tbl(j).sal);
    28            end loop;
    29            close firstquery;
    30          end loop;
    31      end;
    32  end;
    33  /
    reached second begin
    inside loop of second begin
    act_put_str_tbl(1) = S%
    first_rec_tbl(1).ename = SMITH
    first_rec_tbl(1).sal = 800
    first_rec_tbl(2).ename = SCOTT
    first_rec_tbl(2).sal = 3000
    inside loop of second begin
    act_put_str_tbl(2) = %L%
    first_rec_tbl(1).ename = ALLEN
    first_rec_tbl(1).sal = 1600
    first_rec_tbl(2).ename = BLAKE
    first_rec_tbl(2).sal = 2850
    first_rec_tbl(3).ename = CLARK
    first_rec_tbl(3).sal = 2450
    first_rec_tbl(4).ename = MILLER
    first_rec_tbl(4).sal = 1300
    inside loop of second begin
    act_put_str_tbl(3) = KING
    first_rec_tbl(1).ename = KING
    first_rec_tbl(1).sal = 5000
    PL/SQL procedure successfully completed.
    SQL> SY.
    Edited by: Solomon Yakobson on Dec 27, 2008 12:32 PM

  • How to print/store in file the ref cursor in pl/sql block ?

    How to print/store in file the ref cursor in pl/sql block ?.

    How to print/store in file the ref cursor in pl/sql block ?.You question is quite confusing?
    So, i'm providing link in this manner.
    For RefCursor,
    http://www.oracle-base.com/articles/misc/UsingRefCursorsToReturnRecordsets.php
    http://www.oracle.com/technology/oramag/code/tips2003/042003.html
    For UTL_FILE,
    http://www.morganslibrary.org/reference/utl_file.html
    Regards.
    Satyaki De.
    Updated with new morgan library link.
    Edited by: Satyaki_De on Feb 24, 2010 9:03 PM

  • How can I open a cursor for dynamic sql statement

    Hi,
    I'm facing issues opening a cursor for dynamic sql statement : PLS-00455: cursor 'RESULT1' cannot be used in dynamic SQL OPEN statement.
    CREATE OR REPLACE FUNCTION DEMO
    (MN_I in VARCHAR)
    return AB_OWNER.ABC_Type.NonCurTyp is
    RESULT1 AB_OWNER.ABC_Type.NonCurTyp;
    sql_stmt VARCHAR2(4000);
    BEGIN
    sql_stmt := 'SELECT * FROM AB_OWNER.DUN WHERE JZ_I in ('||mn_i||') ORDER BY app.ACC_I';
    OPEN RESULT1 FOR sql_stmt;
    END IF;
    return RESULT1;
    END DEMO;
    What changes should I make in the code so that it doesn't fail? I can't change the definition of RESULT1 cursor though.

    Gangadhar Reddy wrote:
    I used SYS REFCURSOR and was able to implement successfully.How many times did you run this successful implementation that does not use bind variables?
    Because this is what will happen when it runs a lot.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/e2100.htm#sthref1874
    http://forums.oracle.com/forums/search.jspa?q=%2BORA-04031%20%2Bbind&objID=c84&dateRange=all&rankBy=10001&start=30
    And you will have to regularly restart the server, or possibly slightly less invasive, flush the shared pool.
    Flushing Shared Pool regularly
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1516005546092
    >
    Ok, this is an easy one to diagnose.
    You are not using bind variables. This is terrible. Flushing the shared pool is a bad
    solution -- you are literally killing the performance on your box by not using them.
    If I was to write a book on how to build “non scalable applications in Oracle”, this
    would be the first and last chapter. This is a major cause of performance issues and a
    major inhibitor of scalability in Oracle. The way the Oracle shared pool (a very
    important shared memory data structure) operates is predicated on developers using bind
    variables. If you want to make Oracle run slowly, even grind to a total halt – just
    refuse to use them.
    >
    But, please feel free to go ahead with this successful implementation.
    I just hope anyone else who reads this doesn't make the same mistake.

  • How to Reset Password of Client 800 in SQL server2005 of IDES Ecc6.0

    Dear All,
    how to Reset Password in SQL server of Client 800 IDES Ecc6.0.
    & what will be its password.
    with best regards.
    Ishtiaq

    Hi
    Simple logic we have sap* and ddic as default users if you are unable to login to client 800 with any of the user then you need to delete the user sap* from database level so that it will be recreated again and you can login as sap* and password as pass here is the procedure
    login to ora<sid>
    execute the sql statement
    delete from usr02.sapr3 where bname = 'SAP*' and mandt = '800';
    commit;
    sapr3 is your schema id
    You also need to check parameter login/no_automatic_user_sapstar is set to 0 so you can logon as SAP* password pass
    If the parameter doesn't exist then maintain in instance profile
    /usr/sap/SID/SYS/profiles/SID_DVEBMGS00_Host
    Unfortunately you'll need a system restart to enable and disable the parameter
    You can also refer to below links
    http://www.sap-img.com/basis/changing-the-default-password-for-sap-user.htm
    http://www.sap-basis-abap.com/bc/forgot-password-for-user-id-sap-in-client-000.htm
    Let me know if you need more help
    Regards
    Uday

  • ORA-01008 with ref cursor and dynamic sql

    When I run the follwing procedure:
    variable x refcursor
    set autoprint on
    begin
      Crosstab.pivot(p_max_cols => 4,
       p_query => 'select job, count(*) cnt, deptno, row_number() over (partition by job order by deptno) rn from scott.emp group by job, deptno',
       p_anchor => Crosstab.array('JOB'),
       p_pivot  => Crosstab.array('DEPTNO', 'CNT'),
       p_cursor => :x );
    end;I get the following error:
    ^----------------
    Statement Ignored
    set autoprint on
    begin
    adsmgr.Crosstab.pivot(p_max_cols => 4,
    p_query => 'select job, count(*) cnt, deptno, row_number() over (partition by
    p_anchor => adsmgr.Crosstab.array('JOB'),
    p_pivot => adsmgr.Crosstab.array('DEPTNO', 'CNT'),
    p_cursor => :x );
    end;
    ORA-01008: not all variables bound
    I am running this on a stored procedure as follows:
    create or replace package Crosstab
    as
        type refcursor is ref cursor;
        type array is table of varchar2(30);
        procedure pivot( p_max_cols       in number   default null,
                         p_max_cols_query in varchar2 default null,
                         p_query          in varchar2,
                         p_anchor         in array,
                         p_pivot          in array,
                         p_cursor in out refcursor );
    end;
    create or replace package body Crosstab
    as
    procedure pivot( p_max_cols          in number   default null,
                     p_max_cols_query in varchar2 default null,
                     p_query          in varchar2,
                     p_anchor         in array,
                     p_pivot          in array,
                     p_cursor in out refcursor )
    as
        l_max_cols number;
        l_query    long;
        l_cnames   array;
    begin
        -- figure out the number of columns we must support
        -- we either KNOW this or we have a query that can tell us
        if ( p_max_cols is not null )
        then
            l_max_cols := p_max_cols;
        elsif ( p_max_cols_query is not null )
        then
            execute immediate p_max_cols_query into l_max_cols;
        else
            RAISE_APPLICATION_ERROR(-20001, 'Cannot figure out max cols');
        end if;
        -- Now, construct the query that can answer the question for us...
        -- start with the C1, C2, ... CX columns:
        l_query := 'select ';
        for i in 1 .. p_anchor.count
        loop
            l_query := l_query || p_anchor(i) || ',';
        end loop;
        -- Now add in the C{x+1}... CN columns to be pivoted:
        -- the format is "max(decode(rn,1,C{X+1},null)) cx+1_1"
        for i in 1 .. l_max_cols
        loop
            for j in 1 .. p_pivot.count
            loop
                l_query := l_query ||
                    'max(decode(rn,'||i||','||
                               p_pivot(j)||',null)) ' ||
                                p_pivot(j) || '_' || i || ',';
            end loop;
        end loop;
        -- Now just add in the original query
        l_query := rtrim(l_query,',')||' from ( '||p_query||') group by ';
        -- and then the group by columns...
        for i in 1 .. p_anchor.count
        loop
            l_query := l_query || p_anchor(i) || ',';
        end loop;
        l_query := rtrim(l_query,',');
        -- and return it
        execute immediate 'alter session set cursor_sharing=force';
        open p_cursor for l_query;
        execute immediate 'alter session set cursor_sharing=exact';
    end;
    end;
    /I can see from the error message that it is ignoring the x declaration, I assume it is because it does not recognise the type refcursor from the procedure.
    How do I get it to recognise this?
    Thank you in advance

    Thank you for your help
    This is the version of Oracle I am running, so this may have something to do with that.
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    I found this on Ask Tom (http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3027089372477)
    Hello, Tom.
    I have one bind variable in a dynamic SQL expression.
    When I open cursor for this sql, it gets me to ora-01008.
    Please consider:
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
    JServer Release 8.1.7.4.1 - Production
    SQL> declare
      2    type cur is ref cursor;
      3    res cur;
      4  begin
      5    open res for
      6    'select * from (select * from dual where :p = 1) connect by 1 = 1'
      7    using 1;
      8  end;
      9  /
    declare
    ERROR at line 1:
    ORA-01008: not all variables bound
    ORA-06512: at line 5
    SQL> declare
      2    type cur is ref cursor;
      3    res cur;
      4  begin
      5    open res for
      6    'select * from (select * from dual where :p = 1) connect by 1 = 1'
      7    using 1, 2;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    And if I run the same thing on 10g -- all goes conversely. The first part runs ok, and the second
    part reports "ORA-01006: bind variable does not exist" (as it should be, I think). Remember, there
    is ONE bind variable in sql, not two. Is it a bug in 8i?
    What should we do to avoid this error running the same plsql program code on different Oracle
    versions?
    P.S. Thank you for your invaluable work on this site.
    Followup   June 9, 2005 - 6pm US/Eastern:
    what is the purpose of this query really?
    but it would appear to be a bug in 8i (since it should need but one).  You will have to work that
    via support. I changed the type to tarray to see if the reserved word was causing a problem.
    variable v_refcursor refcursor;
    set autoprint on;
    begin 
         crosstab.pivot (p_max_cols => 4,
                 p_query => 
                   'SELECT job, COUNT (*) cnt, deptno, ' || 
                   '       ROW_NUMBER () OVER ( ' || 
                   '          PARTITION BY job ' || 
                   '          ORDER BY deptno) rn ' || 
                   'FROM   emp ' ||
                   'GROUP BY job, deptno',
                   p_anchor => crosstab.tarray ('JOB'),
                   p_pivot => crosstab.tarray ('DEPTNO', 'CNT'),
                   p_cursor => :v_refcursor);
    end;
    /Was going to use this package as a stored procedure in forms but I not sure it's going to work now.

  • How to resolve ORA-00001 Error in SQL Insert?

    Hi all, I need your appreciated help.
    I make a plsql procedure that is inserting a row according cursor value, I'm having oracle error ORA-00001: unique constraint (constraint_name) violated.
    You may see this message if a duplicate entry exists at a different level: in RDBMS MySQL I have the syntax IGNORE to resolve this duplication error... and in Oracle ?
    Thanks for your time and hints.
    Miguelito

    user6317803 wrote:
    How to resolve ORA-00001 Error in SQL Insert?ORA-00001 means table has unique/primary key/index and you are trying to insert a row with key value that already exists in the table. I'll assume table COUNTRIES has primary key on COUNTRY_ID. Then change SQL to:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ')"There is a good chance table COUNTRIES also has unique key/index on COUNTRY_NAME. If so use:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR COUNTRY_NAME = 'BLZ')"SY.

  • Is there any limit on how many records a cursor can hold?

    Hi Everyone,
    This is Amit here. I want to know whether there is any limit on how many records a cursor can hold.
    I have a program in which i am creating a cursor and passing it to another procedure as an input parameter. But the count of cursor query is more than 15 Lakhs. The program is running forever.
    Just wanted to know whether the huge data is the problem.
    Thanks ....
    Regards,
    Amit

    user13079404 wrote:
    Just wanted to know whether the huge data is the problem.What do you think? How long does your code typically need to wait for the data to leave the magnetic platter of the harddisk, travel across wires and into the memory buffer of your application - for a single row?
    Now multiply that waiting for I/O time with a million - for a million rows. Or by a billion, for a billion rows.
    Is "+huge data+" a problem? Not really - it simple needs more work to get that amount of data from disk. More work means slower performance. It is that simple.
    Which is why the row-by-row approach used by many developers is wrong. You do not pull a million rows from disk and process it in PL/SQL or Java or .Net. Heck, you do not even pull 10,000 rows like that.
    The correct approach is to think data sets and use SQL to process that for you - and only return the bare minimum of data to the application layer. Maximize SQL. Minimize PL/SQL and Java and .Net.

  • How to use database cursor in ABAP

    Hi all,
    I want to establish a connexion with another database system (Oracle) from SAP. Then i want to execute a cursor which is in a SQL package.
    The connexion is done sucssefuly but i don't know how to execute the cursor from SAP.
    The SQL package's definition that i have is :
    The name of package : pk_name
    The name of cursor : cursor c_dos(dat varchar, num varchar) return T_TABLE.
    Thx a lot for you help.

    hi Sourav,
    Check the sample program in SE38.
    in program name field give BCALV* press F4.
    BCALV_TEST_GRID_EVENTS
    It will give lot of example program.
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • How to avoid performance problems in PL/SQL?

    How to avoid performance problems in PL/SQL?
    As per my knowledge, below some points to avoid performance proble in PL/SQL.
    Is there other point to avoid performance problems?
    1. Use FORALL instead of FOR, and use BULK COLLECT to avoid looping many times.
    2. EXECUTE IMMEDIATE is faster than DBMS_SQL
    3. Use NOCOPY for OUT and IN OUT if the original value need not be retained. Overhead of keeping a copy of OUT is avoided.

    Susil Kumar Nagarajan wrote:
    1. Group no of functions or procedures into a PACKAGEPutting related functions and procedures into packages is useful from a code organization standpoint. It has nothing whatsoever to do with performance.
    2. Good to use collections in place of cursors that do DML operations on large set of recordsBut using SQL is more efficient than using PL/SQL with bulk collects.
    4. Optimize SQL statements if they need to
    -> Avoid using IN, NOT IN conditions or those cause full table scans in queriesThat is not true.
    -> See to queries they use Indexes properly , sometimes Leading index column is missed out that cause performance overheadAssuming "properly" implies that it is entirely possible that a table scan is more efficient than using an index.
    5. use Oracle HINTS if query can't be further tuned and hints can considerably help youHints should be used only as a last resort. It is almost certainly the case that if you can use a hint that forces a particular plan to improve performance that there is some problem in the underlying statistics that should be fixed in order to resolve issues with many queries rather than just the one you're looking at.
    Justin

  • How to Reset the EIM \ CIM System "sa" Password Procedure

    All.
    I have posted a document, "How to Reset the EIM \ CIM System "sa" Password Procedure" on this CSC site to assist you w\ the EIM "sa"user password reset procedure.
    I am also posting the procedure and word document attachment here.
    Let me know how helpful the procedure is.
    Bernard
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}
    Resetting The CIM \ EIM System “sa” Password Procedure
    Key: ‘ ‘ = Two single quotes.
    The following contain the query for blanking out the SA password for Partition 0 thru the backend.
    1. Go to SQL Server Management Studio and change the database to master database. USE “eGMasterDB”
    2. a. To verify user_name, and select user_id“save the results for backup.
        b. “SELECT user_id, user_name, password, case_insensitive_password FROM egpl_user WHERE user_id = 1”.
    Note: Be sure to save query and results, so that it can be provided for troubleshooting, if there is a problem.
    3. a. For Blanking out the SA password. UPDATE egpl_user WITH (ROWLOCK) SET password = ‘ ‘, case_insensitive_password = ‘ ‘ WHERE user_id = 1
    4. Verify the PW columns are now clear, by re-running the select cmd. “SELECT user_id, user_name, password, case_insensitive_password FROM egpl_user WHERE user_id = 1”.
    Then to successfully access and change CIM \ EIM “sa” User Account. (Partition 0)
    4. Go to login.  //<EIM server ip address>/system/
    5. Login with “sa” as the user name, no password.
    6. Navigate to Administration > Partition: System > Users, and highlight sa user under “List: Users”.
    7. Highlight the “Password” row, on the “General” tab, under “Properties: sa”.
    8. Select the box to the right of row and it will ask if you want to change the password.
    9. Select yes, enter new password.
    10. Save.

    It's great to have these types of procedures published on CSC!  Thanks, Bernard!
    -Paulo

  • How to create a cursor in menu item???

    Hi,
    How to create a cursor in menu item??? and process data inside the SQL Editor of Menu Item>????
    Regards,

    ok, you mean: When the form is starting you want to disable some menues.
    create a WHEN-NEW-FORM-INSTANCE-trigger in your form and then do the loop over the menu-item
    what is ENTITIES? The name of a table ?

  • How to close open cursors in a forms app

    All,
    I'm not a forms developer. I'm a database administrator so I'm asking this question from that perspective. I know nothing about forms development.
    We have several forms applications that appear to hold many SELECT cursors open when they run. I've asked my forms developers about this and they are giving me the idea that they don't have much control over this. I have no idea myself so I'm asking here.
    When one issues selects from a form, do those selects remain as open cursors while the form runs? Is it possible to close those select cursors from within the form so that the application does not keep so many cursors open simultaneously?
    I am typically seeing a forms application with 70-100 open cursors. And we have hundreds of end users each running the forms application which is causing a lot of problems with the sheer number of open cursors.
    I've already bumped the database OPEN_CURSORS parameter but it's my feeling that developers should be doing a better job of closing cursors from within the form.
    Can anyone give me some guidance here or point me to some documents that describe how to reduce the number of open cursors to the database from a forms app?
    Thanks,

    There are several ways Forms use cursors. In the standard default method, users enter a query where condition and then execute the query. This process opens a cursor on the server, and the form fetches a few (20 or so) rows and displays on the screen (in a base-table "block"). If the user scrolls down, more rows are fetched from the cursor. This can go on and on if the user keeps scrolling down through the data. I am not sure when the cursor gets closed -- there is no Forms command to close this one. Only closing the form, or else re-executing the query process would close such a cursor.
    In the PL/SQL code, where the developer has control, a cursor can be opened, rows fetched, and then closed. This can be done either with Open-Fetch-Close or in a For... Loop. The developer can explicitly close this cursor, or PL/SQL theoretically closes the cursor when the block of code is exited.
    There is of course the SQL Select into, but that only works in PL/SQL for single-row selects. I doubt this is a major problem.
    And finally, there are the record groups, where Forms runs the select to draw all the data into an array in the form. These should be closed automatically, I believe.
    Now... if you can determine which tables the cursors are remaining open, maybe your developers can zero in on the forms, and maybe clean up some things. However, I am doubtful much can be done. It seems to me that if the open cursors are causing some database sluggishness, then maybe adding more memory on the server is the best option.

  • PL/SQL cursors vs. SQL*plus Select statement

    Hi folks, hope you're doing well,
    Here is a question that kept me wondering:
    Why would I use cursors when i can achieve the same thing with a SQL+ Select statement which is much easier to formulate than a cursor (e.g. you need no declaration, loops etc)?.
    Thanks so much,
    -a

    There is no such thing as a SQL*Plus SELECT statement. The SELECT command is part of the SQL Language - not part of the SQL*Plus (very limited small vocabulary) macro language.
    All SQL SELECTs (from client languages) winds up in the SQL Engine as SQL cursors. A SQL Cursor is basically the:
    - SQL source code
    - SQL "compiled" code (instructions on how to fetch the rows)
    On the client side, client cursors (not to be confused with SQL cursors) are used. A client cursor is created in the client language when it makes SQL calls via the database client driver (called the OCI/Oracle Call Interface for Oracle clients).
    Typically this is what a client does. It makes a connection to the database and gets a database handler in return. The database handler is the "communication channel" from the client to the db. In Oracle, the database handler in the client refers to the Oracle session (for that client) on db server.
    A SQL statement (source code) is used by the client. This can be a SELECT statement you type in at the SQL*Plus command line. It can be a SELECT statement for the PL/SQL cursor command in a stored procedure.
    The client creates a SQL handle for this SQL statement, by calling the Oracle client driver. Note that this SQL handle is a client handle - a client cursor for that SQL statement.
    E.g.
    a) sqlHandle = CreateSQL( databaseHandle, 'SELECT ... FROM ...')
    b) sqlHandle.Parse
    c) sqlHandle.Execute
    After the SQL handle (client cursor) has been executed, the client can fetch rows from it.
    This is what SQL*Plus does automatically for you, without you having to write the code to do it. SQL*Plus CONNECT command create a database connection handle. You enter a SELECT statement and SQL*Plus creates a SQL handle (client cursor), executes it, fetches from it, displays the rows, and closes the SQL handle when done.
    The same applies to PL/SQL. You can use a SELECT statement just like that in PL/SQL. E.g.
    declare
      i integer;
    begin
      select count(*) into i from emp where deptid = 123;
    end;This is called an implicit cursor. PL/SQL creates (just like SQL*Plus) an implicit client cursor. It creates and disposes of that client SQL handle for you - you do not need to do it.
    Or, you can create an explicit cursor. E.g. declare
      cursor c is select count(*) from emp where deptid = 123;
      i integer;
    begin
      open c;
      fetch c into i;
      close c;
    end;The question as to when to use implicit (client) cursors versus explicit (client) cursors depends on your requirements. Do you need to cycle through the results of the SQL? Etc.
    And keep in mind that in either case, the SQL Engine creates a SQL cursor anyway on its side.

  • How to reset report to first pagination page each time it runs?

    On a report with paging...heres the scenario:
    Go to page 2 and run a report.
    The report has 100 rows which page by 15 rows at a time.
    I go to the 3rd pagination page which has rows 45-60.
    I then navigate to page 300 in the application and do whatever.
    When I return to page 2, it is still on the 3rd pagination page.
    but I want it to return to the 1st pagination page.
    How do I make sure every query returns to its first pagination page rather to the page I was last on?
    Thanks,
    Linda

    You can also create a process on Page 2 that resets the pagination based on whether or not the current request is a next/prev page.
    Create a pagination reset process on page 2, then condition it with a PL/SQL expression of
    (:REQUEST IS NULL) OR (:REQUEST NOT LIKE 'pg_R_%')
    This is based on Vikas' recommendation at Re: How to reset pagination

Maybe you are looking for

  • File History not Working in Windows 8.1

    Ever since I upgraded from 8.0 to 8.1, File History has not worked. I've progressed from Event 202 to Event 204, but no resolution. Using an external Seagate backup drive - have scanned and reformatted that drive. Still no back ups. Seems File Histor

  • No HDMI output from Aja IoHD

    I have Final Cut Studio 6.0.4, Aja Io HD driver 6.0.1 on a Mac Pro with 10.5.5 and QT 7.5 Using ProRes as default, capturing component SD (625i) works just fine. I can see my footage on my preview monitor over CVBS. But I can't get any output on HDMI

  • WBS and NPLNR for Vendor Items in BSIK and BSAK  Table

    Hi  FI Experts, I created a PR for Network  . While creating PO for the PR  the network values are flowing into  PS_PSP_PNR and NPLNR of EKKN fields  . While doing a MIGO also the WBS and NPLNR are flowing to MSEG table  appropriate fields . While do

  • Nokia 6230i, cannot connect bluetooth phone to pc

    I have just brought a 6230i, i have paired my pc and my phone, and i can transfer from the pc to the phone, but i cannot transfer from my phone to the pc via bluetooth, it comes up with no devises found, eventhough its paired. My network is o2.

  • How do I make New window open maximized the way it used to?

    How do I make New window open maximized the way it used to?