pass an associative array as parameter?

Hello

is it possible to create a table associative w/o using a variable to pass it as a parameter to a function?

As:

new Array(["ID":"timeout"])

But it does not work.

TIA

Don't know what you're trying to do, but an associative array is an object base type.

This will create an array containing a single element of the object:

new Array ({ID: "timeout"}) / / note the braces

Tags: Adobe Animate

Similar Questions

  • Associative array in an array?

    I joined a project to a flash game, and being the only one that has any type of coding experience, I have, of course, make the ActionScript.

    However, the coding I did that day where, in PHP, not in ActionScript.

    so, even if we just started, I have a problem:

    I need to create a list of objects and enemies, that the game has.

    the elements? No problem:

    var items:Array = new array("Coin", "Tools",.....);
    

    so which works fine now, but the bad guys are not a problem, now, I have the same base table.

    Yet I need an associative array in another associative array.

    Since I have no idea how to do this in ActionScript, this is what I mean, but in the State would be in PHP:

    array("enemy_1" => array("drops" => "coins/10", "requires" => "credits/100"), "enemy_1" => array("drops" => "tool/ Screwdriver")....)

    So I have an associative array of names of the enemy, and those who are associated with a new table showing information on the enemy.

    problem is that the above is PHP and I need that in ActionScript, I can figure out how to do an associative array, but not if you can pass an associative array as its value.

    Look into the Dictionary and Vector classes. Or just use the Object.

  • Cannot run the autonomous block for input of associative array parameter

    Hello

    I have created an associative array in a package-PKG_CMT_DAP

    TYPE r_supply_type_id IS RECORD(
                                   supply_type_id            varchar2(50));
    TYPE t_supply_type_id IS TABLE OF r_supply_type_id INDEX BY BINARY_INTEGER;
    l_supply_type_id t_supply_type_id;
    

    Later created a test procedure with an input of the above kind parameter

    create or replace
    procedure test_prc(p_in_st_id IN PKG_CMT_DAP.t_supply_type_id)
    AS
    v_input1 number;
    v_input2 number;
    BEGIN
    FOR z IN 1..p_in_st_id.COUNT 
    LOOP
    DBMS_output.put_line(p_in_st_id(z)supply_type_id);
    END LOOP;
    END test_prc;
    

    How to update successfully.

    Created a stand-alone as block below

    DECLARE
    BEGIN
    test_prc(p_in_st_id=>(100,200,300));
    END;
    

    Above am past in 100,200,300 as an input string, and the expected output should display all the numbers above on the screen.

    But it throws the below error

    Error report:
    ORA-06550: line 3, column 1:
    PLS-00306: wrong number or types of arguments in call to 'TEST_PRC'
    ORA-06550: line 3, column 1:
    PL/SQL: Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    

    Could you please help me where I am doing wrong?

    Kind regards

    Claudy Kotekal

    Claudy,

    While calling the procedure, you must declare the variable of type table. Give the values for the elements in the begin block and then pass that variable in the procedure. Something like below:

    Declare

    in_array PKG_CMT_DAP. r_supply_type_id;

    Begin

    in_array (1) .supply_type_id: = 100;

    in_array (2) .supply_type_id: = 200;

    in_array (3) .supply_type_id: = 300;

    test_prc (in_array);

    end;

    NOTE: There might be a few problems with my code syntax, but logic would be same.

    Try this and let me know.

    Thank you

  • What is the preferred means of data transmission as a type of record between the nested table of pl/sql program or an associative array

    What is the preferred means of data transmission in the associative array of the nested table record vs

    Choose between Nested Tables and associative arrays

    The two nested tables and associative arrays (formerly index - by tables) use similar index notation, but they have different characteristics when it comes to persistence and ease of passing parameters.

    Nested tables can be stored in a column of data, but can of associative arrays. Nested tables can simplify the SQL operations where you would normally join a single-column table with a larger table.

    Associative arrays are appropriate for relatively small lookup tables where the collection can be constructed in memory whenever a procedure is called or a package is initialized. They are good for the collection of the information volume is unknown beforehand, because there is no fixed limit on their size. Their index values are more flexible, as associative array indices can be negative, can be no sequential and can use values of string instead of numbers.

    PL/SQL automatically converts between the bays of the host and the associative arrays that use values of digital keys. The most effective way to move the collections to and from the database server is to implement data values in associative arrays, and then use these associative arrays with erections in bulk (the FORALL statement or BULK COLLECT clause).

    With the help of documents and Collections of PL/SQL

    Read this:

    How to pass the record set as a parameter of the procedure.

    https://community.Oracle.com/thread/2375173?TSTART=0

  • @HspNumToString () cannot pass the variable as a parameter?

    Hi all

    I create a rule that uses @HspNumToString () and pass a variable as a parameter.

    But it gives error on validation below the code associated with the @HspNumToString function.

    Var itemCounter = 1;

    ...

    DIFFICULTY ({UserEntity}, {period}: Dec,@MEMBER (@CONCATENATE ("Item", @HspNumToString (itemCounter))))

    ...

    ENDFIX

    and the error message is:

    "Error: formula [statement of DIFFICULTY] (line 97) parse error: invalid object type rule.

    IF I move a number as a parameter to @HspNumToString (), for example @HspNumToString (2) then the rule will be valid.

    Any suggestion?  Calculation Manager version is 11.1.2.4.001

    Best regards, Brian

    Hello

    I'm afraid that's how it is. You cannot use variables of calculation in trouble.

    Instead, you can set a static member of this dimension (i.e. "no element") and by your use of calculation an operator cross dimensional to calculate the item desired.

    See you soon,.

    Alp

  • Proc 10 call Oracle stored g with associative array from c# VS 2008

    I have the following PL/SQL procedure:


    CREATE OR REPLACE PROCEDURE HMA_ADM. PRC_VDM_SAVDEL_VEN_DOC

    (

    P_OP IN VARCHAR2,

    P_USRID IN TB_VDM_MANAGE_DOCUMENTS. CREATEDBY % TYPE,

    P_DATE IN VARCHAR2,--MUST BE STRING, OTHERWISE WE GET AN ERROR

    P_DOCNAM IN TB_VDM_MANAGE_DOCUMENTS. DOCUMENTNAME % TYPE,

    P_DOCLNK IN TB_VDM_MANAGE_DOCUMENTS. BUILDER % TYPE.

    P_FNGUID IN TB_VDM_MANAGE_DOCUMENTS. FILENET_GUID % TYPE,

    P_DESC IN TB_VDM_MANAGE_DOCUMENTS. DESCRIPTION % TYPE,

    P_REQID IN VARR

    ) IS


    Where VARR is:


    CREATE OR REPLACE TYPE VARR'S ARRAY OF INTEGER;


    In c#, I have the following code:

    Int64 [] intReqID;



    OracleCommand cmdVDL = new OracleCommand (DBQueries.SPQRY_SAVDELVENDOC, connDB);



    cmdVDL.CommandType = CommandType.StoredProcedure;


    cmdVDL.Parameters.Add (new OracleParameter ("P_OP", strop));

    cmdVDL.Parameters.Add (new OracleParameter ("P_CREATEBY", strUID));

    cmdVDL.Parameters.Add (new OracleParameter ("P_CREATEDATE", strDate));

    cmdVDL.Parameters.Add (new OracleParameter ("P_DOCNAM", strDocNam));

    cmdVDL.Parameters.Add (new OracleParameter ("P_DOCLNK", strURL));

    cmdVDL.Parameters.Add (new OracleParameter ("P_FNGUID", strGUID));

    cmdVDL.Parameters.Add (new OracleParameter ("P_DESC", strDesc));

    cmdVDL.Parameters.Add (new OracleParameter ("P_REQID", OracleDbType.Int64) {}

    CollectionType = OracleCollectionType.PLSQLAssociativeArray,

    Size = intReqID.Count (),

    Value = intReqID,

    DbType = DbType.Int64,

    OracleDbType = OracleDbType.Int64

    });



    [] OracleParameterStatus stat = new OracleParameterStatus [intReqID.Count ()];


    for (i = 0; i < intReqID.Count (); i ++) {}

    STAT [i] = OracleParameterStatus.Success;

    }


    "" "cmdVDL.Parameters ["P_REQID"]." ArrayBindStatus = stat;


    cmdVDL.ExecuteNonQuery ();

    When I run the present, I get the following error:

    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'PRC_VDM_SAVDEL_VEN_DOC '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    If I remove the associative array at the same time, the procedure works very well.

    What I am doing wrong?

    In addition,

    (1) support UDT requires ODP 11106.20 or later version (but can be used against db 10 g)
    (2) if the plsql is editable, you can exchange to an associative array rather to avoid having to create classes customized for the UDT and here is a short example of soft.
    Greg

    /*
    CREATE or replace PACKAGE MYPACK3 AS
    TYPE numarray is table of number index by BINARY_INTEGER;
    PROCEDURE getempsinarray(thearray IN numarray, numrecs out number);
    END MYPACK3;
    /
    CREATE or replace PACKAGE BODY MYPACK3 AS
     PROCEDURE getempsinarray(thearray IN numarray, numrecs out number)
     IS
     begin
      numrecs :=  thearray.count;
     END getempsinarray;
    END MYPACK3;
    /
    */
    
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    
    public class indexby
    {
         public static void Main()
         {
          OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
          con.Open();
          OracleCommand cmd = new OracleCommand("mypack3.getempsinarray", con);
          cmd.CommandType = CommandType.StoredProcedure;
    
          OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Int32);
          Param1.Direction = ParameterDirection.Input;
          Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
          Param1.Value = new int[3]{7369,7499, 7521};
          Param1.Size = 3;
    
          OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output );
    
         cmd.ExecuteNonQuery();
         Console.WriteLine("{0} records passed in",Param2.Value);
          con.Close();
         }
    }
    
  • Problems associative Array (Object)

    Here's the function that I face
    I read in a delimited string and using indexed arrays to break them up and assign keys and values to an associative array in a loop.
    I use variables in the loop and the load as expected in the loop table
    but outside the loop, the only key is the name of the variable and the value is not set
    This is the case by using dot or rating table, as well as literal strings for keys
    any help is appreciated

    watchSuspendData = function (id, oldval, newval): String {}
    the incoming suspendData string is delimited by a semicolon;
    newVal is: firstValue = Yes; captivateKey = 1
    var listSuspendData:Array = newval.split(";"); convert to a list of key/value pairs
    If (listSuspendData.length > 0) {}
    line 123: listSuspendData.length is: 2
    for (i = 0; i < listSuspendData.length; i ++) {//for each key/value pair}
    var keyValArray:Array = new Array();
    var myNameValue:String = listSuspendData ;
    line 127: listSuspendData
    is: firstValue = Yes
    keyValArray = myNameValue.split ("="); EM on the equal sign
    var myKey:String = keyValArray [0];
    var myVal:String = keyValArray [1];
    keyValArray [0] is: firstValue
    keyValArray [1] is: Yes
    store the key and the value in an associative array
    suspendDataArray.myKey = myVal;
    trace ("line 134: suspendDataArray is:" + suspendDataArray.myKey);
    trace is line 134: suspendDataArray is: Yes on the first pass and 1 on the second

    }
    the loop below always returns an array key: myKey and the undefined value
    for (x in suspendDataArray) {}
    trace ("x is:" + x); x is: myKey
    trace ("the val is:" + suspendDataArray.x); the val is: undefined
    } //end for

    }
    return newval;

    Many thanks to blemmo and everyone who responded
    using the table syntax OK solved the problem
    really appreciate the help!

  • Difference between an associative array, table etc.?

    Hello

    I wonder what are the differences in comparison with these? They seem similar, but a table need a custom c# and the associative array type class does not. When should you use that? Say I want to pass a collection of numbers to a perhaps stored procedure?

    You want to test something to appropriate for what your use to gauge that.

    I just did a quick test and associative is quite a bit faster than the UDT for my test regarding the disappearance of the object and the invocation of the proc (I went from size 1000 channels 2000), but I've also used an empty body of the stored procedure and the proc in fact might affect things.

    Here is my code if you want to test. I used ODT to generate the V2TYP class and then changed string [] m_V2TYP; to the public within this category just for ease of use.

    It will be useful,
    Greg

    /*
    create type v2typ is table of varchar2(4000);
     /
    create or replace package testpack as
    TYPE v2array is table of varchar2(4000) index by BINARY_INTEGER;
    PROCEDURE test_assoc_array(v2arr1 IN v2array);
    procedure test_udt(v2udt in v2typ);
    END;
    /
    CREATE or replace PACKAGE BODY testpack AS
    PROCEDURE test_assoc_array(v2arr1 IN v2array) IS begin null; END;
    procedure test_udt(v2udt in v2typ) is begin null; end;
    END;
    /
    */
    
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    namespace compare_assocarray_and_udt
    {
        class Program
        {
            static string constr = "data source=orcl;user id=scott;password=tiger;";
            static void Main(string[] args)
            {
                int numelements = 1000;
                string[] vals = new string[numelements];
                for (int i = 0; i < numelements; i++)
                    vals[i] = new string('a', 2000);
    
                V2TYP myv2typ = new V2TYP();
                myv2typ.m_V2TYP = vals;
    
                test_assoc_array(vals);
                test_udt(myv2typ);
            }
    
            static void test_assoc_array(string[] vals)
            {
                using (OracleConnection con = new OracleConnection(constr))
                {
                    con.Open();
    
                    using (OracleCommand cmd = new OracleCommand("testpack.test_assoc_array", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
                        Param1.Direction = ParameterDirection.Input;
                        Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                        Param1.Size = vals.Length;
                        Param1.Value = vals;
                        DateTime start = System.DateTime.Now;
                        cmd.ExecuteNonQuery();
                        Console.WriteLine("assoc array elapsed: {0}ms", (System.DateTime.Now - start).TotalMilliseconds.ToString());
                    }
                }
            }
    
            static void test_udt(V2TYP val)
            {
                using (OracleConnection con = new OracleConnection(constr))
                {
                    con.Open();
    
                    using (OracleCommand cmd = new OracleCommand("testpack.test_udt", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Object);
                        Param1.Direction = ParameterDirection.Input;
                        Param1.UdtTypeName = "SCOTT.V2TYP";
                        Param1.Value = val;
                        DateTime start = System.DateTime.Now;
                        cmd.ExecuteNonQuery();
                        Console.WriteLine("udt elapsed:         {0}ms", (System.DateTime.Now - start).TotalMilliseconds.ToString());
                    }
                }
    
            }
        }
    }
    
  • Table binding error ORA-01485 when I try to get in an associative array

    Hello

    I test to pass in an array associative odp.net

    So I created a simple testpackage:
    CREATE TABLE jwetesttab (CLIENTNR NUMBER (10) NOT NULL);

    CREATE OR REPLACE PACKAGE IN THE JWETEST_PK
    TYPE t_CLIENTNRS IS TABLE OF NUMBER INDEX OF PLS_INTEGER;
    PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted OUT NUMBER);
    END JWETEST_PK;
    /

    CREATE OR REPLACE PACKAGE BODY JWETEST_PK AS
    PROCEDURE TestArrayIn (p_CLIENTNRS IN t_CLIENTNRS, p_NbOfRowsInserted ON the NUMBER)
    IS
    BEGIN
    FORALL i IN p_CLIENTNRS.first... p_CLIENTNRS. Last
    INSERT INTO jwetesttab (CLIENTNR) VALUES (p_CLIENTNRS (i));
    p_NbOfRowsInserted: = SQL % ROWCOUNT;
    COMMIT;
    END TestArrayIn;
    end JWETEST_PK;
    /

    Then I did as simple testapp as follows:
    Protected Int As Integer = 0
    Dim arrNums() As Integer = {1, 2, 3}
    Dim cmd As New OracleCommand
    Dim cnn as new OracleConnection (s_conn)
    Try
    With cmd
    . ArrayBindCount = 3
    . Connection = cnn
    . CommandText = "JWETEST_PK. TestArrayIn ".
    . CommandType = CommandType.StoredProcedure

    Var p_Clientnrs As OracleParameter = New OracleParameter
    With p_Clientnrs
    . ParameterName = "p_CLIENTNRS."
    . DbType = DbType.Int32
    . CollectionType = OracleCollectionType.PLSQLAssociativeArray
    . Value = arrNums
    . Size = 3
    Ends with
    . Parameters.Add (p_Clientnrs)
    . Parameters.Add (New OracleParameter ("p_NbOfRowsInserted", OracleDbType.Int32, ParameterDirection.Output))
    CNN. Open()
    cmd ExecuteNonQuery()).
    Int = CInt (.) Parameters ("p_NbOfRowsInserted"). Value)
    Ends with

    Catch ex As Exception
    MsgBox (ex.) Message)
    Finally
    If (cnn IsNot Nothing) = False Then
    CNN. Close()
    CNN. Dispose()
    End If
    End Try

    When I run my testapp, the lines are inseterd in the database, but it gives me an error: link table error: ORA-01485

    Liaison of the table and the associative arrays are two different functions and tend to confuse because they both have the word Array in them.

    The table binding is for "run this procedure and statement number X times, all the data here is at the front. ''
    Associative array is to "perform this procedure once, here is the table I want to that you pass in.

    Start by removing ArrayBindCount = 3and see if that helps

    If you still have problems, see the example of associative array on your hard disk to %OH%\ODP.NET\samples\2.x\AssocArray

    It will be useful,
    Greg

  • Associative array syntax

    I want to create an associative array, but using variables instead of coding hard.

    example of

    Instead of

    Assoc ['field1'] = data;

    I want to

    Assoc [fieldname] = data;

    I read for centuries and can't seem to find anything. I tried the above and it does not work.

    Any suggestions?

    Okay, I think that I managed to solve it. It seems to work although I don't know if maybe I've not initialized properly. I had a number of things wrong with the previous code. One was to have the push in the loop of passes and the other has changed the way to configure the array.

  • Array as parameter of output for procedure - help needed.

    Hello

    I'm having a procedure that calculates 6 medium.

    Now, can I get these 6 values as output parameter using an array.

    Help, please.

    Thanks in advance.

    Concerning
    Rambeau

    Did you not find this thread and be useful?

    Re: Return of the associative arrays in a stored procedure

  • How to: compare 2 associative arrays element-by-element

    After playing, I decided to go with the approach of the two sets of data of their own associative array.  The code and the results of this are below.  My question is the comparison.  For each element within the matrix of order, check all the items in the details table to see if there's a football game.  If there is a match > > > move to the next item in the control panel and check all the items in the details table to see if there is a football game.  Go until the whole is considered to be a match (in number of rows and values).  If no match, take the exit.

    Below, you'll see my logic to get both sets of data into their respective tables.  The results with a note attached to one of the elements is also pasted here (hereinafter the code).

    DECLARE

    TYPE details_t () IS RENDERING

    SIDE AUTO_RECIPE_DETAILS. SIDE % TYPE.

    REF_DES AUTO_RECIPE_DETAILS. REF_DES % TYPE,

    PART_NUM AUTO_RECIPE_DETAILS. PART_NUM % TYPE

    );

    TYPE details_type IS TABLE OF details_t INDEX OF AUTO_RECIPE_DETAILS. PART_NUM % TYPE;

    details_recipe details_type;

    pid_recipe details_type;

    compare_result details_type;

    CURSOR details_cur

    IS

    SELECT A FACE, REF_DES, PART_NUM

    OF AUTO_RECIPE_DETAILS

    WHERE RECIPE_NAME =' 40617-000001;

    CURSOR pid_cur

    IS

    SELECT cl. SIDE, lacpa. REF_DES, NVL(oecl.COMPONENT_ID, 'NOT APPLIED') AS PART_NUM

    OF ORDER_ERP_COMPS_LIST lacpa

    RIGHT OUTER JOIN CAD_LOCS cl

    ON cl. REF_DES = LACPA. REF_DES

    WHERE lacpa. ORDER_NUM = "PSY142420."

    AND CL. FAB = '38112';

    counter_d number (10): = 0;

    counter_p number (10): = 0;

    comp_counter number (10): = 0;

    BEGIN

    FOR rec IN details_cur

    LOOP

    counter_d: = counter_d + 1;

    details_recipe (counter_d). SIDE: = rec. SIDE;

    details_recipe (counter_d). REF_DES: = rec. REF_DES;

    details_recipe (counter_d). PART_NUM: = rec. PART_NUM;

    END LOOP;

    FOR rec IN pid_cur

    LOOP

    counter_p: = counter_p + 1;

    pid_recipe (counter_p). SIDE: = rec. SIDE;

    pid_recipe (counter_p). REF_DES: = rec. REF_DES;

    pid_recipe (counter_p). PART_NUM: = rec. PART_NUM;

    END LOOP;

    -for each pid_recipe element, double-check each record in details_recipe to see if there is an item matching (record)...

    FOR indx_d IN details_recipe. FIRST... details_recipe. LAST

    LOOP

    DBMS_OUTPUT. Put_line (details_recipe (indx_d). SIDE | ', ' || details_recipe (indx_d). REF_DES | ', ' || details_recipe (indx_d). PART_NUM);

    END LOOP;

    DBMS_OUTPUT. PUT_LINE ('IN THE SECOND PART OF IT!');

    FOR indx_p IN pid_recipe. FIRST... pid_recipe. LAST

    LOOP

    DBMS_OUTPUT. Put_line (pid_recipe (indx_p). SIDE | ', ' || pid_recipe (indx_p). REF_DES | ', ' || pid_recipe (indx_p). PART_NUM);

    END LOOP;

    END;

    /



    RESULT:


    DETAILS TABLE

    RECIPE FOR THE DETAILS TABLE:

    B, R28, 34315-26R7

    B, R38, 34315-4990

    B, R40, 34152-1R60

    B, R45, 34315-1002

    B, R46, 34315-3011

    B, R48, 34152-1004

    B, R55, 34315-5901

    B, R64, NOT APPLIED

    B, R77, 34315-4992



    CONTROL PANEL

    THE RECIPE IS CALCULATED IN THE ORDER ITSELF:

    B, C01, 39412-334 / / for that one single item-> check all the items from the table (above) details Table and see if an element matches.  Move to the next item if there is a match...

    B, C02, 39412-334

    B, C03, NOT APPLIED

    T, C11, 27249-105

    T, C13, 35404-104

    T, C14, 27531-224

    T, C15, 35404-104

    T, C18, 27249-105

    T, C19, 27531-224

    CHANGED:

    THIS... is the solution to my original question.  I had a little mistake that I set between this and my last post with this code.  Just in case a person who could use an example like that falls on this thread.

    FOR index_p IN pid_recipe. FIRST... pid_recipe. LAST

    LOOP

    Result WHEN the OUTPUT = 1;

    FOR index_d IN details_recipe. FIRST... details_recipe. LAST

    LOOP

    IF (pid_recipe (index_p). SIDE = details_recipe (index_d). SIDE)

    AND (pid_recipe (index_p). REF_DES = details_recipe (index_d). REF_DES)

    AND (pid_recipe (index_p). PART_NUM = details_recipe (index_d). PART_NUM)

    THEN

    EXIT;

    ON THE OTHER

    DBMS_OUTPUT. Put_line("IT WAS NOT a MATCH");

    result: = 1;

    EXIT;

    END IF;

    END LOOP;

    END LOOP;

    DBMS_OUTPUT. Put_line('LOOP OUT');

  • Using associative arrays in query

    Hi all

    Please see my schedule. It works very well

    [CODE]

    DECLARE

    type mechanics_type_tab is table of index varchar2 (15) by varchar2 (15);

    l_mechanics_type mechanics_type_tab;

    L_BULLETIN t_tfo_wf_varchar_table:=t_tfo_wf_varchar_table();

    l_count pls_integer: = 0;

    BEGIN

    FOR I IN (select bulletin_id, mechancs_type_id

    of TFO_BULLETIN_PROMO_MECHANICS

    where mechancs_type_id is not null) LOOP

    l_count: = l_count + 1;

    l_mechanics_type (i.bulletin_id): = i.mechancs_type_id;

    l_mechanics_type (i.mechancs_type_id): = i.mechancs_type_id;

    L_BULLETIN.extend;

    L_BULLETIN (l_count): = i.bulletin_id;

    END LOOP;

    FOR J IN (SELECT TABLE COLUMN_VALUE (L_BULLETIN)) LOOP - this will change

    DBMS_OUTPUT. Put_line ('COLUMN_VALUE =' | l_mechanics_type (J.COLUMN_VALUE));

    END LOOP;

    / * does not

    Insert into test_table (test1)

    SELECT values l_mechanics_type (COLUMN_VALUE) OF TABLE (L_BULLETIN); */

    END;

    [/ CODE]

    instead of the code below:

    FOR J IN (SELECT TABLE COLUMN_VALUE (L_BULLETIN)) LOOP - this will change

    DBMS_OUTPUT. Put_line ('COLUMN_VALUE =' | l_mechanics_type (J.COLUMN_VALUE));

    END LOOP;

    When I did as below

    [CODE]

    insert into test_table (test1) to

    SELECT values l_mechanics_type (COLUMN_VALUE) OF TABLE (L_BULLETIN);

    [/ CODE]

    It does not work. Why it does not work.

    Please note that in the real-world scenario, there are several fields to insert for test_table and test1 is one of them.

    Just because the associative arrays are not supported in SQL before ORACLE 12 c.

    HTH

  • Associative array

    I have a table proj_test .i want to recover the data in the associative array.

    How to do?

    create table proj_test as  
      select 1 as id, 1 as rn, 'Fred' as nm from dual union all  
      select 1,2,'Bloggs' from dual union all  
      select 2,1,'Scott' from dual union all  
      select 2,2,'Smith' from dual union all  
      select 3,1,'Jim' from dual union all  
      select 3,2,'Jones' from dual  
    
    

    You need not Associative array if you do a bulk of collect. You can use the nested PL/SQL table type.

    11g and more

    declare

    is of type tbl table of the proj_test % rowtype;

    tbl l_tbl;

    Start

    SELECT id, rn, nm bulk collect into l_tbl

    of proj_test;

    because me in 1.l_tbl.count

    loop

    dbms_output.put_line

    (

    RPAD (to_char (l_tbl (i) USER.USER), 10, ' ')

    || RPAD (to_char (l_tbl (i). (RN), 10, ' ')

    || l_tbl (i) .nm

    );

    end loop;

    end;

    Before 11 g

    declare

    type id_tbl is table of the proj_test.id%type;

    type rn_tbl is table of the proj_test.rn%type;

    type nm_tbl is table of the proj_test.nm%type;

    id_tbl l_id;

    l_rn rn_tbl;

    l_nm nm_tbl;

    Start

    SELECT id, rn, nm bulk collect into l_id, l_rn, l_nm

    of proj_test;

    because me in 1.l_id.count

    loop

    dbms_output.put_line

    (

    RPAD (to_char (l_id (i)), 10, ' ')

    || RPAD (to_char (l_rn (i)), 10, ' ')

    || l_nm (i)

    );

    end loop;

    end;

  • Error renaming dates to an associative array of type date

    Hi all

    I am facing issue while assigning dates in an associative array of type date:

    Oracle version:

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    Stored procedure, I try to write is as follows

    1. create or replace procedure (jp1)
    2. p_start_date default date trunc(sysdate,'MM')
    3. p_end_date date default trunc (sysdate)
    4. )
    5. is
    6. number of l_no_of_days;
    7. type t_date_id is table of date
    8. index by pls_integer;
    9. l_date_id_arr t_date_id;
    10. Start
    11. l_no_of_days: = p_end_date - p_start_date;
    12. for i from 0
    13. .. l_no_of_days - 1
    14. loop
    15. l_date_id_arr: = p_start_date + i;
    16. dbms_output.put_line (p_start_date + i);
    17. end loop;
    18. end;
    19. /

    I get error on line 14 when compiling it. and the error message is as follows:

    JP1 PROCEDURAL errors:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    14/5 PL/SQL: statement ignored
    14/22 PLS-00382: expression is of the wrong type

    While studying this, I tried the value of (p_start_date + i) using dbms_output.put_line and the output is so date itself.

    1. create or replace procedure (jp1)
    2. p_start_date default date trunc(sysdate,'MM')
    3. p_end_date date default trunc (sysdate)
    4. )
    5. is
    6. number of l_no_of_days;
    7. type t_date_id is table of date
    8. index by pls_integer;
    9. l_date_id_arr t_date_id;
    10. Start
    11. l_no_of_days: = p_end_date - p_start_date;
    12. for i from 0... l_no_of_days-1

    13. loop
    14. -l_date_id_arr: = p_start_date + i;
    15. dbms_output.put_line (p_start_date + i);
    16. end loop;
    17. end;
    18. /

    output of the

    1. exec jp1

    is as follows:

    1ST DECEMBER 13

    2 DECEMBER 13

    3 DECEMBER 13

    DECEMBER 4, 13

    5 DECEMBER 13

    DECEMBER 6, 13

    7 DECEMBER 13

    DECEMBER 8, 13

    9 DECEMBER 13

    DECEMBER 10, 13

    DECEMBER 11, 13

    DECEMBER 12, 13

    13 DECEMBER 13

    14 DECEMBER 13

    15 DECEMBER 13

    16 DECEMBER 13

    17 DECEMBER 13

    18 DECEMBER 13

    I see the release date itself. so why he throws error while the same assignment to an associative array of type date.

    I tried Google too for the same but without success.

    Any help is appreciated in this regard not or any pointer another thread on the internet or in this forum.

    Thanks in advance

    Jagdeep Seven

    Read associative arrays:

    1. create or replace procedure (jp1)
    2. p_start_date default date trunc(sysdate,'MM')
    3. p_end_date date default trunc (sysdate)
    4. ) is
    5. number of l_no_of_days;
    6. type t_date_id is table of date
    7. index by pls_integer;
    8. l_date_id_arr t_date_id;
    9. Start
    10. l_no_of_days: = p_end_date - p_start_date;
    11. because me in 0.l_no_of_days - 1
    12. loop
    13. l_date_id_arr (I): = p_start_date + i;
    14. dbms_output.put_line (p_start_date + i);
    15. end loop;
    16. end;

    ----

    Ramin Hashimzade

Maybe you are looking for

  • How to separate 2 IPADs using the same Apple ID

    Problem: I have 2 iPad (IPAD 2/IPAD Air) using the same Apple ID.  To maximize the storage capacity on two IPADs, how can we separate the two so that each IPAD will show its max 16 GB storage?   I have to reconfigure the old IPAD back to factory sett

  • Mac Pro 2008 RAM Upgrade

    Hello My Early 2008 Mac Pro (3,1) currently has 6 GB of RAM (two 1 GB sticks) and two sticks of 2 GB and I bought a pair of used ram (800 MHz DDR2, who works with the Mac Pro 2008 according to the announcement on Ebay) to take up to 8 GB. I have a Ki

  • AirPlay on multiple devices?

    In iTunes, 12.1 I was able to listen to my music anywhere in the home using AirPlay in iTunes. I could send a read track to several devices at the same time including Apple TV, and Airport Express... See screenshot: I've just updated to iTunes 12.3 b

  • How to change the value programmatically combox

    Here, if I press the button Combobox should change led should turn on if I press OFF button Conboxbox should change to OFF & Led should turn OFF. How to do that using the schema property to which I must take to the drop-down list box. Thanks in advan

  • XP ON X 200

    URE why pilots don't work any ideas?