Doubt in collection

Hi,
I have created one cursor in my procedure. Defined a collection of the cursor type. Created one variable of the collection type and used it to do my bulk insert into my temporary table.
Psuedo code
procedure abc
cursor c1 is select ....
type t1 is table of c1%rowtype
tab1 t1;
begin
t1.delete
When I use the t1.delete I am getting the error message stating that t1 is an uninitalised cursor.
To overcome the above error I changed the definition as
tab1 t1 = new t1();
My procedure is complied successfully but when I open the procedure in Toad its showing a wierd error message in the above line. But when I recompile its getting normal.
I am using oracle 9i release 2.
Please help me in resolving this issue.
Regards,
Subbu S

probably because when associative arrays where first introduced (and called "pl/sql tables"), you HAD to use binary_integer. I know that I've never gone back over code I wrote in v7 to change it to pls_integer, so it remains the same. plus, after years of typing "binary_integer", it becomes habit, and I still do it often without even thinking (even though oracle has recommended pls_integer since v8).

Similar Messages

  • Hi friends i have doubt on collect statement.

    i have some problem with matnr which is repeating no.of times. so i tried using collect and selected some of the fields to collect. Now i need to collect those collected elements in to internal table and need to display those fields in an ouput. for example.
    loop at sumtab.
    matnr type s886-matnr,
    avg1 type p decimals 3,
    total type p decimals 3,
    endloop.
    and now using loop  i am collecting. these fields using my itab.
    loop at itab.
    move-corresponding itab to sumtab.
    collect sumtab.
    clear sumtab.
    endloop.
    ***here itab contains no.of other fields like qty,stock etc.
    so after here i am using ALV to display the itab.
    my problem is how to make SUMTAB fields tobe moved in itab.

    Hi Kalyan,
       The collect statement works like this . (ex)
    data: begin of itab occurs 0,
          name(10) type c,
          value(4) type n,
          end of itab.
    itab-name = 'JACK'.
    itab-value = 100.
    append itab.
    itab-name = 'PAT'.
    itab-value = 200.
    append itab.
    itab-name = 'JACK'.
    itab-value = 200.
    append itab.
    sort itab.
    loop itab.
    collect itab.
    write: / itab-name, itab-value.
    endloop.
    <b>o/p:</b>
    JACK 300
    PAT  200

  • Doubt Regarding Collection Methods

    Hello,
    I am working on Oracle version 10g Release 2
    I wanted to know that how can we find a particular name (person) exists in a Collection..
    Below is my Code
    DECLARE
    TYPE nested_tab IS TABLE OF VARCHAR2(100);
    l_tab nested_tab := nested_tab();
    BEGIN
    SELECT e.ent_id BULK COLLECT INTO l_tab
    FROM entity_master e
    WHERE e.ent_id IN ('N002208', 'Z002011', 'V002313', 'X002011'..... & so on);
    IF l_tab.EXISTS('N002208') THEN
    dbms_output.put_line('element exists');
    ELSE
    dbms_output.put_line('NO element ');
    END IF;
    END;
    ORA-06502 - Numeruc or Value Error
    what can be the work around for this...?

    Aijaz Mallick wrote:
    Ok.
    But It would be really helpfull if you Elaborate this Example a Bit...
    I mean the I/O part because Quering table also Require I/OANY data that you need to access (in any computer system and language) requires I/O. That data needs to be read from disk (PIO or physical I/O) or buffer cache (LIO or logical I/O) and processed.
    So the important part is optimising I/O. If you only need 1MB of data from a 100GB data structure, you do not want to I/O that entire data structure to find that 1MB of data that is relevant to your code.
    The answer to this is three fold.
    Firstly, you design that data structure optimally. In databases, that means a proper and sound relational database model.
    Secondly, you implement that data structure optimally. In databases, that means using the most appropriate physical data model for storing that relational data model. Using the features like indexing, partitioning, index organised tables, and so on.
    Lastly, in some cases your requirements will require scanning a large volume of that data structure. Which means that there is no option but to use a lot of I/O. In such a case, parallelising that I/O is important. I/O has inherent latency. Which means idle time for your code, waiting for data to arrive from the I/O system. Parallel processing enables one to address this and increase performance and scalability.
    So what do you need to do with your "large" table?
    - make sure it is correctly modelled at a logical data model level
    - make sure it is optimally implemented physically in Oracle, making best use of the features that the Oracle RDBMS provide
    - when your code has to deal with large volumes of data, design and code for parallel processing
    & how about Java Part. ..?Java is worse than PL/SQL in this regard as the data path for data to travel from the database layer into Java is longer and slower than the same path to PL/SQL.
    Storing/caching that data in the application layer is an attempt to address the cost of this data path. But this is problematic. If another application makes a change to data in the database, the cached data in the application tier is stale - and incorrect. Without the application layer knowing about it.
    Storing/caching that data in the application layer means a bigger and more expensive h/w footprint for the application layer. It means that scaling also requires a cluster cache in the application layer to address scalability when more application servers are added. This is complex. And now reintroduce a data path that runs over the network and across h/w boundaries. Which is identical to the data path that existed between the database layer and application layer in the first place.
    It also makes the border between the database layer and application layer quite complex as caching data in the application layer means that basic database features are now also required in the application layer. It is an architectural mess. Contains complex moving parts. Contains a lot more moving parts.
    None of this is good for robustness or performance or scalability. Definitely not for infrastructure costs, development costs,and support and maintenance costs, either.
    In other words, and bluntly put. It is the idiotic thing to do. Unfortunately it is also the typical thing done by many J2EE architects and developers as they have a dangerous and huge lack of knowledge when it comes to how to use databases.

  • Doubt Regarding Collection

    Hello,
    How can we perform a search inside a collection Variable ...
    Like ... we use a IN .... If Yes then how ..?

    Below is the illustration to query a collection in a where clause.
    create or replace type test_coll as object(a number, b number);
    create or replace type test_collnest as table of test_coll;
    create table test_nestab(col1 number, col2 test_collnest) nested table col2 store as tab_nest
    SQL> ed
    Wrote file afiedt.buf
    1* insert into test_nestab values (&n,test_collnest(test_coll(&n,&n)))
    SQL> /
    Enter value for n: 1
    Enter value for n: 100
    Enter value for n: 200
    old 1: insert into test_nestab values (&n,test_collnest(test_coll(&n,&n)))
    new 1: insert into test_nestab values (1,test_collnest(test_coll(100,200)))
    1 row created.
    SQL> /
    Enter value for n: 2
    Enter value for n: 200
    Enter value for n: 300
    old 1: insert into test_nestab values (&n,test_collnest(test_coll(&n,&n)))
    new 1: insert into test_nestab values (2,test_collnest(test_coll(200,300)))
    1 row created.
    SQL> /
    Enter value for n: 3
    Enter value for n: 300
    Enter value for n: 400
    old 1: insert into test_nestab values (&n,test_collnest(test_coll(&n,&n)))
    new 1: insert into test_nestab values (3,test_collnest(test_coll(300,400)))
    1 row created.
    Query the collection using TABLE function
    1* select t1.col1,t2.* from test_nestab t1, table(t1.col2) t2
    SQL> /
    COL1 A B
    1 100 200
    2 200 300
    3 300 400
    Where Query based on collection attribute
    1 select t1.col1,t2.* from test_nestab t1, table(t1.col2) t2
    2* where t2.a = 200
    SQL> /
    COL1 A B
    2 200 300

  • Doubt in Collection.synchronizedSet(Set s)

    hi..
    I am little bit confused with the below method..can anyone pls clear me..
    In java.util.Collection class
    public static Set synchronizedSet(Set s)
    //Returns a synchronized (thread-safe) set backed by the specified set.
    //In order to guarantee serial access, it is critical that all access to the
    //backing set is accomplished through the returned set.
    //It is imperative that the user manually synchronize on the returned set
    //when iterating over it:
      Set s = Collections.synchronizedSet(new HashSet());
      synchronized(s) {
          Iterator i = s.iterator(); // Must be in the synchronized block
          while (i.hasNext())
              foo(i.next());
      }when the set is already synchronized why shuld we again use synchronized block when iterarating it...
    thnx,
    mysha..

    so when ur using synch block on tht set while
    iterarting
    synchronized(s){}
    we r obtaining lock on the set also and even on this
    block of code.....So while one therad is iterating
    thru the synchronized block no other thread can
    access the set 's' and also no other thread can
    itearate thru this block..No, that's not correct. While you're in that block, no other code can obtain a lock on the Set. That's all. Any non-synchronized code can still modify the Set. So you need to synchronize all the code that can change the set, too. As someone mentioned if Iteration could take a long time, you may want to iterate over a copy, because it could impact performance. Then again, you need to make the program correct first, then fast.
    and thus we can prevent
    ConcuurentModificationException is this correct?I
    didnt get ur reason for deadlocks though.
    thnx,
    mysha..

  • Doubt with Collections.singleton(Collection)

    Hi,
    can anyone help me in understanding the difference between.
    Collection.removeAll(Collection)and
    Collection.removeAll(Collections.singleton(Collection)).
    Thanks in advance....
    regards,
    Deep

    The difference is merely that the second one is pointless.

  • Collective Settlement Order Doubt

    Hi,
    I have a doubt about Collective Settlement (t-code KO8G) for this situation: I have order A that has Order B as Settlement Receiver in the Settlement Rule, and order B that has Cost Center C as Settlement Receiver in the Settlement Rule.
    Is there a way to process the settlement for order A and B just one time in KO8G, instead of doing it twice. The first time for order A, then for order B.
    Best Regards,

    Hi
    Welcome to SDN
    Sorry, but thats not possible because each order is processed individually for settlement.... Hence, when you process A & B 1st time - A settles to B, But B has nothing to settle at that time
    When you settle again - A has nothinf to settle this time, but B settles to Cost center C
    br, Ajay M

  • Collect on account id

    hi  ,
    am having a doubt regarding collect when it is used in the  account id it will add the account number  or what
    collect hkont .(T012k)
    with thanks ,
    Maha.

    hi,
    COLLECT is a statement which is similar to APPEND, the differences are :
    The COLLECT statement checks weather the work area record already exists with same key field value (the key field must be of type C, N, D, T).
    If yes, it will add the numerical fields to the existing record.
    If no, it will append or add a new record.
    Thanks,

  • Why Hashtable class name is like this instead of HashTable

    I have a doubt in Collections, why Hashtable class name is like this, because, Every class name is start with CAPS like, ArrayList, SortedSet, etc. then the second name first letter should be in CAPS.
    Is that any special for that. Can anyone clear my doubt
    Thanks in advance.<!--Session data-->

    DrClap wrote:
    Because that's what they called it twelve years ago when they wrote it. I don't really think that asking about what a couple of people were thinking twelve years ago when they named a class is a good use of anybody's time. In fact I think it's a complete waste of time.may be

  • How to Create Transport ?

    Hi Guys, I am trying to create transport request and have come across a doubt, while collecting the objects for transport. If i click on "Object type" in "Transport Connection" and choose Infocube as the Object to be collected and create a transport request, will all the InfoObjects belong to this InfoCube also get transported along with this request, or do i need to collect those InfoObjects in a separate transport request?
    Your help will be appriciated in terms of points...
    Thanks,
    Man

    Hi:
    Most of the time, IF nobody has the InfoObjects in their requests, all the Objects will come into your request.
    You will have a chance to see for yourself. If they are not there, then you can do the steps below -
    If you want to collect all related Objects for the Cube, then, in the menu, there is a button called: Grouping.
    There select the one called "In Data FLow Before".
    ALso, is a good idea to move these before you collect Cubes, ec.
    Application Components
    InfoAreas
    Then, start with the remaining stuff.
    Look up some Posts on guidence, there is lot of help on SDN.
    Re: transport strategy
    One more note, eventhough if you move Cube, it will transport the rest of the dependent Objects, I don't personally follow it. Some people do.
    I move in this Order.
    R/3 transports.
    Replicate R/3 Data Sources
    BW -
    InfoAreas
    Application Components
    (when you move the above, don;t move any other Objects with them)
    InfoObject Catalog with InfoObjects
    Cubes
    InfoSOurces
    Update Rules
    Queries, Web templates, etc.
    Generate Export Data Sources
    Replicate Data Sources
    Objects that depend on Replicard Objects in BW.
    Its mostly based on experience.
    Chamarthy
    Message was edited by:
            U.P. Chamarthy

  • Doubt Regarding Statistics Collection in 10g

    Hello,
    Me Jr Dba i have a doubt regarding statistics calculation in 10g.As we know that if we set
    the initilization parameter STATISTICS_LEVEL=Typical then AOS(Automatic Optimizer staistics) calculate the statistics for the tables, whose blocks are greater then 10% changed from the last calculation.Here my doubt is since already statistics are gathered,
    is there any necessity for us to gather the statistics manually by using
    DBMS_STATS.GATHER to see the tables or system statistics.
    Can u plz assist me on the above
    Regards,
    Vamsi

    Hi,
    Please see here,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#i41448
    If the table/s are changing very frequently than its better to gather the stats manually.This would lead teh volatile table coming up into the stats job again and again.
    For the system stats and data dictionary stats,they are not collected by default.So there is no choice but to gather them manually.
    Aman....

  • Doubt about Bulk Collect with LIMIT

    Hi
    I have a Doubt about Bulk collect , When is done Commit
    I Get a example in PSOUG
    http://psoug.org/reference/array_processing.html
    CREATE TABLE servers2 AS
    SELECT *
    FROM servers
    WHERE 1=2;
    DECLARE
    CURSOR s_cur IS
    SELECT *
    FROM servers;
    TYPE fetch_array IS TABLE OF s_cur%ROWTYPE;
    s_array fetch_array;
    BEGIN
      OPEN s_cur;
      LOOP
        FETCH s_cur BULK COLLECT INTO s_array LIMIT 1000;
        FORALL i IN 1..s_array.COUNT
        INSERT INTO servers2 VALUES s_array(i);
        EXIT WHEN s_cur%NOTFOUND;
      END LOOP;
      CLOSE s_cur;
      COMMIT;
    END;If my table Servers have 3 000 000 records , when is done commit ? when insert all records ?
    could crash redo log ?
    using 9.2.08

    muttleychess wrote:
    If my table Servers have 3 000 000 records , when is done commit ? Commit point has nothing to do with how many rows you process. It is purely business driven. Your code implements some business transaction, right? So if you commit before whole trancaction (from business standpoint) is complete other sessions will already see changes that are (from business standpoint) incomplete. Also, what if rest of trancaction (from business standpoint) fails?
    SY.

  • Bulk collection doubt

    Hi All,
    I've one doubt regarding the bulk operations using the forall statement.
    Check below eample:
    CREATE TABLE emp_temp AS SELECT * FROM employees;
    DECLARE
    TYPE empid_tab IS TABLE OF employees.employee_id%TYPE;
    emp_sr empid_tab;
    -- create an exception handler for ORA-24381
    errors NUMBER;
    dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(dml_errors, -24381);
    BEGIN
    SELECT employee_id BULK COLLECT INTO emp_sr FROM emp_temp
    WHERE hire_date < '30-DEC-94';
    -- add '_SR' to the job_id of the most senior employees
    FORALL i IN emp_sr.FIRST..emp_sr.LAST SAVE EXCEPTIONS
    UPDATE emp_temp SET job_id = job_id || '_SR'
    WHERE emp_sr(i) = emp_temp.employee_id;
    -- If any errors occurred during the FORALL SAVE EXCEPTIONS,
    -- a single exception is raised when the statement completes.
    EXCEPTION
    WHEN dml_errors THEN -- Now we figure out what failed and why.
    errors := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
    FOR i IN 1..errors LOOP
    DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
    'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
    DBMS_OUTPUT.PUT_LINE('Error message is ' ||
    SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    END LOOP;
    END;
    Here we update using bulk collect & the exceptions for each iterations are kept separately.
    In case, I want to know whether the sql statements in each array are executed separately or all the statements are executed in bulk?
    Thanks
    Deepak

    May this will answer it...
    FORALL - documentation

  • CUCM 8.6.2 - Doubt about recommendated FTP to collect CDR

    Hi Guys,
    I Would like know if there are any list recomendated or validate software about FTP to collect CDR in CUCM and the same question to Operation System.
    Thanks,
    Wilson

    There are many software avaialble but recommendation/suggestion i can see this.
    Cisco uses the following servers for internal testing. You may use one  of the servers, but you must contact the vendor for support:
    •Open SSH (refer to http://sshwindows.sourceforge.net/)
    •Cygwin (refer to http://www.cygwin.com/)
    •Titan (refer to http://www.titanftp.com/)
    Note For  issues with third-party products that have not been certified through  the CTDP process, contact the third-party vendor for support.
    Br,
    Nadeem 
    Please rate all useful post.

  • Doubt regarding automatic statistics collection in Oracle 10g

    I am using Oracle 10g in Linux
    Does statistic collection for tables throughout the database happen automatically or should we manually analyze the tables using
    Analyze command or DBMS_STATS package ?
    AWR collects statistics(snapshots) every 1 hr but does it mean it collects only session and database related statistics and not the table related statistics?

    I am using Oracle 10g in Linux Version and os name and version?
    AWR collects statistics(snapshots) every 1 hr butIt's performance related statistics. Read about data gathering and AWR.
    Note that AWR is an extra licensable feature thru Management packs.

Maybe you are looking for

  • Document Viewer in Adf

    I have the requeriment to implement a document viewer that don't let print and save a document(pdf,word,excel). Is there any viewer for adf? Do you know a free o payed viewer that i can connect with java or adf?

  • Itune video

    I can not view the Pixar video that I've downloaded in itune. It plays the sound of the vidoe, but no image. i can view the video files eventually by using Quicktime, but i wonder why i can't view it with my itune. Thanks.

  • Oracle Devloper Help

    HOW CAN I RESTRICT TO USER THROUGH ORACLE DEVELOPER FORMS THAT HE/SHE CAN OPEN ONLY ONE SESSION I THINK Win_Api_Session.One_Session MAY BE USED FOR THAT,BUT IT GIVES ERROR WHEN I TRY TO USE IT. SIMILARY Win_Api_Environment.Get_Windows_Username GIVES

  • Alchemy for xfi - the product state could not be determined (error 6

    as the title states I have xfi platinum & installed alchemy for xfi, tried to start it & I get "the product state could not be determined (error 60)" I click any of the links & it takes me to the buy page for the audigy alchemy. I've tried uninstalli

  • UISearchBar: enable search button by default

    Hi all, by default the search button in the keyboard for a UISearchBar is disabled. The button is enabled after typing a single character. So when no characters are typed there is no way to dismiss the keyboard when not using a cancel button. Is ther