The explicit cursor attributes

Hi all
As is the 'first' or 'last' explicit cursor attributes, possible to get second and last-but-one records? Let me know how to do it.
Thanks in advance,
Shaw.

As far as I know, 'first' or 'last' are not the slider attributes but collection methods.
For the second and last-but-one element in the collection, you can use NEXT and PREVIOUS versions after the FIRST and the LAST.

MyColl. NEXT (mycoll. FIRST)

is the second

MyColl. PRIOR (mycoll. THE LAST)

is the last-but-one

Link: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/collections.htm#i27396

Max

Tags: Database

Similar Questions

  • Explicit cursor, column from several tables in a variable

    Here's the situation. This DB has tables of metadata. An example of table name would be g3e_attribute. Once you insert a record in a metadata table a trigger of executions insert and insert records in the g3e_attribute_0009 table (table of language, this is what I call it). It would insert in g3e_attribute_000C is the default language is the French. There is also a delete trigger so that if you delete a record in a table of metadata it deletes the corresponding language table. Well, somehow we have entered the language tables that are not in the metadata table. A problem with the system.

    There are 139 tables of language so I prefer not to do it manually.


    So I'm keen to make this code

    delete < table language > where < primary > not in (select < primary > in < metadata table >).

    So I need to loop through the table and and the corresponding primary keys.

    I have this code to get the table names
    Select table_name, substr (table_name, 0, (length (table_name)-5)) in all_tables where table_name like 'G3E_ % _000% ';

    This will display both the language metadata tale table names and.
    The table of language with either _0009 or _000C as a suffix, I take everything but the last 5 characters to get the table metadata.

    And I have the code to find the primary key of the table.
    SELECT column_name FROM ALL_CONS_COLUMNS A JOIN ALL_CONSTRAINTS C ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME WHERE 'G3E_LEGENDENTRY' AND C.CONSTRAINT_TYPE = C.TABLE_NAME = 'P ';


    So I just need to loop through all the tables. Put these pieces together, that's where I encountered a problem. I started to do a procedure, but I ran into a problem.

    When you loop, you move the record being the explicit cursor in a variable. Well, you can set the variable as a vertain column type (%), or type (%ROWTYPE) of the line. Although the sql I use to create the cursor takes columns from multiple tables and returns three columns. So I'm not sure how ot define the variable. The only work around I found was to make a table column_name that contains the table table,. Define the variable as rowType.

    Is there an easier way to do this?


    Thank you

    A couple of points.

    You should not really mix ansi joins and joins in the place where clause. Choose a style and stick to it.

    You can't do the DDL directly in pl/sql. You need to do this, use dynamic sql. something like:

    create or replace
    PROCEDURE SYNC_LANGMETATABLES AS
    
    CURSOR c_TABLE_PRIMARY IS
       select D.table_name, substr(D.table_name,0,(length(D.table_name)-5)),
              column_name
       from all_tables D,
          JOIN ALL_CONSTRAINTS C
             on C.TABLE_NAME = D.TABLE_NAME
          join ALL_CONS_COLUMNS A
             ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
       where D.table_name like 'G3E_%_000%' AND
             C.CONSTRAINT_TYPE = 'P';
    
       v_LANGTABLE ALL_TABLES.TABLE_NAME%TYPE;
       v_METATABLE ALL_TABLES.TABLE_NAME%TYPE;
       v_PRIMKEY ALL_CONS_COLUMNS.COLUMN_NAME%TYPE;
    
    BEGIN
       OPEN c_TABLE_PRIMARY;
       LOOP
          FETCH c_TABLE_PRIMARY INTO v_LANGTABLE,v_METATABLE,v_PRIMKEY;
          EXIT WHEN c_TABLE_PRIMARY%NOTFOUND;
          execute immediate 'delete from '||v_langtable||' where '||v_PRIMKEY||
                            ' NOT IN(SELECT '||v_PRIMKEY||' FROM v_METATABLE)';
       END LOOP;
       CLOSE C_TABLE_PRIMARY;
    END;
    

    John

  • Ref Cursor on implicit and explicit cursors

    Hello

    In my company the drafting of PL/SQL procedure, everyone uses "Ref Cursor",
    But the article below, said implicit is the best, then Explicit and Ref Cursor...

    [http://www.oracle-base.com/forums/viewtopic.php?f=2 & t = 10720]

    I'm a bit confused by this, can someone help me understand this?

    Thank you

    SeshuGiri wrote:

    In my company the drafting of PL/SQL procedure, everyone uses "Ref Cursor",
    But the article below, said implicit is the best, then Explicit and Ref Cursor...

    [http://www.oracle-base.com/forums/viewtopic.php?f=2&t=10720]

    I'm a bit confused by this, can someone help me understand this?

    It has performance and it has performance...

    To explain. There is one type of cursor in Oracle - that is the cursor which is analyzed and compiled by the SQL engine and stored in the shared the database pool. The "+ client +" then receives a handle (called a SQL statement handle of many APIs) that can be used to make reference to this slider in the SQL engine.

    The performance of this slider is not determined by the customer. It is determined by the execution plan and how much enforcement of this slider cost ito of server resources.

    The customer can be Java, VB, .net - or a PL/SQL program. This client language (SQL client), has its own structures dealing with this from the SQL engine cursor handle.

    It can hide by the developer all together - so that they can't even see that there is a statement handle. That's what the implicit cursors in PL/SQL.

    It can allow the developer to manually define the structure of slider - this is what the explicit cursors, ref Cursor and DBMS_SQL cursors in PL/SQL.

    Each of these client cursor structures provides the programmer with a set of features to address different SQL cursor. Explicit cursor in PL/SQL constructs do not have the use of dynamic SQL statements. REF CURSOR and cursors DBMS_SQL do. REF CURSOR does not allow the programmer determine, at runtime, the structure of the projection of the cursor SQL. DBMS_SQL sliders do.

    Only ref Cursor can be created in PL/SQL and then handed over to another client (for example, Java/VB) for treatment. Etc.

    If each of the works of art/customer interfaces gives you a different feature for SQL cursors.

    Choose the implicit cursors for example does not the SQL cursor move faster. The SQL engine does not know and does not care, which customer construct you use to deal with the SQL cursor handle, he gave you. It does not matter. It does not affect his performance of cursor SQL.

    But on the client side, it can matter - if your code when dealing with that SQL cursor determines how fast your interaction with this SQL cursor is. How many context changes you make. How you use and reuse the SQL (for example hard vs soft analysis vs analysis reusing the same cursor handle). Etc.

    Are there any unique client cursor construction which is better? N °

    It's ignorant views. The customer's language provides a box tool, where each tool has a specific application. The competent developer will use the right tool for the job. The stupid developer will select a tool and use it as The Hammer to 'solve' all problems.

  • variable binding can be used for the table in an explicit cursor

    I have an application that accesses a table on several different servers. I created a ref for the slider cursor variable and a varchar2 variable to define my query. variable I_server is a parameter to my procedure. Is it possible to rewrite the v_query using bind variable for the table/Server? I have included below v_query.

    v_query: = "SELECT rp.usr_id, rp.sun_sft_cat, rp.sun_start, rp.sun_hrs," |
    "rp.mon_sft_cat, rp.mon_start, rp.mon_hrs, |
    "rp.tue_sft_cat, rp.tue_start, rp.tue_hrs, |
    "rp.wed_sft_cat, rp.wed_start, rp.wed_hrs, |
    "rp.thu_sft_cat, rp.thu_start, rp.thu_hrs, |
    "rp.fri_sft_cat, rp.fri_start, rp.fri_hrs, |
    "rp.sat_sft_cat, rp.sat_start, rp.sat_hrs, |
    "rp.sun_sft, rp.mon_sft, rp.tue_sft, rp.wed_sft, |
    "rp.thu_sft, rp.fri_sft, rp.sat_sft, nvl (ei.wip_permanent_sched_seq, 0) ' |
    'FROM ' | I_server | "rp, wip_emp_information ei, |
    'wes, wip_emp_status_type West wip_emp_status' |
    "WHERE rp.usr_id = ei.employee_id' |"
    "AND wes.employee_id = ei.employee_id' |"
    "AND wes.status_type = west.status_type' |"
    "AND west.description =" STOREKEEPER "' |"
    "AND wes.effective_date = (SELECT MAX (wes2.effective_date)' |)"
    "OF wip_emp_status EMTE.2 |
    "WHERE wes2.status_type = wes.status_type' |"
    "AND wes2.employee_id = wes.employee_id' |"
    (' AND wes2.effective_date < = trunc (SYSDATE))' |
    "AND wes.status = rp.wk AND"Y"= 1'; -wk = 1 is the schedule for next week

    Rp_sched_cursor OPEN FOR v_query;

    If your intention is to do this:

    v_query := 'SELECT rp.usr_id, rp.sun_sft_cat, rp.sun_start, rp.sun_hrs,' ||
    ' rp.mon_sft_cat, rp.mon_start, rp.mon_hrs,' ||
    ' rp.tue_sft_cat, rp.tue_start, rp.tue_hrs,' ||
    ' rp.wed_sft_cat, rp.wed_start, rp.wed_hrs,' ||
    ' rp.thu_sft_cat, rp.thu_start, rp.thu_hrs,' ||
    ' rp.fri_sft_cat, rp.fri_start, rp.fri_hrs,' ||
    ' rp.sat_sft_cat, rp.sat_start, rp.sat_hrs,' ||
    ' rp.sun_sft, rp.mon_sft, rp.tue_sft, rp.wed_sft,' ||
    ' rp.thu_sft, rp.fri_sft, rp.sat_sft, nvl(ei.wip_permanent_sched_seq, 0)' ||
    ' FROM ' || :b0 || ' rp, wip_emp_information ei,' ||      --- Note the bindvariable...
    ' wip_emp_status wes, wip_emp_status_type west ' ||
    ' WHERE rp.usr_id = ei.employee_id' ||
    ' AND wes.employee_id = ei.employee_id' ||
    ' AND wes.status_type = west.status_type' ||
    ' AND west.description = ''WAREHOUSE EMPLOYEE''' ||
    ' AND wes.effective_date = (SELECT MAX(wes2.effective_date)' ||
    ' FROM wip_emp_status wes2' ||
    ' WHERE wes2.status_type = wes.status_type' ||
    ' AND wes2.employee_id = wes.employee_id' ||
    ' AND wes2.effective_date <= trunc(SYSDATE))' ||
    ' AND wes.status = ''Y'' AND rp.wk = 1'; -- wk = 1 is next week's schedule
    
    OPEN rp_sched_cursor FOR v_query USING i_server;
    

    So the answer is: no, you can do that.

    But then, my question would be: why would you do that?
    I guess that you have many "different servers. A cursor on the server will not hurt you.

  • Explicit cursor and Order by clause

    Dear Oracle experts,

    I am facing a strange situation:

    SQL > DECLARE

    2 CURSOR c_1

    3 EAST

    4 (SELECT 1 FROM DUAL to 1);

    5. start

    6 NULL;

    7 end;

    8.

    (SELECT 1 FROM DUAL to 1);

    *

    ERROR on line 4:

    ORA-06550: line 4, column 27:

    PL/SQL: ORA-00907: lack the right parenthesis

    ORA-06550: line 4, column 7:

    PL/SQL: SQL statement ignored

    But:

    SQL > DECLARE

    2 CURSOR c_1

    3 EAST

    4. SELECT 1 FROM DUAL;

    5. start

    6 NULL;

    7 end;

    8.

    PL/SQL procedure successfully completed.

    SQL > START

    2 FOR an IN (SELECT 1 FROM DUAL BY 1)

    LOOP 3

    4 NULL;

    5 END OF LOOP;

    6 END;

    7.

    PL/SQL procedure successfully completed.

    This means that I can't use ORDER BY explicit cursor? Or there is another logical explanation?

    Thanks in advance.

    No, it means that you can have an order by parentheses unless it is part of the outer query.

    declare

    Cursor c_1

    is

    Select 1

    of the double

    order by 1;

    Start

    null;

    end;

    /

    will work, as well as

    declare

    Cursor c_1 is

    Select *.

    (select 1

    of the double

    order by 1);

    Start

    null;

    end;

    /

  • Implicit vs explicit cursor

    Hello

    I read somewhere that the implicit cursor is used in the sql statement only returns a single line and explicit cursor is used when the sql statement returns several lines.
    I did not understand it. Why is it so? Can we not use cursor name when Sql returns multiple lines or explicit only one line?
    can someone explain this for example.

    Thank you
    AB

    AB312062 wrote:

    I read somewhere that the implicit cursor is used in the sql statement only returns a single line and explicit cursor is used when the sql statement returns several lines.

    Fake.

    I did not understand it. Why is it so? Can we not use cursor name when Sql returns multiple lines or explicit only one line?
    can someone explain this for example.

    Explicit cursor - allows you to set the cursor "overall" (e.g. pakage body) and reuse them several times in different procedures/functions in this package.

    Explicit cursor - allows you to bulk explicit code collect and have direct access to the collection.

    Implicit cursor - neither of the above is true, but the implicit cursor still has bulk of collection in the scenes, requires less code instructions to create (and no need to explicitly close the cursor either).

    An implicit cursor might look as follows:

    declare
      type TObjectNames is table of varchar2(30);
      names TObjectNames;
      name varchar2(30);
    begin
      --// single row fetch
      select object_name into name from user_objects where object_id = 123;
    
      --// bulk fetch
      select object_name bulk collect into names
      from user_objects where object_type = 'TABLE'
      order by 1;
    
      --// for loop
      for c in (
        select object_name bulk collect into names
        from user_objects where object_type = 'TABLE'
        order by 1
      ) loop
        do something with row c
      end loop;
    end;
    
  • Better explicit cursor or bulk collect?

    Could someone tell me when it is best to use a classic explicit cursor fetch a line at the time and when it is better to use a big raise to load of N lines in time? They seem almost the same for me and so I would get a few tips when it would be better to use one or the other?
    Thank you!

    COLLECTION in BULK is known as the 'extraction of the table. In Sql * plus you can set up the table easily by issuing 'define the table .
    Number can be as small as 1.
    SQLNet will try to send all the lines requested by the extraction of table in 1 package. So each retrieval table is a round trip, most often, you retrieve the latency plus you get, because of sqlnet.

    Even worse: Oracle assumes not the result set has not changed between extractions, then it will issue gets in line to each extraction.

    Extract each line one by one, and you will get additional average IO.

    Not to mention the Oracle has a motor of SQL and PL/SQL, and line-by-line recovery often results between the two drivers of change of context .

    So are they the same? A resounding No.!

    It's partly why in Oracle 10 g and higher ranks are automatically retrieved in the tables, even if you still go get one and subscribe to slow by slow programming.

    ---------------
    Sybrand Bakker
    Senior Oracle DBA

  • Turn the mouse cursor

    This only happens when I visit Facebook, but the mouse cursor turns and will not stop. Firefox will never block or unresponsive, but it behaves as if there is always from my PC 'think '. Any ideas on how to stop my cursor to turn constantly?


  • When I click on the 'Get' button in the app store for El Capitan, the beachball cursor rises and crashes the app store (not responding) in the force quit window...

    When I click on the 'Get' button in the app store for El Capitan, the beachball cursor rises and crashes the app store (not responding) in the force quit window...

    How can I fix it?

    Nevermind, I restarted the computer and it was fixed

  • The mouse cursor disappears on the address and search bars.

    In Firefox 10, the mouse cursor disappears from the address bar or the search bar after a certain time, or I guess that after visiting a site that I paste below. I don't see what part of the word I click on the address bar or the search bar for the correction because there is no mouse cursor. After clicking on tools and options cancel, the mouse cursor appears (I make no changes to the options) or when I click on customize in the navigation bar, then the icons I click on Cancel again without modification, and the mouse cursor appears again (as you can understand some trigger for windows option implementation even without change is done). I uninstalled firefox 10 just for this reason. Back to Firefox 9. Safe mode - same problem happens. So no problem addon. And the same thing happened in another operating system, so this isn't a fault of a facility.

    Problem solved for me in the last version of firefox v.10.0.1

  • Size of the text cursor (insertion point)?

    How can I control the size of the text cursor (insertion point)? The Windows setting in Accessability Options of the Panel seems to ignore Firefox.

    Try to create these two integer prefs:

    ui.caretWidth
    ui.caretBlinkTime (milliseconds;use 0 to disable blink)
    

    To open the topic: config page, type Subject: config in the address bar (address) and press the 'Enter' key, as you type the url of a Web site to open a Web site.

    If you see a warning then you can confirm that you want to access this page.

    • Use the filter at the top bar of the on: page config to more easily spot a preference.
    • Preferences that have changed also show "BOLD" (user set).
    • Preferences can be reset to the default value using the context menu if they are set of users
    • Preferences can be changed via the context menu: Edit (string or integer) or toggle (Boolean)
  • Bookmark shortcut does not work if the mouse cursor is focused in the version of the flash plugin.

    I tried to open the bookmark panel shortcut [ctrl + shift + B] buttons when the mouse cursor is focused with the flash plugin. But it does not open. But I clicked on the page and he's trying again, he opens the bookmark panel.
    Try the following link
    [Example: https://learnable.com/courses/a-crash-course-in-mobile-web-design-195]

    This may or may not be a problem.
    It's just a suggestion...

    This is a limitation of the works in Firefox.

    If a plugin is developed, which makes this shortcut key is no longer so he treats all keys work.

    You have to click outside the plugin, if you need to use a keyboard shortcut.

  • The mouse cursor disappears when iTunes movie go full screen

    This isn't a question... actually I found a hack solution to this bug and I wanted to share it with other people having the same problem.

    Since the upgrade of the OS X El Capitan, I'm having a problem with my cursor disappears randomly. It is very repetitive if I start a video in iTunes with the enlarged screen and the cursor disappears. Indeed, after entering mode full-screen, iTunes mask the cursor of the mouse that is predictable. The problem is that iTunes may not reappear there again once, for example, when I go to another office for a temporary job.

    Move the mouse does nothing, escaping mode full screen does not come back. It is very annoying. Like I had never had such a frustrating experience prior to a new installation of El Capitan 10.11.3 and update iTunes to 12.3.3, I thought that this is due to the update to iTunes. So, I made another new facility of El Capitan, this time without updating iTunes. But the problem still exists. It is interesting that I had this problem on my MacBook Pro 17 "end 2011 and not with my iMac 21.5" mid-2009!

    After a little research, I found that this bug is not because of El Capitan, and happened randomly in the other years dating back to Tiger and maybe before.

    Only new change I had made in my MBP Preferences system , was in the part of accessibility, and it was related to Zoom. I had always used this feature, but I put the Zoom Style 'full-screen'. This time (after the new installation of El Capitan), I had changed to 'Picture-in-Picture'.

    I changed the Style of zoom "full screen" even once, and the problem resolved.

    If this does not work for you, can be debilitating, other options, such as 'Use keyboard shortcuts to zoom' or 'Use of scrolling with keys of change to zoom movements,' can solve the problem.

    We all know that it is a bug, and he has been there for a long time. I found that many people had reported it to Apple, but the problem persists.

    For those of you who want to use the zoom "Picture-in-Picture" style, or set the zoom style full screen does not solve the problem of their mouse disappears, I will mention a few ways to recover the mouse cursor. The following solutions are applied to a mouse cursor disappeared after entering the movie to iTunes (or any other application) full screen.

    1. Move the mouse until the switching Office brings back the cursor. Now, you can switch the desktop computer and do whatever you want. (It's easier work, at least for me).
    2. Use Alt - Tab to switch to another program; This will bring the mouse cursor.
    3. Press Ctrl + F2 to activate the Apple menu. (You can also move your cursor away to top left and click to activate the menu.)
    4. Press Ctrl + up arrow (or swipe up with 4 fingers on the touchpad) to activate the control of the Mission.

    You can also find other ways to retrieve the cursor of your mouse.

    Hope this can help you with the mouse pointer disappears.

    In MBP El Capitan the pointer of the mouse is where you assign to ' picture in picture ' or 'full screen '.

    If you miss your mouse pointer, accessibility-> display "Shake mouse to locate" check to find your mouse pointer. It should be there.

    Note: you have posted in the discussion of the Mavericks, should have used the ElCapitan discussion...

  • Qosmio G20 - the mouse cursor freezes

    Play command and conquer tiberium wars a coupke of minutes in the game, the mouse cursor will feeze not allowing me to select units, etc.. I have to use Ctrl, alt, del to exit the game. This does not in all the other games that I used on the laptop. Is there something I can do?

    Details of my laptop are: the present report time: 24/03/2008, 09:49:38
    Machine name: YOUR-3CB2BF2DC5
    Operating system: Windows XP Professional (5.1, Build 2600) Service Pack 2 (2600.xpsp_sp2_gdr.070227 - 2254)
    Language: English (regional setting: English)
    System manufacturer: TOSHIBA
    System model: Qosmio G20
    BIOS: v1.30
    : Processor Intel (r) Pentium (r) M 2.26 GHz
    Memory: 1024 MB RAM
    Page file: 508 MB used, 1952 MB of available space
    Windows Dir: C:\WINDOWS
    DirectX version: DirectX 9 .0c (4.09.0000.0904)
    DX setup parameters: not found
    DxDiag Version: 5.03.2600.2180 32 bit Unicode

    Hello

    If I understand your game freeze but who knows why this happen. As you can see it happen with this game only.
    Have you tried to delete this game and make new facility?

  • Y at - it a button to avoid having the explicit songs to play?

    I like listening to iTunes while at work and my co-workers generally enjoy listening too. The question I constantly meet is inappropriate explicit lyrics. Have you developed a framework or switch check that will remove the explicit versions of songs? It would be quite surprising that the explicit songs would automatically return the edited versions. You're Apple. You are the best. You can do it!

    -Andy

    This is a user to user forum and Apple is unlikely to read your message.  Feedback is better addressed to the:

    http://www.Apple.com/feedback/itunesapp.html

    I don't know if what you want is part of parental controls in iTunes > Preferences.  I suspect these control just what is bought at the iTunes Store and not reading what is already on the computer. It would be possible to do something with smart playlists where you select the content in the library except those marked as explicit.

Maybe you are looking for