How to call the procedure type table

Hi I have the below requirement

Created in the sub table type

CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);

create or replace procedure test_proc_type (p_type char_type) is

Start

I'm looping 1.p_type.count

dbms_output.put_line (p_type (i));

end loop;

end;

How to call the procedure with parameter as a type!

SQL> create or replace type  char_type as table of varchar2(4000)
  2  /

Type created.

SQL> create or replace procedure test_proc_type (p_type char_type)
  2  is
  3  begin
  4    for i in 1..p_type.count loop
  5      dbms_output.put_line (p_type(i) ) ;
  6    end loop;
  7  end;
  8  /

Procedure created.

SQL> set serveroutput on
SQL>
SQL> exec test_proc_type(char_type('A','B','C','D','E'))
A
B
C
D
E

PL/SQL procedure successfully completed.

SQL>

Tags: Database

Similar Questions

  • How to call the procedure on the page of the ofa

    Hi all

    I have a button.when I click this button need to call the procedure and should return the values.i tried with below code.am is error.i am passing two parameters to the procedure.please suggest me where I made a mistake in the code.

    error while calling procedure.PNG

    code in am

    -------------

    public String calprorate (String laseid, String billingid)

    {

    OADBTransaction oadbtransaction = (OADBTransaction) getTransaction ();

    OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl) getTransaction ();

    String retValues;

    System.out.println ("number:" + laseid);

    StringBuffer str = new StringBuffer();

    Str.Append ("BEGIN");

    Str.Append (LEASE_PRORATE_PKG ".") LEASE_PRORATE_PROC1 (»);

    Str.Append ("p_lease_id = >: 1");

    Str.Append ("p_billing_id = >: 2");

    Str.Append ("P_PRORATE = >: 3");

    System.out.println ("params");

    Str.Append (»); «) ;

    Str.Append ("END");

    System.out.println ("End");

    OracleCallableStatement oraclecallablestatement =

    (OracleCallableStatement) oadbtransaction.createCallableStatement (str.toString (), 1);

    System.out.println ("Oracle");

    try {}

    oraclecallablestatement.setString(1,laseid);

    oraclecallablestatement.setString(2,billingid);

    oraclecallablestatement.setInt (1, Integer.parseInt (laseid));

    oraclecallablestatement.setInt (2, Integer.parseInt (billingid));

    System.out.println ("param");

    oraclecallablestatement.registerOutParameter (3, Types.VARCHAR);

    System.out.println("3");

    oraclecallablestatement. Execute();

    System.out.println ("exe");

    retValues = oraclecallablestatement.getString (3);

    }

    catch (System.Exception e)

    {

    System.out.println ("delivery");

    throw OAException.wrapperException (e);

    }

    Return retValues;

    System.out.println ("End");

    }

    code co:

    -------------

    If (pageContext.getParameter ("Calc")! = null) {}

    Vo1 OAViewObject = (OAViewObject) am.findViewObject ("AddonBillingVO");

    System.out.println ("VO");

    {if(VO1!=null)}

    CNT int = vo1.getRowCount ();

    System.out.println ("count:" + cnt);

    If (cnt > 0)

    {

    RowSetIterator rs = vo1.createRowSetIterator("empIterator");

    System.out.println ("EMP");

    If (rs! = null)

    {

    While (rs.hasNext ())

    {

    AddonBillingVORowImpl line = rs.next ((AddonBillingVORowImpl));

    System.out.println ("impl");

    If (line! = null)

    {

    String laseid = row.getAttribute("LeaseId").toString ();

    System.out.println (laseid);

    String billingid = row.getAttribute("AddonBillingId").toString ();

    [Serializable] param = {}

    laseid, billingid

    };

    String newupc = (String) am.invokeMethod ("calprorate", param);

    }

    }

    Khalil.

    You can paste your spec procedure here?

    Also see: Oracle tips of Johny: OAF: sample code to call the PL/SQL of OA Framework procedure

  • How to call the procedure Oracle in ODI

    Hello

    I use ODI 10 g.

    Before you run the interface in a package, I wanted to place my procedure.

    I created the procedure in d/b (target)

    CREATE OR REPLACE PROCEDURE TEST_MY_NEW_PROCE
    AS
    BEGIN
    REMOVE FROM EMPLOYEE_TABLE
    WHERE EMPLOPYEE_ID LIKE '% P ';
    COMMIT;
    END;
    /

    The procedure works well in the target database.

    Now, before the execution of my interface, I want to run this procedure in my package. So can some please help me how to call this oracle (creation in target schema) ODI procedure and run it.

    Thank you.

    Hi, GRK,.

    You can create an ODI procedure, add one step, choose Oracle as technology and your target schema.
    Then just call it through a pl/sql block:

    BEGIN
     TEST_MY_NEW_PROCE;
    END;
    

    In your package, then drag this ODI procedure.

    Kind regards
    JeromeFr

  • How to call the procedure in the package

    Hi all!

    The situation!

    I received a package with body priview 'Change_utility '.
    In this package, I had procedure, changing the data when triger calls a package, it is all ok and working

    Now, I need to call a procedure in a single package gave him.

    I need to run the sta_death procedure in the 'Change_utility' package with no code 112233-4455

    How do I run that?


    Thanks for the help!

    ID

    Maybe (guessing)

    begin
    
      change_utility.sta_death('112233-4455');
    
    end;
    

    Concerning

    Etbin

  • How to call the procedure in the process

    Hello

    I have create procedure abc.
    How can I call procedure abc in the process in the processing of the Page.
    I want to call this procedure when I press the "submit" button.

    Thank you

    Hello

    Yes, that is correct

    Kind regards
    Jari

  • How to call the stored procedure when I press the button

    Hello

    I want to know how to call the procedure/SQL statement when I press the button using callable statement.

    can someone give me it please link who knows the steps to do this.

    Thanks in advance,
    SAN

    Hello

    read this good example http://www.baigzeeshan.com/2010/05/calling-plsql-procedure-and-function-in.html

    ~ Abhijit

  • Hi friends I want to know how to call a procedure that has values arrary as parameter?

    I have a procedure as shown below, and I am using oracle 11g.

    create or replace procedure procedureName (v_hospital_id in NUMBER,

    v_process_id VARR_VARRY,

    v_cnt OUT NUMBER);

    Now, how to call this procedure from PLSQL. If v_process_id values ('abc123', 'xyz234', 'sfs234')

    Please present the definition of VARR_VARRY

    If it's a simple table of varchar2.

    declare

    v_cnt NUMBER;

    Start

    procedureName (1, VARR_VARRY('abc123','xyz234','sfs234'), v_cnt);

    end;

  • How to apply the procedure inside a procedure and the evils of the value in a variable?

    Hi all

    I'm usung oracle 11g.

    Here is my package and procedure

    I want to call get_email_details this procedure within the process_email_master and store the value in a variable in main proceedings

    create or replace

    PACKAGE ms_gen_process_email

    as

    type email_type is rendered (subject varchar2 (4000 tank),

    email_body varchar2 (4000 tank),

    to_receipent varchar2 (4000 tank),

    cc_receipent varchar2 (4000 char));

    type email_type_table is table of the email_type;

    procedure process_email_master)

    p_metric_name IN VARCHAR2,

    p_current_stage in varchar2,

    p_action in varchar2,

    p_pid number,

    P_OBJECT_ID in varchar2

    -p_emai_master on p_email_type_table

    );

    PROCEDURE get_email_details)

    p_metric_name IN VARCHAR2,

    p_current_stage in varchar2,

    P_ACTION in varchar2,

    p_email_type_table1 on email_type_table

    ) ;

    END ms_gen_process_email;

    ----

    create or replace

    PACKAGE ms_gen_process_email BODY

    as

    procedure process_email_master)

    p_metric_name IN VARCHAR2,

    p_current_stage in varchar2,

    p_action in varchar2,

    p_pid number,

    p_object_id in varchar2

    )

    as

    Start

    null;

    EXCEPTION

    WHILE OTHERS

    then

    null;

    end process_email_master;

    PROCEDURE get_email_details)

    p_metric_name IN VARCHAR2,

    p_current_stage IN VARCHAR2,

    P_ACTION in varchar2,

    p_email_type_table on email_type_table

    )

    as

    BEGIN

    Select the object, email_body, to_receipent, cc_receipent

    bulk collect into p_email_type_table

    of ms_gen_email_config_detail

    WHERE email_key =)

    SELECT email_key

    OF ms_gen_email_config

    WHERE metric_name = p_metric_name

    AND action p_action =

    and current_stage = p_current_stage

    );

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

    dbms_output.put_line (p_email_type_table (i) reserve .under | p_email_type_table (i) .email_body: p_email_type_table (i) .to_receipent: p_email_type_table (i) .cc_receipent);

    end loop;

    EXCEPTION

    WHILE OTHERS

    THEN

    NULL;

    END get_email_details;

    END ms_gen_process_email;

    but I get this error message

    Error (15,31): PLS-00201: identifier 'P_EMAIL_TYPE_TABLE' must be declared

    Concerning

    Dale

    See below the test case and change your code. You can call the procedure in detail within a main as procedure below

    CREATE or REPLACE PACKAGE test_pkg AS

    TYPE rec_val IS RECORD (empno, emp.empno%TYPE,

    Ename emp.ename%TYPE

    );

    TYPE nt_tabtest IS TABLE OF THE rec_val;

    PROCEDURE get_email_id (p_type to nt_tabtest);

    PROCEDURE get_email_master;

    END;

    /

    CREATE or REPLACE PACKAGE test_pkg BODY

    AS

    PROCEDURE get_email_id (p_type ON nt_tabtest)

    AS

    BEGIN

    SELECT EmpNo, ename COLLECT in BULK in p_type FROM emp;

    END;

    PROCEDURE get_email_master

    AS

    v_type nt_tabtest;

    BEGIN

    get_email_id (v_type);

    BECAUSE me IN v_type. FIRST... v_type. LAST

    LOOP

    DBMS_OUTPUT. Put_line (v_type (i) .empno: v_type (i) .ename);

    END LOOP;

    END;

    END;

    /

    Post edited by: 000000

  • How to call the function (function Build-in user) in Pro * C program

    We have developed the application Pro * C program.
    TimesTen version is "TimesTen release 11.2.1.5.0 (64-bit, Linux/x86_64) (tt112150:53308) 2010-03 - 04 T 20: 39:30Z.

    We would like to develop Pro * C program you are using PL/SQL.

    We have a few questions.
    How to call the function (function Build-in user) in Pro * C program?

    #########
    TEST
    #########

    ttisql:
    Command > create or replace FUNCTION F_SAMPLE (i_str IN VARCHAR2)
    > BACK NUMBER
    > o_number NUMBER;
    > START
    > select i_str
    > in o_number
    > double;
    >
    > O_number RETURN;
    >
    > EXCEPTION
    > Others THEN
    > RETURN 0;
    > END;
    > /.
    display errors
    The function is created.
    Order > show errors
    No errors.
    Command >
    Command > set serveroutput on;
    Command > declare
    > number of num1;
    > start
    > num1: = F_SAMPLE ('A');
    > DBMS_OUTPUT. PUT_LINE ("F_SAMPLE" |) ' ' || NUM1);
    > end;
    > /.
    F_SAMPLE 0

    PL/SQL procedure successfully completed.

    Command >


    Pro * C case:

    EXEC SQL BEGIN DECLARE SECTION;
    number of num1;
    EXEC SQL END DECLARE SECTION;

    EXEC SQL EXECUTE
    Start
    : num1: = F_SAMPLE ('A');
    end;
    END-EXEC;

    Make sure to install:
    Error on line 146, column 3, file plsqlPROC.pc:
    Error on line 146, column 3 in file plsqlPROC.pc
    number of num1;
    .. 1
    PCC-S-02201, encountered the symbol "num1" when expecting one of the following conditions:


    Thank you.

    GooGyum

    There are two problems with your variable declaration:

    1. the name of the variable and type are thew misplacement autour.

    2. you may not use a host variable type.

    If you change this to:

    EXEC SQL BEGIN DECLARE SECTION;
    int num1;
    EXEC SQL END DECLARE SECTION;

    Then it will work very well.

    Chris

  • How to call the setting menu of the BIOS on HP DV4 1540us netbook?

    Hi all

    How to call the setting menu of the BIOS on HP DV4 1540us netbook?

    F2 does NOT an on-screen BIOS setting.

    Is there another trick?  Or, perhaps, defining the procedure step by step to start the BIOS?

    TIA

    Power on the laptop and all logo HP being displayed, press F10.

  • How to call the web service?

    Hello

    I want to know how to call the web service from my application HTML5 & javascript.

    Please help me find this detail as what I can access easily. and I want to access web services online (a method of it) I'm not concered with how background Web service takes place.

    I just want that when you call a web service method, I will return the result.

    Please try this out for a WebService call

    var xmlhttp;
    xmlhttp = new XMLHttpRequest();
    xmlhttp.open("get","your url",true);
    xmlhttp.setRequestHeader("Accept","application/json");
    xmlhttp.setRequestHeader("Content-type", "application/json");
    xmlhttp.onreadystatechange=function() {
     if (xmlhttp.readyState==4) {
      if (xmlhttp.status == 200) {
        console.log(xmlhttp.responseText);
      }
     }
    }
    xmlhttp.send();
    

    This will display the result of the invocation of webservice. The url is the application that you deploy and the type can be get/post. If xmlhttp.send (post) takes argument for the display of the data. You can call it by clicking a button in HTML.

  • ORA-06508, procedure cannot call the procedure of package

    I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not.  (It checks authorization of the student to enroll in a class).  We have a web process calling the stored procedure, and that works fine.  What does not work, is a call to the package.  Oracle returned ORA-06508: PL? SQL: could not find program unit called.

    I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508.  Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package.    (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).

    When I log in the user account with sqlplus and run a test, everything works fine.  But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.

    It seems as if the web process runs with the rights of the appellant, or a role is not granted.

    Can someone help me understand what the problem is?

    offered hv, I appreciate your comments.

    We solved the problem: remove the package that couldn't be cited, then re-create.   That's all!

    Apparently, something in the database was tangled upward.   The server recently had problems with disk space, then it might have been related to that.  But we'll never know for sure.

    The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant.  But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.

    I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.

    Finally let it drop and then re-create the package, it's which solved the problem.

    Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle.  Thanks for all the tips and suggestions.

  • Avoid calling the procedure in the cursor loop

    Hi all

    The following example of procedure the procedure written in cursor loop, is called each time until the end of the cursor loop...
    procedure proc_main is
    DECLARE
     cursor c1 is 
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
     
    BEGIN
      for i in c1 LOOP
       proc_test(i.empno,i.ename,i.dname,i.loc) ;
       end loop;
    END;
    -----------
    
    PROCEDURE proc_test (p_empno,p_ename,p_dname,p_loc) is
    ---
    ---
    begin
     select * into v1,v2,v3 ..
      from temp_tab
       where col1 =p_empno
        ----
        ----
    
    end;
    What would be the alternative methods to write the procedure above instead to call the procedure inside the cursor for loop
    My idea is to use collections... could you give me the code example using collections to meet the above criteria

    Thank you

    Published by: smile on February 28, 2012 15:45

    The ideal would be to collect all SQL logic and put as much of it in a single SQL statement as possible. It would be also great to determine what is the final outcome of the process and use it as a starting point for your SQL. For example, if the desired result is to upgrade the salaries of the employees where they have an entry in table x, you might find that you can avoid needing to separate the logic between multiple, i.e. instead of procedures

    procedure proc_main is
    DECLARE
     cursor c1 is
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
    
    BEGIN
      for i in c1 LOOP
       proc_test(i.empno,i.ename,i.dname,i.loc) ;
       end loop;
    END;
    -----------
    
    PROCEDURE proc_test (p_empno,p_ename,p_dname,p_loc) is
    ---
    ---
    begin
     select * into v1,v2,v3 ..
      from temp_tab
       where col1 =p_empno
        ----
        ----
    
        UPDATE
            emp e
        SET
            sal = v2
        WHERE
            e.empno = p_Empno;
    
    end;
    

    You may simply have

    procedure proc_main is
    BEGIN
    
        UPDATE
            emp e
        SET
            sal = ( SELECT
                        t.new_sal
                    FROM
                        temp_tab t
                    WHERE
                        t.empno = e.empno
                   )
        WHERE
            EXISTS
                (   SELECT
                        NULL
                    FROM
                        temp_tab t
                    WHERE
                        t.empno = e.empno
                );
    
    END;
    

    Even if your logic is more complex, you are likely to find that you can merge several of the statements that you could be running in a loop and replace that loop with a join.

    Given the particular structure of what you posted if, instead of calling the procedure in a loop, you can simply move the cursor c1 as a parameter to proc_test that is

    procedure proc_main is
    
        lc_c1   sys_refcursor;
    
    BEGIN
    
        OPEN lc_c1 FOR
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
    
       proc_test(c1) ;
    
    END;
    -----------
    
    PROCEDURE proc_test (p_Cursor sys_refcursor) is
    
    begin
    
        LOOP
            FETCH ....
    
            ...DO SOMETHING...
    
            EXIT WHEN p_Cursor%NOTFOUND;
    
        END LOOP;
    
        CLOSE p_Cursor;
    END;
    

    But I highly recommend that you consider trying to merge as much of your SQL before considering the approach of cursor.

    HTH

    David

  • How to call the javascript function in ADF

    I have the javascript function stored in a .js file external (try to reuse in another application). How can call the javascript function for an event of ADF faces component. I need to I am a newbie to ADF, all ideas are appreciated.

    Kind regards
    Surya

    Published by: sgodavar on Sep 24, 2010 11:44

    Include JavaScript to the jsff/jspx as page:

    Call it like:

    Type = "dblClick" / >
    Amit

  • How to find the user Apex table

    Hello

    Please let me know, how to find the user apex table. I need validate the unique user based on the same, for which I use below function.

    DECLARE
    VAL A BOOLEAN;
    BEGIN
    VAL: = APEX_UTIL.IS_USERNAME_UNIQUE (p_username =
    (: P6_USERNAME);
    END;

    However, in this case, he always comes back "FALSE," saying new user exists.

    Kindly help me in fixing this problem.

    There is a view called apex_workspace_apex_users.

    Details under Home > utilities > Application Express views

    André

Maybe you are looking for