Way of array to the procedure for questions

Hi all

I created an object type as a varray and passage to the procedure

I get the error message can help any one

Start
POPULATE_TABLE_TEST ('AAA', 'AA', 'AA');
end;
POPULATE_TABLE_TEST ('AAA', 'AA', 'AA');
*
ERROR on line 2:
ORA-06550: line 2, column 1:
PLS-00306: wrong number or types of arguments in the call to 'POPULATE_TABLE_TEST '.
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored

Thanks in advance
CREATE TABLE TABLE_TEST
(ID_NO NUMBER(10) , 
id_NAME VARCHAR2(10) , 
ATTRIBUTE1 VARCHAR2(10), 
ATTRIBUTE2 VARCHAR2(10)
);

select * from "TABLE_TEST"; 


CREATE OR REPLACE TYPE T_TYPE IS OBJECT ( 
id_NAME VARCHAR2(10), 
ATTRIBUTE1 VARCHAR2(10), 
ATTRIBUTE2 VARCHAR2(10) 
) ;

Create or replace  type TB_T_TYPE as varray(200) of  T_TYPE ;


CREATE OR REPLACE
PROCEDURE POPULATE_TABLE_TEST (EXAMPLE IN TB_T_TYPE) AS 

begin 

FOR I IN 1..EXAMPLE.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ID_NAME);
DBMS_OUTPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE1);
DBMS_OUtPUT.PUT_LINE(TREAT(EXAMPLE(I) AS T_TYPE).ATTRIBUTE2);
/*insert into TABLE_TEST(id,name,attribute1,attribute2) 
values (l_t_seq(i), 
treat(example(i) as T_TYPE).NAME, 
treat(example(i) as T_TYPE).ATTRIBUTE1, 
treat(example(i) as T_TYPE).ATTRIBUTE2 
);*/ 
end loop;
end; 

This one works :))

begin
    POPULATE_TABLE_TEST(TB_T_TYPE(T_TYPE('AAA','AA','AA')) );
end;

Tags: Database

Similar Questions

  • Way of array to the procedure in setting

    Hello

    I tried the following code,
    Where my goal is to divide the comma separated values and insert into a table and then pass this array to another procedure in a package
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST AS
     PROCEDURE PROC_SPLIT(IN_LIST  VARCHAR2) ;
     END; 
    
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST AS
     PROCEDURE PROC_SPLIT(IN_LIST  VARCHAR2) ;
     END; 
     
    
    
    CREATE OR REPLACE PACKAGE PAK_SPLIT_TEST
    AS
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2);
    END;
    
    
    CREATE OR REPLACE PACKAGE BODY PAK_SPLIT_TEST
    AS
       PROCEDURE PROC_REM_LIST (p_array l_data)
       IS
       BEGIN
          FOR i IN 1 .. p_array.COUNT
          LOOP
             DBMS_OUTPUT.put_line (p_array (i));
          END LOOP;
       END;
    
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2)
       IS
          TYPE SPLIT_array IS TABLE OF VARCHAR2 (4000)
                                 INDEX BY BINARY_INTEGER;
    
          l_data   SPLIT_array;
          l_txt    LONG := '100,200,300,400,500,600';
          l_str    LONG := IN_LIST || ',';
          l_n      NUMBER;
       BEGIN
          BEGIN
             l_data.delete;
    
             LOOP
                l_n := INSTR (l_str, ',');
                EXIT WHEN NVL (l_n, 0) = 0;
                l_data (l_data.COUNT + 1) := SUBSTR (l_str, 1, l_n - 1);
                l_str := SUBSTR (l_str, l_n + 1);
             END LOOP;
    
             PROC_REM_LIST (l_data);
          END;
       END;
     
     
     SELECT *FROM USER_ERRORS
    I get the error at line n ° 30
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    
       begin end function package pragma procedure form
    Could you please help me in this

    Thank you
    Smile

    This gives a shot:

    CREATE OR REPLACE PACKAGE BODY PAK_SPLIT_TEST
    AS
          TYPE SPLIT_array IS TABLE OF VARCHAR2 (4000)
                                 INDEX BY BINARY_INTEGER;
    
       PROCEDURE PROC_REM_LIST (p_array SPLIT_array)
       IS
       BEGIN
          FOR i IN 1 .. p_array.COUNT
          LOOP
             DBMS_OUTPUT.put_line (p_array (i));
          END LOOP;
       END;
    
       PROCEDURE PROC_SPLIT (IN_LIST VARCHAR2)
       IS
          l_data   SPLIT_array;
          l_txt    LONG := '100,200,300,400,500,600';
          l_str    LONG := IN_LIST || ',';
          l_n      NUMBER;
       BEGIN
          BEGIN
             l_data.delete;
    
             LOOP
                l_n := INSTR (l_str, ',');
                EXIT WHEN NVL (l_n, 0) = 0;
                l_data (l_data.COUNT + 1) := SUBSTR (l_str, 1, l_n - 1);
                l_str := SUBSTR (l_str, l_n + 1);
             END LOOP;
    
             PROC_REM_LIST (l_data);
          END;
       END;
    END pak_split_test;
    /
    

    PROC_REM_LIST expected a type of PL/SQL of L_DATA. You have not set this type anywhere (for example in the specifications of your package, body, or in SQL). I pass the declaration of PROC_SPLIT your body to package and it compiles.

    I hope this helps!

  • HEEELP: Re-create the procedure for the Essbase.sec file in 11.1.2.0

    Hello
    What is the procedure for recreating the file Essbase.sec in 11.1.2.0 Essbase environment... In older versions, it has been used to remove Essbase.sec, start the Essbase server and it has been recreated a file void essbase.sec... But in 11.1.2.0 with Shared services... is the procedure? If it is deleted from the file essbase.sec... start Essbase Service recreates and will update SSP Outlook2003?


    Please someone help...

    Thank you...

    Hi Alex,

    Unfortunately, I have about 20 questions to ask in order to really be able to provide useful guidance, but at least I recommend checking out 'The Essbase security file management' section of the Essbase DBAG and eventually the Oracle Hyperion Enterprise Performance Management System Backup and Recovery Guide.

    11.1.2.1 SER60-online http://docs.oracle.com/cd/E17236_01/epm.1112/esb_dbag/frameset.htm?launch.html

    11.2.1.1-online http://docs.oracle.com/cd/E17236_01/epm.1112/epm_backup_recovery_11121/frameset.htm?launch.html BURG

    Thank you

    Todd Rebner

  • What is the procedure for upgrading Thunderbird ESR 17.0.7 at 31.6 on Mac OSX 10.10.2?

    What is the procedure for upgrading from Thunderbird ESR 17.0.7 at 31.6 (last public version) on Mac OSX 10.10.2?

    Is it as simple as install new version and then run to see all local folders and my email and its folders from IMAP to my company as before the upgrade?

    Thank you

    Create a full backup of your Thunderbird profiles folder.
    Uninstall the old version of ESR.
    Download the latest version from https://www.mozilla.org/en-US/thunderbird/all.html and install it.

  • What is the procedure for the use of two monitors?

    What is the procedure for the use of two monitors?

  • Cannot get the procedure for d3dperf_setoption (d3d9.dll) - Skype address does not work

    I face this big mistake:-failed to get address of procedure for d3dperf_setoption (d3d9.dll)

    ... when I start my pc, then show this msg my Skype software does not work. installation of the software is no longer. Please solve my problem. thanking you...

    Hello jassi8,

    Often we see errors as the result of a program from loading at startup.

    To solve these, we use the clean boot troubleshooting.

    The following describes this process:

    http://support.Microsoft.com/kb/310353

    http://support.Microsoft.com/kb/316434

    Best regards

    Matthew_Ha

  • DBMS_METADATA. GET_DDL for all the procedures for a schema

    I'm trying to capture all the DDLS procedure for CUSTOM schema

    I use 11g on Linux.

    I have run this command...
    SELECT dbms_metadata. GET_DDL('PROCEDURE',,'CUSTOM') FROM DUAL;

    And this error occurs:
    ORA-31600: input value invalid NULL for the parameter VALUE in function SET_FILTER
    ORA-06512: at "SYS." Dbms_metadata", line 4018
    ORA-06512: at "SYS." Dbms_metadata", line 5843
    ORA-06512: at line 1


    Thanks in advance.

    user13716252 wrote:
    Now it works but I have only the first row in SQL PLUS...

    Select dbms_metadata. GET_DDL (u.object_type, u.object_name, 'SAPSR3')
    u dba_objects
    where type_objet = 'PROCEDURE '.
    and the owner = "SAPSR3";

    How to bring back the whole procedure?

    SQL > SET LONG 32000

  • Is there a way to dynamically calculate the values for the IN operator?

    I want to know if there is a way to dynamically calculate the criteria to include within an IN operator in the WHERE clause. "For example when I try to run the following I get an Oracle error message ' OR!-01722: invalid number." The script below is just an example to help illistrate the problem, I don't want to hardcode the values assigned to the v_test directly within the IN operator because the values of v_test will change from user to user.

    DECLARE

    v_test VARCHAR2 (10): = '1,15,25,55';
    v_tmp VARCHAR2 (50): = NULL;

    BEGIN
    SELECT d.metric_title IN the tbl_health_metric_definition v_tmp d
    WHERE d.metric_status = 'Active' AND d.metric_id IN (v_test);
    END;

    You can convert the string "1,15,25,55" online like this

    SQL> select regexp_substr('1,15,25,55' ,'[^,]+', 1, level) list
      2    from dual
      3  connect by level <= NVL( LENGTH( REGEXP_REPLACE( '1,15,25,55' , '[^,]+', NULL ) ), 0 ) + 1
      4  /
    
    LIST
    ----------
    1
    15
    25
    55
    

    and use this selection in your IN clause.

  • What is the best way I can find the shade for "yellow 12-0752TP"?

    Y at - it a book of color inside the Illustrator to help me get the samples to the right for carrying this name. Please see the link.

    You mean this one

    http://www.Pantone.com/pages/PANTONE/colorfinder.aspx?C_ID=334

    It's in a book of Pantone is not supplied with the AI.

  • Automatic indexation 2D array in the loop For - what is happening?

    I found many sources dealing 1 d tables in a loop For or a While loop, using automatic indexing, but nothing on the tables of higher order.

    I work with a program that feeds a 2D array in a loop (see table).  From what I see, it looks like this the results of automatic indexing in a 1 d, the first column of table 2-D table.

    This is the expected behavior, and it would hold true for arrays of higher order, table 3D for example?

    Is it possible to refer to the second column rather than the first?

    wildcatherder wrote:

    I found many sources dealing 1 d tables in a loop For or a While loop, using automatic indexing, but nothing on the tables of higher order.

    I work with a program that feeds a 2D array in a loop (see table).  From what I see, it looks like this the results of automatic indexing in a 1 d, the first column of table 2-D table.

    N ° it auto-index through a line at a time table.  You will get a 1 d table which consists of all of the columns that make up each row in each iteration.

    This is the expected behavior, and it would hold true for arrays of higher order, table 3D for example?

    Yes.  Automatic indexing on a 3D Board will give you a table on each iteration of each page 2D.

    Is it possible to refer to the second column rather than the first?  This question applies once you understand the first response.

  • Satellite P100-188: how to perform the procedure for recovery of the product?

    Hello

    I just had a bit of trouble to install a piece of software that, in the end I could settle with a system restore. This process was worried at the time that I could not get the software uninstalled properly (I had to download a program from the machine to uninstall!)

    At one point, I considered the restoration of my laptop Satellite P100-188 with the product recovery disc, the thing is I never did this before and I was wondering if someone could tell me the best sequence for later use.

    I have a standard Windows Media Center Edition OS, a recovery disk of the product, a disk Express Media Player and a CD of Drivers and tools that I created when I got the laptop.

    I have a feeling telling to restore Express Media Player before Windows, is does that mean that I have to insert this disc, install Express Media Player, then insert recovery disk product to install Windows?

    The Express Media Player disc formats the drive? It's not clear to me and I don't want to run into problems when I finally don't have to reinstall my operating system.

    I searched this forum to see if this information was already posted and could not find all the relevant information, all I can find are problems with the help of recovery and lack of discs discs.

    If it has been posted before could you provide me a link and I'm sorry again calls for data.

    Hello Gary

    If you want to have own OS preinstalled, the best solution is to use supplied recovery media. If the Express media player works well the leave it as it is and use the recovery DVDs only for clean operating system installation. All that s!

    Tools and Utilities CD can be used if you need to reinstall Toshiba designed tools or if you want to install your own operating system by using the facilities of Microsoft CD. If you have any other questions please post again.

  • The procedure for anonymous block PL SQL Exception Handling problem?

    Hello

    I am a newbie to PL/SQL.

    I'm having trouble when trying to manage exceptions for block anonymous PLSQL procedure I created will format any block of 10 digits and format it in the next (XXX) - XXX - XXXX.

    I need.

    1. the handle if there is more than 10 digits

    2. the handle if there are less than 10 numbers

    3. the handle if there is no inappropriate character (no number)

    4. the handle if there is no characters.

    I created the following procedure.  However, my if/else attempts logic or raise exceptions have create errors so far.

    Please enter the following code.

    create or replace

    PROCEDURE format_phone

    (

    p_phne_no IN OUT VARCHAR2

    ) IS

    extra_digits EXCEPTION; -Number must be a 10-digit number. Please enter the 10-digit

    no_digits EXCEPTION; -Please enter numbers there is no registration numbers.

    invalid_char EXCEPTION; -You entered a wrong character please enter numbers 0-9.

    less_digits EXCEPTION; -You have entered too few figures. Please enter a 10-digit phone number.

    BEGIN

    p_phne_no: ='(')

    || SUBSTR (p_phne_no, 1, 3).

    ')'

    ||' -'||

    SUBSTR (p_phne_no, 4, 3)

    ||' -'||

    SUBSTR(p_phne_no,7);

    -DBMS_OUTPUT. Put_line (p_phne_no);

    EXCEPTION

    WHEN invalid_char

    THEN

    dbms_output.put_line ('you have entered an inappropriate character please enter 0-9 numeric values.');

    WHEN no_digits

    THEN

    dbms_output.put_line (' Please enter the numbers there is no registration numbers.) ") ;

    WHEN less_digits

    THEN

    dbms_output.put_line (' you entered too few figures.) Please enter a 10-digit phone number. ") ;

    WHEN extra_digits

    THEN

    dbms_output.put_line (' you entered too many numbers.) Must include a 10-digit number. Please enter the 10 digits. ") ;

    END format_phone;

    Thank you for your concern.

    >>

    OK so I need to declare a variable, then pass p_phne_no parameter to this variable.

    You could, Yes, but you don't need to. You could simply test the value of the passed parameter

    Length (p_phne_no) > 10...

    > - I need 3 scenarios more in which I test Val., which is always equal to the parameter p_phne_no?

    Yes (or just test p_phne_no).

  • What is the procedure for removal and installation from a CD ROM Drive?

    I have a Compaq Presario 8000Z / 8QSXE1 PC. I just ordered a new CD ROM drive and expect to receive at the start of next week. I already know how to open my case, I just bought the antistatic carpet from Radio Shack with the hand strap to dissipate any static buildup on me and the PC. I got compressed air ready to clean any dust and the debri.

    But now if someone knows how to remove the old drive and install the new drive I as always greatly appreciate this info. What tools do I need etc will also be useful for this task.

    Thank you

    drake68

    Hi Drake,

    Review these "how-to" HP articles.  To remove and replace process should take less than 30 minutes.

  • What is the procedure for temporary storage of a H - P DeskJet 895Cse Color Printer

    Have replaced the H - P color printer DeskJet 895Cse printer H - P network.  Store temporarily until I can give to someone.   Should what procedure I follow to protect the integrity of the printer and not the holes to plug?

    Hello

    You will want to remove the cartridges because the printer do not seal in the transport of cartrridge of ink.

    When the new person gets the printer, they will need to run a page alignment and the printer test page to ensure that the flow of ink.

    Depending on how long it is in stock, ink cartridges can be put in a ziplock in an attempt to preserve them.

  • What is the procedure for recovery of password for ACS on windows

    Hi all

    With the "local auto connection" disabled, how can I recover the forgotten administrator password or reset it?

    Thanks in advance!

    Hello

    You must change the registry. Pls refer to this url:

    http://www.Cisco.com/warp/public/480/csntfaq.html#Q3

    Rgds,

    AK

Maybe you are looking for