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;

Tags: Database

Similar Questions

  • 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.

  • Explain implicit and explicit curesor for example?

    Explain implicit and explicit curesor for example?

    Is less than the example of implicit cursor belogs?

    Set serverout
    Start
    I'm in (select * from emp)
    loop
    dbms_output.put_line (i.empno);
    end loop;
    end;

    All THE SQLs are analyzed and stored and runs under the cursor. These are stored in shared SQL database Pool.

    You can view the contents of the shared pool (and sliders inside it) using the V$ SQLAREA and other views of virtual performance.

    The concept of a cursor implicit and explicit cursor is a concept of LANGUAGE - not a SQL concept. It depends on how this language (client) (PL/SQL or Java or C/C++ or Delphi or c# and Perl, etc.) implements its interface language for SQL cursors created in Shared Pool data.

  • What representations using implicit or expicit cursor?

    Don't you be any considaration to use implicit or explicit cursors? I would like to know, especially in terms of performance, when and if it is better to choose betweeen implicitly and a explicit cursor. I'm working on Oracle. 8.1.7
    Thanks in advance.

    Mark1970 wrote:
    Don't you be any considaration to use implicit or explicit cursors? I would like to know, especially in terms of performance, when and if it is better to choose betweeen implicitly and a explicit cursor. I'm working on Oracle. 8.1.7

    There is no difference from the point of view SQL Shared Pool. All SQLs are analyzed as cursors and stored in the shared Pool.

    The SQL engine returns a handle or reference (you can even call a pointer) to the language of the client (Java, PL/SQL, etc.) that he send the SQL statement.

    So the SQL engine, there is no difference. He does not care how the client will use that face returned. If the customer uses this handle as an implicit cursor handle, an explicit cursor handle, the ref, the handle for DBMS_SQL cursor cursor handle... or whatever. He is indifferent to the SQL cursor in the pool shared SQL. He cannot do this slider faster or slower execution.

    On the client side, there are several reasons why it can use this handle to SQL cursor returned by the SQL engine as a variable of implicit cursor or explicit... or as a ref cursor variable These reasons dictate which is the best tool for the job at hand - and the programmer must understand these and select the right tool for the job.

    There is therefore no such thing as an implicit cursor being better or faster than a cursor, explicit, or vice versa. Both are tools to deal with a SQL cursor in the SQL engine. A procedure/package can use this SQL cursor via an implicit cursor variable. An another procedure/package can use the same SQL cursor via an explicit cursor variable.

    So it's not that one is better.

    It's the programmer understand that a cursor is, HOW the client implements access to this SQL cursor via variables of cursor cursor cursor/DBMS_SQL Ref. variables or explicit/implicit... and by CHOOSING the more it is necessary to perform the task at hand.

  • Null implicit and explicit null

    Hi experts,

    I met two terms which is null implicit and explicit null and I were confused.

    anyone can try to explain what that means exactly by both of these terms.

    Implicit-null I understood - it's the last jump announce a lambel in 3 to indicate that it as implicit-null

    Please suggest

    Concerning

    Mahesh

    Hello

    Explicit and implicit null labels are generated by the router to the last jump to its neighbors.

    Implicit null is the default which means penultimate router must only send IP packet thus, it appears the label (the label known as PHP and it is done to reduce the load on the router of the last jump to burst). One of the drawbacks in implicit null approach is if the network is configured for QoS based on MPLS EXP bits, QoS is lost between the penultimate router and router the last jump.

    In this case, we can make use of Explicit null which means router penultimate jump does not jump label. It sends with the value of the label of 0 but with other areas including intact EXP bits. This way QoS treatment is kept between penultimate router and router the last jump. Explicit null value must be configured manually in the router of the last jump.

    HTH.

    Arun

  • 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;

    /

  • 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

  • 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

  • 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

  • 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

    Hello

    I wrote a procedure to return the dates like this:
    CREATE OR REPLACE
    PROCEDURE retrieve_pdf
      (
        p_invid IN INVOICE_DETAIL.invd_inv_id%TYPE,
            p_date OUT generated_agency_appl_form.gaaf_creation_date%TYPE)
    IS
      CURSOR date_cursor
      IS
         SELECT gaaf_creation_date
           FROM generated_agency_appl_form
                WHERE gaaf_id=
          (SELECT invd_id FROM invoice_detail WHERE invd_inv_id=p_invid
          );
    BEGIN
        OPEN date_cursor;
      LOOP
        FETCH date_cursor INTO p_date;
        EXIT
      WHEN date_cursor%NOTFOUND;
            DBMS_OUTPUT.put_line(p_date);
          END LOOP;
        CLOSE date_cursor;
      END retrieve_pdf;
    And I executed the procedure as follows:
    DECLARE
    
    p_invid   INVOICE_DETAIL.invd_inv_id%TYPE;
            p_date  generated_agency_appl_form.gaaf_creation_date%TYPE;
        
    BEGIN
    
    p_invid:=105;
    
    retrieve_pdf(p_invid,p_date);
    
    END;
    And I get the error like this
    Error starting at line 1 in command:
    DECLARE
    
    p_invid   INVOICE_DETAIL.invd_inv_id%TYPE;
        --p_formid IN application_form.afrm_id%TYPE,
       -- p_email  application_form.afrm_agency_e_addr%TYPE;
        --p_pdf OUT generated_agency_appl_form.gaaf_form%TYPE)
        p_date  generated_agency_appl_form.gaaf_creation_date%TYPE;
        
    BEGIN
    
    p_invid:=105;
    
    retrieve_pdf(p_invid,p_date);
    
    END;
    Error report:
    ORA-01427: single-row subquery returns more than one row
    ORA-06512: at "DBA_PDF3.RETRIEVE_PDF", line 11
    ORA-06512: at "DBA_PDF3.RETRIEVE_PDF", line 35
    ORA-06512: at line 13
    01427. 00000 -  "single-row subquery returns more than one row"
    *Cause:    
    *Action:
    Can someone help me with this

    Thank you

    Hello

    I made changes to your processes and I added some of the data in your tables. In your procedure, you were trying to RECOVER email_cur INTO p_email - this will be translated by mistake
    Also if you can post 1 example form to each of your table that would be useful to solve the problems.

    Results are already read in the slider, just need a loop on it

    CREATE OR REPLACE PROCEDURE retrieve_pdf (p_invid IN invoice_detail.invd_inv_id%TYPE,
                                              p_email OUT application_form.afrm_agency_e_addr%TYPE,
                                              p_date OUT generated_agency_appl_form.gaaf_creation_date%TYPE
    )
    IS
       CURSOR date_cursor
       IS
          SELECT gaaf_creation_date
          FROM generated_agency_appl_form
          WHERE gaaf_id IN (SELECT invd_id
                            FROM invoice_detail
                            WHERE invd_inv_id = p_invid);
    
       CURSOR email_cur (p_invid IN invoice_detail.invd_inv_id%TYPE)
       IS
          SELECT afrm_agency_e_addr p_email
          FROM application_form
          WHERE afrm_id IN (SELECT invd_lp_id
                            FROM invoice_detail
                            WHERE invd_inv_id = p_invid);
    BEGIN
       OPEN date_cursor;
    
       LOOP
          FETCH date_cursor INTO p_date;
    
          EXIT WHEN date_cursor%NOTFOUND;
    
          FOR ecur IN email_cur (p_invid)
          LOOP
             DBMS_OUTPUT.put_line (ecur.p_email || '-' || p_date);
          END LOOP;
       END LOOP;
    
       CLOSE date_cursor;
    EXCEPTION WHEN OTHERS THEN
    DBMS_OUTPUT.PUTLINE(SUBSTR(SQLERRM, 1, 200));
    RAISE;
    END;
    

    Data

    SET DEFINE OFF;
    Insert into SCOTT.APPLICATION_FORM
       (AFRM_ID, AFRM_SHORT_NAME, AFRM_DESCRIPTION, AFRM_CREATOR_USERID, AFRM_CREATION_DATE, AFRM_UPDATE_USERID, AFRM_LAST_UPDATE, AFRM_AGENCY_E_ADDR)
     Values
       (1, 'MYALARM', 'MY NEW ALARM', '1', TO_DATE('12/27/2008 18:56:09', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 18:56:18', 'MM/DD/YYYY HH24:MI:SS'), '[email protected]');
    Insert into SCOTT.APPLICATION_FORM
       (AFRM_ID, AFRM_SHORT_NAME, AFRM_DESCRIPTION, AFRM_CREATOR_USERID, AFRM_CREATION_DATE, AFRM_UPDATE_USERID, AFRM_LAST_UPDATE, AFRM_AGENCY_E_ADDR)
     Values
       (105, 'MYOTHERALARM', 'WHY ALARM', '105', TO_DATE('12/27/2008 19:00:28', 'MM/DD/YYYY HH24:MI:SS'), 105, TO_DATE('12/27/2008 19:00:32', 'MM/DD/YYYY HH24:MI:SS'), 'myotheraddress');
    
    Insert into SCOTT.INVOICE_DETAIL
       (INVD_ID, INVD_INV_ID, INVD_LP_ID, INVD_FEE, INVD_CEPAS_CONFIRM, INVD_DATE_PAID, INVD_DELETE_IND, INVD_AGSK_SKU_NBR, INVD_CREATOR_USERID, INVD_CREATION_DATE, INVD_UPDATE_USERID, INVD_LAST_UPDATE)
     Values
       (1, 1, 2, 22, '335s', TO_DATE('12/27/2008 18:58:17', 'MM/DD/YYYY HH24:MI:SS'), '1', 1, 1, TO_DATE('12/27/2008 18:58:28', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 18:58:36', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SCOTT.INVOICE_DETAIL
       (INVD_ID, INVD_INV_ID, INVD_LP_ID, INVD_FEE, INVD_CEPAS_CONFIRM, INVD_DATE_PAID, INVD_DELETE_IND, INVD_AGSK_SKU_NBR, INVD_CREATOR_USERID, INVD_CREATION_DATE, INVD_UPDATE_USERID, INVD_LAST_UPDATE)
     Values
       (105, 105, 105, 2323, '3343a', TO_DATE('12/27/2008 19:01:10', 'MM/DD/YYYY HH24:MI:SS'), '1', 1, 1, TO_DATE('12/27/2008 19:01:19', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 19:01:23', 'MM/DD/YYYY HH24:MI:SS'));
    
    Insert into SCOTT.GENERATED_AGENCY_APPL_FORM
       (GAAF_ID, GAAF_AAFRM_ID, GAAF_GENERATION_DT, GAAF_CREATOR_USERID, GAAF_CREATION_DATE, GAAF_UPDATE_USERID, GAAF_LAST_UPDATE)
     Values
       (1, 1, TO_DATE('12/27/2008 18:58:50', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 18:58:55', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 18:59:02', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SCOTT.GENERATED_AGENCY_APPL_FORM
       (GAAF_ID, GAAF_AAFRM_ID, GAAF_GENERATION_DT, GAAF_CREATOR_USERID, GAAF_CREATION_DATE, GAAF_UPDATE_USERID, GAAF_LAST_UPDATE)
     Values
       (105, 105, TO_DATE('12/27/2008 19:01:33', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 19:01:36', 'MM/DD/YYYY HH24:MI:SS'), 1, TO_DATE('12/27/2008 19:01:40', 'MM/DD/YYYY HH24:MI:SS'));
    
    COMMIT;
    

    Published by: OrionNet on December 27, 2008 19:26

  • Index unique creation implicit or explicit?

    I read Steve O'hearn 1zo - 047 manual p.404 he mentions:

    A unique index is the one who makes sure that a column in a table will contain unique

    information. The syntax to create a unique index is:

    CREATE A UNIQUE IX_EMP_SSN ON EMPLOYEES (SSN) INDEX;

    This is different from the UNIQUE constraint that you can apply to a column on

    a table. However, note that if you create a PRIMARY KEY or UNIQUE constraint

    on a table, a unique index will be created automatically with the constraint.

    Note that the UNIQUE constraint is more auto-documentent be in the database.

    However, Oracle Corporation recommends that officially single

    index to enforce the uniqueness in a column, for best results in the performance of the queries.

    OK, so the area in bold has me a little confused.  Is it saying that the Unique constraint index are more oriented for thin self-documentation so that we should create the Unique Index explicitly?

    Or is it simply that because the UK/PK document constraints because mentioning if it is recommended to create these constraints/index.

    Sorry for what may seem like a vague question, I did have the chance to work on the optimization of the indexes, or I would be able to return effectively this task at this time, so I thought I would ask for advice on the forums...

    Thank you.

    It is difficult to comment on the intention of the author.

    But note:

    1. a unique constraint by default creates a unique index if a suitable index does not exist already.

    2. a unique constraint can be monitored through a non-unique index if needed/wanted

    3. a unique constraint or primary key is required if the creation of a foreign key.

    4. If the index is created implicitly and you remove the constraint of the index is also deleted.

    5. If the index is created explicitly and you remove the constraint of the index remains.

    6. If you want a constraint can be delayed, then you will need a unique constraint and a non-unique index.

    7. you can use a unique index with an expression to apply conditional oneness.

    The constraint is certainly better than just a unique index self-documentation - I definitely see developer get confused when uniqueness is violated and that they get an error and they do not find a corresponding constraint.

  • When to use the cursor for loop and the cursor (open, fetch, close)

    Hello world
    I have a small doubt about when to use the cursor for loop and when to use the cursor for loop and the cursor (open, fetch, close).
    Well, I'm not the difference between implicit and explicit cursor. So please tell me how I got to know, what to use and when?




    Kind regards
    BS2012

    Published by: BS2012 on January 29, 2013 12:15

    All SQLs are analyzed, stored and executed as cursors. Thus, you will always use a cursor.

    The problem is that languages, such as PL/SQL, provide different interfaces to interact with the SQL cursor. As the ref, the slider interface, the interface DBMS_SQL slider interface and so on.

    Each of these interfaces offers different features. For example, using the interface DBMS_SQL allows binding dynamics and dynamic recovery. The Ref Cursor interface allows your code PL/SQL pass a handle to a reference pointing to the SQL cursor, to an external client. Etc.

    The fundamental reason for the use of an explicit cursor interface is mainly that you own and manage bulk made extraction output provided by PL/SQL cursor.

    With a cursor FOR , the motor loop of PL/SQL optimize the loop by extracting block a 100 lines both. However, you cannot access this collection in bulk directly inside the loop.

    With an explicit cursor interface, you specify the size of the extraction in bulk via the clause LIMIT , and you set the variable of collection to use. This allows you to use the collection directly variable inside the loop.

    However, the need to do - code manually in bulk collection - rarely occur in the daily programs in PL/SQL. A line of treatment is both slow and not well fits. And even if your bulk code collects lines, these lines must still be processed one at a time in your code. It is much more efficient and scalable rather write SQL code, and make the engine SQL the line of treatment for you.

  • Selection of data with or without the use of cursors in procedures

    Hello

    If we are able to access the data without using a cursor as shown below in a way:


    CREATE OR REPLACE PROCEDURE tmr_exception
    IS
    x LINK_STATUS. COUNTRY_CODE % TYPE;

    BEGIN
    SELECT COUNTRY_CODE LINK_STATUS x;

    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    dbms_output.put_line (' too many lines).
    WHILE OTHERS THEN
    dbms_output.put_line ("' another problem");

    END tmr_exception;
    */*

    So what is useful in the use of explicit cursors?

    (1) SELECT... Return exactly 1 row. If you try to deal with several rows of data, you will need another construction.

    (2) A SELECT... INTO opens a cursor. He has simply done implicitly. Just like

    BEGIN
      FOR emp_cur IN (SELECT * FROM emp)
      LOOP
        <>
      END LOOP;
    END;
    

    Opens an implicit cursor.

    (3) no implicit and explicit cursors these days are generally useful when you do treatment in bulk and you want to extract the data in a local collection.

    Justin

    Published by: Justin Cave on October 9, 2010 20:17

    (4) oh and you would never have in real code catch an exception and do nothing else than calling DBMS_OUTPUT. It's a quick way to produce a totally unmanageable code.

  • function work at the same time that the work can also do procedure...

    pls tel me major diff b/w cursor implicit vs explicit cursor and function procedure vs.

    Published by: 955345 on August 27, 2012 22:11

    Published by: Rousseau on August 28, 2012 11:08

    Rousseau wrote:
    k k bt

    What does that mean?

    function to do some work at the same time that work also can make procedure... Why work

    Function has the ability to be used in SQL, but cannot be a procedure.

    Basically, I use the procedure for transactional operation and function for Non-transactional operation. For example, if I have to update a table I would use a procedure to wrap my update statement. And if I have to do some calculations or run some select and return a result of Ref Cursor I would use a function.

    In addition to the technical restrictions of function and procedure its more the choices make us.

Maybe you are looking for

  • XP Home - can not connect after a change of drive assignment

    I am running XP Home Edition on a system of several disc. For historical reasons I run XP on the D: drive and it normally works fine. I also have a C, E, F and G drive. I wanted to change my d drive to C drive according to standard systems. I changed

  • Bluescreen when trying to get into safe mode - stop 0 x 00000124

    It seems normal to normal mode, but if I tried to go into safe mode, it started to load files and all of a sudden blue screen.The code was: stop 0 x 00000124 (0 x 000003, 0x00000000, 0x000000, 0x000000)the zeros in the above code may not be correct,

  • BootMGR is missing. Help, please!

    My BootMGR is missing when I started my computer Windows Vista Home Premium Zt. I tried to use a recovery disc for Windows Vista, but when I select 'Repair your computer' and I have to choose my operating system. It does not appear and when I click o

  • Netflix search works only in Windows Media Center (windows 7 pro or Home Premium)

    A couple of weeks, there is an update to the Netflix app and since then all 3 of my media center Netflix apps is no longer looking.  First error says "APPLICATION ERROR there is a problem with the application at this time. Try again later. "and the s

  • Update blackBerry Smartphones 'Personal data' problem then 7.1.0 Bundle 1149

    Hello Whenever I go to download the update of the software ' 7.1.0 Bundle 1149' it comes up with an error at the end by saying that I need to remove "21.4 MB of personal data", so I wonder about what exactly is 'personal data', so I can take advantag