doubt about the collection of object type

Hi all

I'm a newbie!

I tried an array of type object index, as follows.

declare

type ty_tab is table of the directory index ty_test;

v_tab ty_tab;

Start
v_tab (1): = ty_test ('ashok', 1000);
v_tab (2): = ty_test ('rashmi', 2000);
v_tab (3): = ty_test ('baby', 3000);

for me in v_tab.first... loop of v_tab. Last

dbms_output.put_line (v_tab (i));

end loop;

end;

/

While running the script above, I got the following error message.
ORA-06550: line 14, column 8:
PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.
ORA-06550: line 14, column 8:
PL/SQL: Statement ignored

Can anyone suggest me where I'm wrong.


Thanx

DBMS_OUTPUT. Put_line argument is a scalar value. It does not composite types. You should pass the individual attributes. Assuming that ty_test is:

SQL> create or replace
  2    type ty_test
  3      as object(
  4                name varchar2(10),
  5                val  number
  6               )
  7  /

Type created.

SQL> 

Use:

declare
    type ty_tab is table of ty_test index by binary_integer;
    v_tab ty_tab;
begin
    v_tab(1):=ty_test('ashok',1000);
    v_tab(2):=ty_test('rashmi',2000);
    v_tab(3):=ty_test('baby',3000);
    for i in v_tab.first .. v_tab.last loop
      dbms_output.put_line(rpad(v_tab(i).name,11) || v_tab(i).val);
    end loop;
end;
/
ashok      1000
rashmi     2000
baby       3000

PL/SQL procedure successfully completed.

SQL> 

SY.

Tags: Database

Similar Questions

  • bulk collect into the collection of objects

    create or replace type typ_obj as an object
    (l_x number (10),)
    l_y varchar2 (10),
    LZ varchar2 (10)
    );

    Create the type typ_obj_tt is table of the typ_obj;

    / / DESC insert_table;
    c_x number (10)
    C_P number (10)

    temp2_table / / DESC
    doJir number (10)
    c_y varchar2 (10)
    c_z varchar2 (10)

    procedure prc_x (p_obj_out ON typ_obj_tt)
    is
    cursor c1
    is
    Select t1.c_x,
    T2.c_y,
    T2.c_z
    Of
    insert_table t1,
    temp2_table t2
    where
    ....
    ;
    Start
    Open c1;
    collect the fetch c1 into loose in p_obj_out;
    Close c1;

    end;

    raises the error

    can you tell
    How to enter data in this object of type of output table

    Thanks in advance... any help will be much appreciated...

    PL do not spam the forums with topics in double - bulk collect into the collection of objects

  • [ADF, JDev12.1.3] Manages the pageFlowScope same bean validation of the different fragments of BTF. Doubts about the 'object' and 'uiComponents' validator parms

    Hallo,

    I have a 'registration' process bounded with 4 fragments workflow.

    There is in each fragment components entry created by dragging different fields of the same instance of VO.

    The user cannot access the next step if the current step is not correctly filled.

    In the fragment of 1st, the user chooses its type (customer, supplier,...) and in the following steps, the fields are has shown/Asterisk based on her user'type selected (I save the String bean var type managed pageFlowScope dedicated to the btf).

    Because of this in the original Version, by the way the key, there is no other area marked as mandatory.

    To manage the visibility of fields I set the property of rendering the fields (or their container) using EL expressions that read the type in the managed bean stream.

    To manage the fields points, I thought only 2 solutions:

    1)

    For each field to create a validator that checks if the fied was flled and function in the formato (e.g. for emails) right in the successful flowScope bean. So I'll have so many validator functions as areas to manage.


    2)

    Create a unique global validator to which the property of the validator for all fields will point in the managed bean flowScope.

    For example

    public void myGlobalBtfValidator(FacesContext facesContext, UIComponent uiComponent, Object object) {
      if (uIComponet.getId() == "InputTextEmail") {  // Component is in Fragment_1
        // Check if the filed is filled and its format
      }
      if (uiComponet.getId() == "InputTextMobileNumber") {  // Component is in Fragment_2
        // Check if the filed is filled and its format
      }
      if (uiComponet.getId() == "InputTextAddress) {  // Component is in Fragment_3
        // Check if the filed is filled
      }
    // ...
    }
    

    ID' would like to know if the 2nd solution might work and that is the approach recommended among them.

    Then, I would like to know if I can use ther uiComponent parm to the validator without any problem. I ask this question because in many threads, I saw only the parm object used. What are the different function/purpose of these 2 settings?

    Thank you

    Federico

    If you do not want to re-use these validators elsewhere in your application, then method unique validator will be enough.

    Of course, if the implementation of this method only validator will require a huge amount of code, it is probably better to split this option to separate validator methods (to simplify the maintenance).

    BTW, ID of component has to be short, so instead of using the id of the component, set f: attribute on each component of the user interface and to use uIComponet.getAttributes () .get ("attrib_name")

    Dario

  • Doubt about the passage collection (Pl/SQL table) in a procedure.

    Hi all

    I have developed a package of sample with procedure 1. Here, I spent the output to a table in the collection data and I am passing the array of the collection as a parameter out.
    When I run the proc, it worked for 1 scenario, but did not work for the other. I posted two scenarios after the code.
    pkg spec:
    
    create or replace
    PACKAGE IMP_EXP_BKUP_PKG
    AS
      TYPE test10_tbl2 IS TABLE OF test10.t1%type INDEX BY BINARY_INTEGER;
      v2_test10 test10_tbl2;
      PROCEDURE manpower_list(v1 number, v2 out test10_tbl2);
    END IMP_EXP_BKUP_PKG;
    
    Pkg Body:
    
    create or replace
    PACKAGE BODY IMP_EXP_BKUP_PKG 
    AS 
    PROCEDURE manpower_list(v1 number, v2 out test10_tbl2)  AS
    BEGIN
      SELECT t1 BULK COLLECT INTO v2 FROM test10 WHERE t4 = v1; 
    END;
    END IMP_EXP_BKUP_PKG;
    Scenario 1:
    DECLARE
      v2 imp_exp_bkup_pkg.test10_tbl2;
    BEGIN
      imp_exp_bkup_pkg.manpower_list('10', v2);
      FOR i IN v2.FIRST..v2.LAST
      LOOP
        DBMS_OUTPUT.PUT_LINE(v2(i));
      END LOOP;
    END;
    Worked well.

    Scenario 2:
    DECLARE
      --v2 imp_exp_bkup_pkg.test10_tbl2;
      TYPE typ_tbl2 IS TABLE OF test10.t1%type INDEX BY BINARY_INTEGER;
      v2 typ_tbl2;
    BEGIN
      imp_exp_bkup_pkg.manpower_list('10', v2);
      FOR i IN v2.FIRST..v2.LAST
      LOOP
        DBMS_OUTPUT.PUT_LINE(v2(i));
      END LOOP;
    END;
    
    Error:
    ORA-06550: line 6, column 3:
    PLS-00306: wrong number or types of arguments in call to 'MANPOWER_LIST'
    Is not here.

    I want to just make sure that, are we supposed to use the same type that we have breeding stock in the package for the declaration of the variables?

    SamFisher wrote:

    I want to just make sure that, are we supposed to use the same type that we have breeding stock in the package for the declaration of the variables?

    Yes, you MUST use the same type definition.

    SY.

  • forcing the drop of object type in a create statement

    Hello everyone



    We are about to upgrade our customer database with some ddl scripts and to not worry what types of objects (nested tables) are new and which is old (where a drop of water is necessary), I'm looking for a way to do it all in one



    CREATE or REPLACE the STRENGTH & lt; Type & gt; AS AN OBJECT (...);



    In any case, when there is a type of collection for objects that I get < em > ORA-02303: cannot remove or replace a type of load type or the table < /em >


    I thought that the FORCE option will just delete and recreate? I don't want to delete anything manually. The collection type will be updated later with another script.



    Thanks in advance


    You don't have what I posted.

    Ok. Let me explain.

    You cannot drop or replace any existing object if it refers to any other type.

    So, you I don't think you can do in a simple process.

    You should know first of all the type of load on all objects. Then, you have to drop the first types that refer to these objects. And only then will you be able to upgrade your object.

    You can find the dependent objects like this->

    satyaki>
    satyaki>create or replace type sas_demo as object
      2      (
      3        v_nm          number(8),
      4        v_det         varchar2(45)
      5      );
      6  /
    
    Type created.
    
    Elapsed: 00:00:00.29
    satyaki>create or replace type sas_rec as table of sas_demo;
      2  /
    
    Type created.
    
    Elapsed: 00:00:04.44
    satyaki>
    satyaki>
    satyaki>exec dbms_utility.get_dependency('TYPE', 'SCOTT', 'SAS_DEMO');
    -
    DEPENDENCIES ON SCOTT.SAS_DEMO
    ------------------------------------------------------------------
    *TYPE SCOTT.SAS_DEMO()
    *   TYPE SCOTT.SAS_REC()
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:03.27
    satyaki>
    

    Made me?

    Kind regards.

    LOULOU.

  • Add the action to the node root of the collection of objects in vcenter Internet client sdk

    Hello


    I mentioned the plugin sample of chassis-user interface of the web client to vCenter SDK 5.1.


    I want to add actions such as 'create a chassis' to the root of the Collection object, and not on the subject "chassis" itself.

    My code is the same as that provided in the samples (chassis-ui plugin).


    Then, I use mainly vsphere.core.inventoryList.ObjectCollectionTemplate.So using the plugin, I'm able to get stocks on each of the created frame object. But if there is no object created, stocks are not considered in the "Object" of the collection of the Node.So root tab I want actions on the root node, on the object.

    Help, please.



    Thank you very much.

    Global actions as you request are not supported in 5.1, but this problem is fixed in the next 5.5 SDK.

    If you need your plugin to work with the Web Client 5.1 you must put your global action according to another, for example to create objects.

  • I have a doubt about the file .folio and publications

    Hello, I m new here.

    I want to start working with DPS, but I have a doubt about which version to buy.

    At the moment I have one customer just wants to publish a magazine, but my intention is to have more customers and publish more magazines.

    If I buy the unique edition of DPS, I read that I can publish a single file .folio. What it means? Each folio file represents a publication?

    Please, I need help to understand this before you purchase the software.

    Thank you very much

    Paul

    Here's a quick blog I wrote to compare the simple edition and

    multifolio apps:

    http://boblevine.us/Digital-Publishing-Suite-101-single-Edition-vs-multi-Folio-apps/

    Bob

  • A doubt about the alert Message...

    Hello

    I am very new to Oracle Forms & I use Forms 6i.

    As I practice some bases as 'Validation' a text element I went by a few examples of code to bring or poping-up alert messages...

    Here is my Code... in this I don't understand Y... .do write us the 'Message ('no msg')' line TWICE... ??

    Although I commented on the 2nd one... but there must write two times... & wat is the logic behind it...?

    Help, please...

    ---------------------------------------------------------------------------------------------------
    Begin

    If (: aijaz_emp_master.em_dob >: aijaz_emp_master.em_doj) then

    set_item_property ('em_dob', current_record_attribute, 'VA_ERRORS');

    -If (: aijaz_emp_master.em_dob is not null and (: aijaz_emp_master.em_doj >: aijaz_emp_master.em_dob)) then
    message ("DOB must b higher or NULL MJ '");
    -message ('wort upper b DOB or NULL MJ');

    raise form_trigger_failure;

    on the other
    set_item_property ('em_dob', current_record_attribute, 'VA_NOnERROR');
    end if;

    end;
    ---------------------------------------------------------------------------------------------------------

    MIRA,
    I agree that this can be a little confusing, but once you understand the difference between messages and alerts it will make sense.

    In Oracle Forms, a 'Message' is any information that is displayed in the 'Message' of the forms Console line and requires no interaction with a user. The console is displayed at the bottom of the window and includes the 'Message line' and 'Statue line. If the message line already has a message, and then forms will promote the message in an alert (popup window) and the nouveau/deuxieme message is displayed in the message line. In general, many forms developers will use this "Double-Message" method to display information in an alert because it is less lines of code to assign the text of the message in an alert and then display the alert. It is advisable to always call the built-in function Clear_Message() before calling Message built-in to prevent unintential * promotion message.

    An alert in a physical object in a form of Oracle (note: there is a 'Alerts' node in the browser of object of forms). There are three types of alerts of forms: Note, attention and stop. Display the notes information, precautions display warnings and errors off display program, or critical information. In order to display an alert, you must first create an alert object in the Alerts node. You can create an Alert object for each of your posts, but this creates clutter and can be confusing. I prefer to use three alerts - one for each type (Note, attention, Stop) and then programmatically set the title, the text of the message and the buttons (max 3). As you can see, there is more work involved to display an alert. In addition, the integrated Display_Alert() is a function if you need a variable to receive the value returned by the call to Display_Alert.

    Here is an example of using e-mail in the forms:

    /* Standard message */
    BEGIN
       Clear_Message;
       Message('Display in the Message Line only');
    END;
    
    /* Message to display Alert */
    BEGIN
       Clear_Message; -- make sure you don't accidentally promote a different message
       Message('Display in the Default Alert');
       Message('Display in the Default Alert');
    END;
    
    /* Message displayed in a Note Alert */
    /* Assumes an Alert of type "Note" has already been created. */
    DECLARE
       al_id      ALERT;
       al_btn    NUMBER;
       v_msg    VARCHAR2(200); /* Max Characters that can be displayed in an Alert */
       v_title    VARCHAR2(78);  /* Max title characters */
    BEGIN
       al_id := Find_Alert('Note');
       IF NOT ID_NULL(al_id) THEN
          v_title := 'This is an informational message';
          v_msg := 'This is an informational message that requires the user to acknowledge the message';
          Set_Alert_Property( al_id, TITLE, v_title);
          Set_Alert_Property( al_id, ALERT_MESSAGE_TEXT, v_msg);
          al_btn := Show_Alert( al_id );
       END IF;
    END;
    

    Personally, we have a library package, we have created to simplify the display of alerts and allows you to set the properties of the alert and display it in a single call.

    /* In this sample, I use named notation to
    illustrate the meaning of the different parameters
    in our wrapper package. */
    DECLARE
       al_button  NUMBER;
    BEGIN
       IF (:aijaz_emp_master.em_dob > :aijaz_emp_master.em_doj) THEN
          set_item_property('em_dob', current_record_attribute, 'VA_ERRORS');
          al_button := message_pkg.warning( TITLE => 'Warning: DOB Required',
                                      MSG_TEXT => 'DOB must b NULL or Greater tahn DOJ',
                                            BUTTONS => 'OK');
          raise form_trigger_failure;
       ELSE
          set_item_property('em_dob', current_record_attribute, 'VA_NOnERROR');
       END IF;
    END;
    

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

    Published by: Silvere December 13, 2010 10:31

  • Some doubts about the topology, interfaces and security modules

    Hello

    Below, some questions about the ODI:


    1. to use an LKM ODI always ask to use two different DATASERVERS (one for the SOURCE) and another to the TARGET?

    2. what would be the best way to create a new IKM with GROUP BY clauses?

    3. What is the required minimum PROFILE for developers users could import projects created in other ODI environments?

    4. If a particular WORK_REP is lost, it is possible that retrieve projects from version control information stored in the MASTER_REP?

    1.) Yes. LKM always loads data from one root to another.
    More than once I saw that even if there is a single physical server, several servers are configured in the topology Manager. This would lead to the use of a LKM because ODI consider 2 different servers.
    If the physical server is set only once, LKM won't be necessary.

    2.) IKM automatically adds a GROUP BY clause if it detects an aggregation function in the Interface implementation.

    3.) try to use the profile of the creator of NG.

    4.) this is not an easy task. But all the versioned objects are compressed and stored in a BLOB field in the master repository.
    You will need to know the names and versions you need to recover.
    SNP_VERSION and SNP_DATA have this information. Retrieves the field BLOB SNP_DATA and unpack using a zip utility. This will give you the XML property of the object that was transferred.
    Now, you can import this xml file and retrieve the object.

    You will need to loop through all the records in order of I_DATA, then extract to .xml file, and then import them to build the work rep.

  • About the data binding object

    I've set up a Repeater to display XML data. A single field, called rsvpStatus, is a Boolean value, returning as Y or N. I'd rather see something like YES or no. so I thought I could put in place the following text box:

    < mx:Text text="{Constants.yesNoTranslator[data.rsvpStatus]}"/ >

    and also to set up an associative array reflecting O/N YES/no such as:

    [Bindable]
    public static var yesNoTranslator:Object = {N: 'No', Y: 'Yes'};

    I'm being warned by Flex Builder that:
    "Data binding will not be able to detect changes when using square brackets operator. For array, use ArrayCollection.getItemAt (). »

    Despite this warning, it seems to work.

    My question is:
    I've set up with this warning and assume it is useless, or is there a good reason to change the structure of my code?

    See you soon
    Craig

    Thanks good for this Sreenivas I'm much clearer about all this now.
    all this got me thinking - it would make sense to create a new class, say "ObjectCollection' ObjectProxy extension with a"getItemAt"method to facilitate the fixation on objects in situations such as these:
    (my apologies but no button code to join for some strange reason)


    http://www.Adobe.com/2006/mxml">


    [Bindable]
    public var yesNoTranslator:ObjectCollection = new ObjectCollection({Y:"Yes",N:"No"});)
    [Bindable]
    public var rsvpStatus:String = 'Y ';
    ]]>

    package
    {
    Import mx.utils.ObjectProxy;

    SerializableAttribute public class ObjectCollection extends ObjectProxy
    {
    public void ObjectCollection (point: Object = null, uid:String = null, proxyDepth:int = - 1).
    {
    Super (item, uid, proxyDepth);
    }
    [Bindable (= "propertyChange" event)]
    public void getItemAt(index:String):Object {}
    Return (this [index]);
    }
    }
    }

  • Question about the collection of NETWORK adapters for vMotion / VM vSwitch

    Hello

    We use vSphere Enterprise Edition 5.1.

    We also create separate vSwitch for management / vMotion and VM.

    Each vSwitch receives 2 network cards connected to the different switch for redundancy.

    We would like to know is necessary to provide the collection of NETWORK adapters for these vSwitches?  Currently, only enable us NIC Teaming for VM vSwitch only.

    Thank you

    VSwitch vMotion, we have 2 assigned NIC (nic2 and nic6) with 10 VLANS.  NIC2 and nic6 are connected to 2 different physical switches.

    Should I choose

    (1) both are active

    (2) both are assets + grouping of NETWORK cards?

    Question - if there is only 1 VLAN, it seems that NIC Teaming is also not very useful unless we use 2 VLAN (Multi-NIC vMotion).  Is this right?

    If you use Multi-NIC vMotion, there is no need to have two different VLANS, all you need is depending on configuration

    on your vMotion switch, please create two vmkernel port for vMotion with the same VLAN ID, but the grouping of NETWORK cards as below

    vMotion_1 - VLAN ID: 10

    Grouping of NETWORK cards

    vmnic2 - active

    vmnic6 - watch

    vMotion_2 - VLAN ID: 10

    vmnic6 - active

    vmnic2 - watch

  • Doubt about the Index

    Hi all

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    I have a question about the index. Is - this required that the index will be useful if we have a "WHERE" clause I tried to find myself there but do not.
    In this example I haven't used where clause used but group. But it gives a comprehensive analysis. Is it possible to get the scan interval or something else using Group by?
    SELECT tag_id FROM taggen.tag_master GROUP by tag_id 
    
    Explain Plan:
    Plan hash value: 1688408656
     
    ---------------------------------------------------------------------------------------
    | Id  | Operation             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT      |               |  4045 | 20225 |     6  (17)| 00:00:01 |
    |   1 |  HASH GROUP BY        |               |  4045 | 20225 |     6  (17)| 00:00:01 |
    |   2 |   INDEX FAST FULL SCAN| TAG_MASTER_PK |  4045 | 20225 |     5   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------

    Hello

    SamFisher wrote:
    Since I was on what they do full scan. Is it possible to restrict of fullscan without using where clause?
    I guess having limit clause but not quite know.

    Why?
    If this query is producing good results, then you need a full analysis.
    If fool you somehow the optimizer by doing a scan of interval, it will be slower.

  • About the collections

    Hello

    A created collection exists in all sessions, but the data are seen only in the session that created the collection?
    I want to use the collection, and I wonder if I need to give a unique name to a collection. If I create a collection in a session, can it be created with the same name by other sessions?

    Thank you.

    A collection is always associated session. There is no way to share it between sessions. To do this, you use a table.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Doubt about the persistent object

    Hi friends,

    I've stored data object persistent after that some time, my Simulator has taken a lot of time to load the application so I run clear.bat do fast Simulator. But after I run clear.bat. The values of what I stored in the persistent object had disappeared. Someone at - he said, therefore, it is the persistent object data are parties to cause of the performer, the clear.bat or any other reason. pls clarify my doubt friends...

    Kind regards

    s.Kumaran.

    It is b'caz of clean.bat. Clean.bat will remove all applications and unnecessary files, etc...

  • Doubt about the return type of function

    Hello

    Can a function returns a Boolean value in a select query.

    Suppose m creating a function... so can we have a return type of Boolean as...?

    If so... THN please give an example

    Can a function returns a Boolean value in a select query

    The answer is no. a Boolean is not a SQL data type and may not be used in the SELECT query.
    For the user-defined function to be called in a SQL statement, see http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_packages.htm#ADFNS00908
    Note especially these lines

    "Its formal parameters and its return value (if any) must have built-in data types (for example, CHAR, DATE or NUMBER) Oracle, not types (such as BOOLEAN, RECORD or TABLE) PL/SQL data.

    "There is an exception to this rule: a formal parameter can have a PL/SQL data type, if the corresponding actual parameter is implicitly converted to the data type of the formal parameter" >

    Published by: Johan August 3, 2010 03:48

Maybe you are looking for