Using the Type of object in fusion

Hi all

You have a small problem where I would like some suggestions.

I had a declared TYPE.

CREATE OR REPLACE TYPE 'MY_TYPE_OT' IS (OF THE OBJECT
Field1 VARCHAR2,
Field2 VARCHAR2,
field3 VARCHAR2);

I now have an array declared to type this

TYPE MY_TYPE_TT IS TABLE OF INDEX MY_TYPE_OT BY VARCHAR2 (100);

I have the collection of type MY_TYPE_TT

MY_TYPE_TT MY_VARIABLE;

I am populating this variable lets say 10 records.


Then I try to save it to a database table, my_table for this I need to merge since it could be an update or insert. so, my query goes like this


MERGE INTO my_table T2 using T1 ON (T1.field1 = T2.field1 AND T1.field2 = T2.field2) TABLE ($my_var)

Here, I get an error that my_variable is not a table. I tried different things like doing a casting, which gives me invalid data type etc.

Any suggestions on how to pick up on this?

Thanks in advance
Paddy

Collection with "index of" cannot be used in the context of sql. You can or use the collections without "index of" or treat it manually. See the example:

drop table MY_TABLE purge
/
CREATE OR REPLACE TYPE MY_TYPE_OT IS OBJECT (
field1 VARCHAR2(100),
field2 VARCHAR2(100),
field3 VARCHAR2(100))
/
create table MY_TABLE of MY_TYPE_OT
/
declare
  TYPE MY_TYPE_TT     IS TABLE OF MY_TYPE_OT INDEX BY VARCHAR2(100);
  MY_VAR              MY_TYPE_TT;
begin
  --just testing values for collection:
  for i in 1..3
    loop
      MY_VAR(i):=MY_TYPE_OT(null,null,null);
      MY_VAR(i).field1:='field1-'||i;
      MY_VAR(i).field2:='field2-'||i;
      MY_VAR(i).field3:='field3-'||i;
    end loop;

  -- manually merging by one row:
  for c in MY_VAR.first..MY_VAR.last
    loop
      execute immediate '
        merge into MY_TABLE T2
        USING (select :1 field1, :2 field2, :3 field3 from dual) T1
        ON (T1.field1 = T2.field1 AND T1.field2 = T2.field2)
        when matched then
          update set
                 t2.field3=t1.field3
        when not matched then
          insert values(t1.field1,t1.field2,t1.field3)
      '
      using MY_VAR(c).field1,MY_VAR(c).field2,MY_VAR(c).field3
    ;
    end loop;
end;
/

Kind regards
Malakshinov Sayan

Tags: Database

Similar Questions

  • Need help to identify the type of object in the loop of pl/sql

    Hello

    I need help to identify the Type of object declared beneath a procedure as shown below:

    I need to pass the parameter to the procedure as a TYPE of OBJECT and also refer to variables of Type Object in a loop

    create or replace type TEST_VALIDATION_REC is RECORD (order_num varchar2 (30),)

    number of inventory_item_id

    reserved_YN varchar2 (1).

    error_flag varchar2 (1).

    Error_message varchar2 (2000)

    );

    CREATE OR REPLACE TYPE VALD_TBL AS VARRAY (10000) OF TEST_VALIDATION_REC;

    PROCEDURE ADD_TO_ORD)

    p_lot_number_list IN VALD_TBL,

    p_ord_number IN Varchar2,

    p_user_id in NUMBER: = fnd_profile.value ('USER_ID'),-change 1.10

    p_responsibility_id in NUMBERS: = fnd_profile.value ('RESP_ID'),-change 1.10

    p_application_id IN VARCHAR2: = 'PO',-change 1.10

    x_error_flag OUT Varchar2,

    x_error_msg OUT Varchar2

    )

    In the above procedure, I had the VALD_TBL. Is it OK?

    And how in the loop if the records if I use:

    FOR indx1 IN 1.p_lot_number_list. COUNTY

    LOOP

    BEGIN

    SELECT

    inventory_item_id

    IN

    ln_item_id

    Of

    dummy_lot_tab

    WHERE

    lot_number = p_lot_number_list (indx1); - > how direct the item here?

    EXCEPTION

    WHILE OTHERS THEN

    ln_item_id: = NULL;

    END;

    Records are PL/SQL objects.  They are not the SQL objects.  You can create a SQL TYPE (schema level) as a collection (variable-tables only, tables nested).

    So therefore your first statement is syntactically incorrect

    CREATE OR REPLACE TYPE TEST_VALIDATION_REC IS RECORD
    (order_num VARCHAR2(30),
    inventory_item_id NUMBER,
    reserved_YN VARCHAR2(1),
    error_flag VARCHAR2(1),
    Error_message VARCHAR2(2000)
    );
    

    You must put in an anonymous PL/SQL block or the stored procedure

    DECLARE
    
       TYPE test_validation_rec IS RECORD
       (
        order_num VARCHAR2(30),
        inventory_item_id NUMBER,
        reserved_YN VARCHAR2(1),
        error_flag VARCHAR2(1),
        error_message VARCHAR2(2000)
       );
    
       TYPE vald_tbl iS VARRAY(10000) OF test_validation_rec;
    
       lv_tbl vald_tbl;
    
    BEGIN
    
       lv_tbl := vald_tbl();
      -- insert your code here 
    
    END;
    
  • How to change the type of object?

    I have an object type, as shown below:

    Here are the object and its type

    create or replace type test_object1 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );

    create or replace type test_type1 is table of the test_object1;


    Now I want to change the type of object. I want to increase the size of val1 to varchar2 (100).

    Any body could help for the alter script.

    Thank you
    Lavan

    >
    SQL > alter type test_object1 change attribute (varchar2 (100)) val1;
    >
    Which won't work OPs example. Your example does not include the second type of object that depends on the first type.

    You cannot change the underlying type unless you use the CASCADe or INVALIDATE option.
    >
    change the type of test_object1 change attribute (val1 varchar2 (100)) waterfall;
    >
    See the CASCADE clause in the link provided by Osame
    >
    CASCADE clause

    Specify the CASCADE clause if you want to propagate the type change to the tables and dependent types. Oracle database abandons the statement if errors are found in the dependent types or tables, unless you also specify the FORCE.

    If you change the property of the type between FINAL and NON-FINAL, you must specify this clause to convert data in the tables and dependent columns. Please refer to [NOT] FINAL.

  • [CS2] [VB] How can I determine the type of object to a PageItem?

    I use InDesign CS2 and VBScript

    Loop to the bottom of the PageItems in a Page, I need determine the Type of object (TextFrame, group, GraphicLine... each process) and PageItem accordingly.

    Is there a method/function VBS wiil returns the Type of an object as a string or a value. Or what I need to check the existence/non-existence of a particular property associated with a particular object for this type?

    Alternatively, is there a JavaScript function that will do what I can call VBScript?

    For the record: TypeName is what you need.

    For example, when the cursor is planted in the text return TypeName (Ind.Selection (1)) 'PointInsertion.' When a text block is selected, it returns "TextFrame.

  • How to use the Type of Oracle Table values in the Select statement.

    Hello

    I get the initial set of values in the Table of Type Records of the Oracle and want to use the list of values in the Select statement.

    For example, try something like the following:

    TYPE t_record () IS RENDERING
    ID TABLEA.ID%type,
    NO TABLEA.NO%type

    );
    v_record t_record;
    T_table TYPE IS the v_record TABLE % TYPE;
    v_table t_table;

    -Code to fill the values of v_table here.

    SELECT ID, NO, COLLECT in BULK IN < some other table variabes here > FROM TABLEA
    WHERE ID IN (i) v_table USER.USER;

    I want to know how to use the Type of Oracle Table values in the Select statement.

    Something like this:

    create or replace type t_record as  object (
    id number,
    no number
    )
    /
    
    CREATE or replace type t_table AS TABLE OF t_record;
    /
    
    set serveroutput on
    declare
    
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    
    begin
    
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
    
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
    
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
    
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /
    

    No test!

    P;

    Published by: bluefrog on March 5, 2010 17:08

  • Error "you do not use the Type of appropriate phone cord.

    Having a problem with my fax on my HP Officejet Pro 8500 wireless.  Tried to send a fax, it received a transmission error.  I run fax test and she came back with "you do not use the type of appropriate phone cord.  Nothing has changed since I last fax would be but I check the lines and connections, everything seems ok.  Phone jack is connected to 1 line and Officejet 2 - ext"is connected to the phone.  I use a dedicated phone # and the Officejet is set to auto answer.   I can call and receive calls on the phone to connect to the Officejet.  My hypothesis is that because I can use the phone without problem there nothing wrong with the phone line.  Any ideas?

    I had the same problem.  I am using a phone cord 2-wire supplied with the printer and still get this error.  It turns out that it is bound to have a telephone connected to the printer.  If I unplug the telephone shape of the intake extension on the back of the printer, then the fax test passes.   I used even a cord 2-wire on the telephone, but it seems that the mere fact of having a phone plugged into the outlet of expansion will cause this error.

    Run the test without a phone plugged into the outlet of extension of the printer and you should be fine.

    Worked for me!

  • circle continues to change color when I use the type on the path tool

    I made two circles and I want to have written them, where is the black. but when I click and use the type on a path tool, it transforms the inner circle in black. I want the Red inner circle to stay, while the outer circle remains black. I had problems with this. I tried to adjust the background/outline, but nothing seems to work. Help, please.

    Here are two images - the first is what it looks like at first, while the second is what happens when I use the type on the paths tool:

    adobe 1.JPG

    adobe 2.JPG

    The use of this circle of text on a path makes a text path, which may not have a fill. Add a third circle and use it for the path of your text.

  • Ask about the types of objects

    Hello

    I have a question about the type of object. I want to see the script for the type of object created, that is already stored in the database. How can I see who


    Concerning

    Hello

    So, you can try [DBMS_METADATA. GET_DDL | http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_metada.htm#ARPLS640]...

    MHO%xe> create or replace type mytype as object( col varchar2( 10 ));
      2  /
    
    Type is aangemaakt.
    
    Verstreken: 00:00:00.37
    MHO%xe> select dbms_metadata.get_ddl('TYPE', 'MYTYPE') from dual;
    
    DBMS_METADATA.GET_DDL('TYPE','MYTYPE')
    ------------------------------------------------------------------------------
    
      CREATE OR REPLACE TYPE "MHO"."MYTYPE" as object( col varchar2( 10 ));
    
  • What is the type of object to use for virtual machine model in the Points of Extension?

    Hello

    I added my plugin point of extension vsphere.core. ${objectType} .monitorViews. My plugin is for all types of objects (vm, file, vApp, resourcePool, etc) except the model of the virtual machine. My understanding is that the vm object type would be required for the virtual machine template, but that doesn't seem to be the case. Am I missing something here? Should the plugin appear for the model of the virtual machine when I use the vsphere.core.vm.monitorViews extension point?

    Thanks in advance.

    Kind regards

    Ashutosh

    Sorry, I got confused by your original question. ExtensionPoint id you are looking for is the one for adding views a model virtual machine monitor tab:

    model.monitorViews vSphere.Core.

  • How to set http headers when you are using the BridgeTalk HttpConnection object?

    Hello

    I'm doing http post requests from Illustrator ExtendScript (via BridgeTalk) and most of the time it works. However, the documentation on the use of HttpConnection is nonexistent and trying to find a way to set http headers. The HttpConnection object have once requestheaders and responseheaders property so I suspect it's possible.


    By default, post requests are sent with the header Content-Type "text/html", and I would like to replace so that I can use "application/x-www-formulaires-urlencoded" or "multipart/form-data".

    Here's what I have so far:

    var http = function (callback) {}

    var bt = new BridgeTalk();

    BT. Target = "bridge."

    var s = ";

    s += "if (!.). ExternalObject.webaccesslib) {\n";

    s += "ExternalObject.webaccesslib = new ExternalObject ('lib: webaccesslib');" \n » ;

    s += "}\n";

    s += "var html =" "; \n » ;

    s += "http var = new HttpConnection ('http://requestb.in/1mo0r1z1'); \n ";

    s += "http.method = 'POST'; \n » ;

    s += "http.requestheaders ="Content-Type, application/x-www-formulaires-urlencoded,"\n";

    s += "http.request = 'abc = 123 & def = 456'; \n » ;

    s += "var c = 0, t =" "; for (var i in http) {& t = (i +': ' + http [i] +'* '); c ++ ;} t =' FRONT ('+ c +):'+ t;} alert (t); \n » ; Debug: to see what properties and values exist on the http object

    s += "http.response = html; \n » ;

    s += "http.execute (); \n » ;

    s += "http.response; \n";

    s += ' var t =' AFTER:'; for (var i in http) {t += (i +': ' + http [i] +'* ') ;} alert (t);} \n » ; Debug: to see the properties and the values have been set after the execution of

    BT. Body = s;

    bt.onResult = function (evt) {}

    callback (evt);

    };

    bt.onError = function (evt) {}

    callback (evt);

    };

    BT. Send();

    };

    Things to note:

    1. If I try to set the property requestheaders as in my code above, the request fails. If I comment on him, the request succeeds. The default value for requestheaders is not set.

    2 looking at the http after a successful request object, displays the properties of reponseheaders to be on: "KeepAlive, connection, Content-Length, 2, Content-Type, text/html;" "charset = utf-8, Date, Wednesday, June 24, 2015 09:45:40 GMT, server, gunicorn/18.0, sponsored by, https://www.runscope.com, Via, vegur 1.1. Before the query runs, the responseheaders has the value undefined to.


    If someone could help me configure the request (in particular the Content-Type header) headers, I would be eternally grateful!


    Thank you


    UPDATE:

    Using the ExtendScript SDK, I discovered the responseheaders property is an array of this format: ['Connection', 'keep-alive', 'Content-Length', 2, 'Content-Type', ' text/html'...]

    I tried to put the requestheaders for the same format (I've tried both ['Content-Type', "application/x-www-formulaires-urlencoded"] and ['Connection', 'keep-alive', 'Content-Length', 2, 'Content-Type', "application/x-www-formulaires-urlencoded"...]) with no luck



    It solved!

    The key to set the content-type header is set the property http.mime as follows:

    s += "http.mime =" application/x-www-formulaires-urlencoded '; \n » ;

    Also to be complete, you can add your own custom steps headers:

    s += "http.requestheaders = ["My-sample-Header","some value"]; \n » ;

  • SELECT the type of object and

    Hello

    I created the following: object_type and table
    create or replace type subscription_type as object
    (street varchar2 (20),)
    No varchar2 (5));

    create table test
    (integer id, address subscription_type);
    Insert in the test
    values (1, subscription_type (' x-test ', ' 1' ");)

    and I want to choose only the id and the street of the test of the table.
    How can I do this?

    Thank you

    : D

    Others agree as well with your description.

    A few recent examples:
    Forums should have a button {code}
    OTN Forum FAQ

    For the OP:
    Just use the {noformat

    {noformat} tag, put it before and after your sample code.
    So, when you type or copy/paste this:
     {noformat}
    

    Select *.
    Double;

    {noformat}
    it will appear as:
    

    Select *.
    Double;

    on this forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    
  • How to use the type of packages, procedures and functions in another schema?

    I have two schema target in an OWB project, such as A and b. In a map of A, I would use some packet types, functions and procedures of B. I tried the method of the suggested such synonym, but I couldn't find the metadata of these when importing... The only type of synonym I can import is the synonym for the table. Y at - it a bug for synonym?

    If I can't use a synonym for that matter, is there another way to solve the problem?

    Now, in some cases you will absolutely need to create the second module as Carsten described, but it should also be noted that you can reference objects in things like Expressions even if you have not loaded the metadata. It's only when you need strong bonding that it becomes necessary to import objects. For everything else, as long as the reference can solve during the compilation so you are good to go.

    For example, I target a function in a schema (S1) and a synonym private that it in another (s2). A mapping of the S2 schema has an expression object that uses the synonym of the function in the expression property for a couple of the attirbutes of output. The synonym has not been loaded in metadata - OWB has indeed no knowledge of its existence. But she is resolved at compile time if the mapping validates and generates successfully.

    Mike

  • determination of the type of object

    I have 2 classes inherit from the same class.
    public abstract class ParentProps {
    }
    
    public class OneProps extends ParentProps {
    }
    
    public class TwoProps extends ParentProps {
    }
    I have another class that has a method that receives an argument of type ParentProps. How will I know if the argument is of the type OneProps or TwoProps?
    public class Test {
       public static void testing(ParentProps props) {
       }
    }
    In the above example how can I know if the object the accessories is passed is a OneProps or a TwoProps object?

    If (OneProps instanceof accessories)

    on the other

  • How do you use the pathfinder on objects that have applied effects?

    I described some text, then applied effect > warp > Ark. What I want to do is cut off parts of the letters apart now listed. I tried to use the pathfinder palette, but it applies the pathfinder to the former, not surmounted by an arch shape. All advice is appreciated. Thank you.

    In which case it is important to maintain the effect of deformation, you need to use rather complex effect Pathfinder constructions (see effect > Pathfinder).

    It's probably easier to simply expand the appearance of your effects of deformation (see menu object), then use the Pathfinder palette.

    What version of Illustrator do you use?

  • Need help on the types of objects

    Hello Mr President

    I have one overlay out attributes and the value of the attributes

    DECLARE
    p_user_name_o VARCHAR2 (200);
    p_user_attributes_so manoj_tab_type;

    BEGIN
    p_user_name_o: = Maury
    xxcss_user.getuserattributes (p_user_name_o,
    p_user_attributes_so
    );

    IF (p_user_attributes_so. THERE ARE (1))
    THEN
    BECAUSE me IN p_user_attributes_so. FIRST... p_user_attributes_so. LAST
    LOOP
    Dbms_output.put_line ('attribute ='
    || p_user_attributes_so (i). ATTRIBUTE
    || '; Attribute value ='
    || p_user_attributes_so (i) .attribute_value
    );

    END LOOP;
    END IF;


    END IF;
    END;

    This wrapper will take the username as input and will give you all the attributes of username as the id, USERNAME, ADDRESS, LOCATION of the customer name

    I wanted to shoot only address and location of the envelope above.

    manoj_tab_type is an array of a type of object type

    Can you suggest me how to extract the address and location of theabove packaging. I wanted to print values

    Appreciate your help on the above

    Thanks and greetings
    Manoj Thakur R

    Just add an if STATEMENT stmt in the loop...

    FOR i IN p_user_attributes_so.FIRST .. p_user_attributes_so.LAST
    LOOP
     if p_user_attributes_so.ATTRIBUTE = 'ADDRESS' or p_user_attributes_so.ATTRIBUTE = 'LOCATION' then
       DBMS_OUTPUT.put_line ( 'Attribute='|| p_user_attributes_so.ATTRIBUTE|| '; Attribute Value='|| p_user_attributes_so.attribute_value);
     end if;
    END LOOP;
    

    HTH.

Maybe you are looking for

  • Motherboard Exchange want 6

    I bought an Envy6-1110us (with an AMD A8) and was disappointed with the performance, so I bought a replacement with a processor motherboard intel Core I5 processor. My problem is that I can't get the motherboard intel to display a video. I know it wo

  • USB drive not recognized in windows 7 but is recognized in windows xp

    I downloaded music files from my computer windows xp on a sandisk cruzer usb flash drive. I tried to download these files to my new laptop with windows 7, but the laptop has stated that it does not recognize the device. What I d0 now?

  • Local help only wireless

    Just moved into the new House and trying to the configuration of the wireless network.  Bought a Wireless - N 300 Router Netgear and I am unable to connect to internet wirelessly (local only).  Internet works when connected directly to the router wit

  • Cannot access a local network of off Site 2 Site VPN

    I have cisco ASA 5515-X and 8818 cisco router device I configured vpn site-to-site. the cisco ASA is a new device but the router is a device in another location and contain several tunnel work, now the tunnel is up but I can't ping LAN on the site of

  • HP laptop - 14 - r203nx: I can not activate my Bluetooth... Help, please

    Help, please! .. I can't activate my bluetooth, whenever I click his does not work but I have seen bluetooth and also I already installed a driver... What is the problem of my computer hp laptop? Laptop model: HP laptop - 14 - r203nx