How to see the output of an associative array in procedure

Hello
I tried the following code
And confused about the research at the exit of the associative array.
CREATE OR REPLACE PACKAGE test_pak1
AS
   FUNCTION map_object (obj_typ_in VARCHAR2)
      RETURN VARCHAR2;

   CURSOR c_c1
   IS
      SELECT * FROM emp;

   TYPE test_ttyp IS TABLE OF c_c1%ROWTYPE
                        INDEX BY PLS_INTEGER;

   PROCEDURE search_obj (obj_type VARCHAR2);
END;

CREATE OR REPLACE PACKAGE BODY test_pak1
AS
   FUNCTION map_object (obj_typ_in VARCHAR2)
      RETURN VARCHAR2
   IS
   BEGIN
      dopl ('Hello');
      RETURN abc;
   END;

   PROCEDURE search_obj (obj_type VARCHAR2)
   IS
      test_tab   test_ttyp;
   BEGIN
        DOPL  (test_tab);
      end;
   END;
In the above code, I want to see the output of the test_tab located in the search_obj procedure.

could you please help me in this

Thank you

Hi, smile,

If you want to see records, you must put the lines in your table. Here's a solution: in this solution, I only edit the search_obj procedure of your package like this:

 PROCEDURE search_obj (obj_type VARCHAR2)
   IS
      test_tab   test_ttyp;
      test_tab_r   c_c1%ROWTYPE;
   BEGIN
        --test_tab;
        --Here we put something in test_tab
        OPEN c_c1;

        LOOP
             Fetch c_c1 into test_tab_r;
             exit when c_c1%NOTFOUND;
             test_tab(test_tab.COUNT + 1) := test_tab_r;
         END LOOP;
        CLOSE c_c1;   

        FOR i IN 1 .. test_tab.COUNT LOOP
          dbms_output.put_line(test_tab(i).empno);
       END LOOP;

   END;

Here is the result:

SQL> exec test_pak1.search_obj('parameter_not_used_in_the_procedure');
7369
7499
7521
7566
7654
7698
7782
7788
7839
7844
7876
7900
7902
7934

PL/SQL procedure successfully completed.

SQL>

Tags: Database

Similar Questions

  • How to see the output of the varray

    Hello
    How can I see the output of the varray type;
    declare
    TYPE test_cas_ary IS VARRAY(2000) OF dept.deptno%TYPE;
    v_cas_ary test_cas_ary;
    begin
     dbms_output.put_line('dept_no(1) is '||v_cas_ary(1));
    end;
    The code above throws me error
    Reference to uninitialized collection
    Thank you
    SQL> set serveroutput on
    SQL> declare
    TYPE test_cas_ary IS VARRAY(2000) OF dept.deptno%TYPE;
    v_cas_ary test_cas_ary:=test_cas_ary(1,2);
    begin
     dbms_output.put_line('dept_no(1) is '||v_cas_ary(1));
    end;
     /
    dept_no(1) is 1
    
    PL/SQL procedure successfully completed.
    
  • How to get the 'index' of an associative array?

    Hello

    Is it possible to get the 'index' of an associative array?

    I saw say about 3000 ID.

    Corresponding to each of these identifiers, thre is a 'key' (the 'key' can repeat for different ID)... tell key1, key2, key3.

    Now, I want to show the top of page 8 keys ().

    Could you please tell me how can I do this?

    Concerning

    Don't know what you are exactly looking for.

    To get the index of an array of assotiative you should do something like

    SQL> declare
       type arr is table of number
                      index by varchar2 (5);
    
       var   arr;
       idx   varchar2 (5);
    begin
       --  fill the array
       for id in 1 .. 12
       loop
          var ('key' || to_char (id, 'fm00')) := id;
       end loop;
    
    --  get the keys
       idx := var.first;
       dbms_output.put_line (idx);
    
       while idx is not null
       loop
          idx := var.next (idx);
          dbms_output.put_line (idx);
       end loop;
    end;
    /
    key01
    key02
    key03
    key04
    key05
    key06
    key07
    key08
    key09
    key10
    key11
    key12
    PL/SQL procedure successfully completed.
    
  • How to see the old registered devices?

    How to see the list of disabled devices?

    If you have devices that are associated with your Apple ID, to the use of the content purchased from iTunes Store or access to subscription services, I don't think that there is a list of previously associated devices that are no longer associated.  I don't know what you mean by devices 'off '.

    If you ask about "old devices registered" on your Apple ID support profile, they must always be there.  This list is mainly for the purpose of support services.  You can check here

    https://supportprofile.Apple.com/

  • How to make the output of the task are an entry in another task

    How to connect the output of a task for I can use it as input for another task?  See this screen below: the task "Invoke the Script" run a PowerShell Script.  The task 'Send E-mail' send an email.  The two tasks work separately.  How can I get the results of my powerShell script that I can use them as content of the task 'Send Email'?

    workflow.jpg

    On the script invoke task you set the attributes of output containing the results of powershell.

    to do this, select the output tab and use an object name that was put in place in powershell results as in the data

    You may need to format, this results in a recognized VMware object I guess in your case it is a string type.

    and then select the e-mail task, select the task from email, click on the small eye looking for icon "view details".

    Select the Visual link

    Select the attributes you setup from the output of the previous task and hang it in the input parameters of the task to email.

    fact

  • How to see the signature of a function/procedure stored?

    Someone changed the signature of a function I am trying to run. It worked before, but now one of the parameters has changed to a new type. How to see the contents of it? It is the output in Oracle sqlplus.

    SQL > exec: rc: = newcaselistforvalidation (to_date ('2010-01-01 ',' yyyy-mm-dd hh), to_date ('2011-01-01 ',' yyyy-mm-dd hh), 100);
    START: rc: = newcaselistforvalidation (to_date ('2010-01-01 ',' yyyy-mm-dd hh), to_date ('2011-01-0))

    ***
    ERROR on line 1:
    ORA-01843: not one month valid
    ORA-06512: in "AST. NEWCASELISTFORVALIDATION', line 21
    ORA-06512: at line 1

    I suspect that this is the date which has been formatted into something new.
    SQL> desc newcaselistforvalidation
    
  • How to see the fn:trace() results in the newspaper and/or console workshop?

    Hello, all.
    So, I'm a new in ODSI, in advance, my excuse to basic questions.

    I would use the fn:trace () function. However, the following code does not send information either on AdminServer.log or Wokshop console. What is the reason?

    declare the procedure tns:test() {}
    declare $timeBefore as XS: date: = fn:current-date();
    FN: trace($timeBefore, "My First test"); -> How to see the trace output?
    Returns the value $timeBefore.
    };

    Here's what I have in the console AdminServer.log and workshop:

    common/application {}
    user: weblogic
    name: testCase2
    EventKind: update
    Server: AdminServer
    }

    performance of the query / {}
    compiletime: 93
    }

    common, session, request, invocation {}
    time: Tue may 25 15:41:12 IDT 2010
    Duration: 0
    }

    Update/service {}
    procedure: test
    arity: 0
    DataService: ld:Logical/over_files/testCase_OverFiles.ds
    script: declare ns0 namespace = "" ld: logic/over_files/testCase_OverFiles ";"
    {return value ns0:test() ;}
    }

    {/ common time signature}
    timestamp: Tue may 25 15:41:12 IDT 2010
    Duration: 93
    }

    Best regards
    Yuri.

    Edited by: ygauchma may 25, 2010 05:59

    Because I'm not over your shoulder, it must be very clear on what you tried.

    Your first post show you a procedure using the trace. Well, I tried this, and instructions (ODSI set to debug and WLS logging of debug level log level) and it worked. Have you tried that? Doing a job?

    Now you're showing a function. Have you tried setting log levels?

    Where are you looking for results? The will NOT in the Console for ODSI Studio Test view (I guess that's where you're looking). They will be in the WLS log file if you have configured the log WLS-> Log level = debug file. They will be in the WLS (stdout/stderr) console if you have configured this Log level = debug.

    I believe that the trace function is implementation specific, then there is no such thing as a generic example.

    -Mike

  • How to see the result in sql * more

    Hello
    IAM running a procedure to sql * more...
    I put quite a few DBMS .put line-out inside the proc for purporse debugging
    before running, I said set serveroutput on;
    the procedure is done correctly, but I don't see any output

    It just displays the procedure completed successfully

    How can I see the output

    concerning
    REDA

    Hello reda,.

    You are absolutely sure that the procedure actually runs one of these DBMS_OUTPUTs, that is, you are sure that alternate paths through your procedure are not taken?

    To confirm, put a DBMS_OUTPUT at the very beginning of your procedure, to see if that print, which should be if you set serveroutput on it.

  • How to see the content of what's currently on my iCloud of this site

    How to see the content of what's currently on my iCloud.  I would like to see these files presented in a display of file manager type in order to sort and remove if necessary.

    Go to iCloud.com, then click on your iCloud drive icon.  I hope this is what you mean or what you are looking for.

    iCloud Drive FAQ - Apple Support

  • How to see the level of ink for a dell v515w printer?

    Separated from this thread.

    How to see the level of ink for a dell v515w printer?

    Hi Albert,

    I appreciate your time display. You can refer to the manual for more information. http://www.Dell.com/Ed/business/p/Dell-V515w/PD

    To better help, contact Dell technical support.

    http://en.community.Dell.com/support-forums/peripherals/

    Thank you.

  • All the fonts/writing are gibberish and I can't not as what is written, so I can't change anything on my vista, how to see the writing again if I can read? Thank you

    All the fonts/writing are gibberish and I can't not as what is written, so I can't change anything on my vista, how to see the writing again if I can read? Thank you

    Try cleartype youre settings, follow this link.

    http://www.Microsoft.com/en-us/typography/default.aspx

    Also, look for downloads 'police' as you need...

    1, select "cleartype online setting" you will probably get a download popup, install the

    Update...

  • How can see the motherboard serial number in windows 7

    Salvation;

    I need how can see the serial number of the motherboard in windows 7
    I look forward to help me
    Thank you...

    You will most likely need remove the left side panel and look at the motherboard to determine the serial number.

  • How I see the preview image of my PDF documents?

    How I see the preview image of my PDF documents?

    Hi josepm26085232,

    Preview of thumbnails has been disabled in the latest Adobe Acrobat Reader DC due to security problem.

    If you want this feature, you will need to uninstall the latest version & reinstall the old version of the Adobe - Adobe Acrobat Reader DC Distributiondrive.

    Kind regards
    Nicos

  • How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    Hi abev41080082

    Greetings.

    Concerning

    Rohit

  • How to see the info of waiting events. After executing a statement select query

    Hello

    How to see the info of waiting events. After running a select query. Is there a setting to the value of this option?
    And I also want to see the following info. in the trace file. For this, what are the settings I need to adjust to the right?
    SELECT * FROM emp, dept 
    WHERE emp.deptno = dept.deptno;
    
    call   count      cpu    elapsed     disk    query current    rows
    ---- -------  -------  --------- -------- -------- -------  ------
    Parse      1     0.16      0.29         3       13       0       0
    Execute    1     0.00      0.00         0        0       0       0
    Fetch      1     0.03      0.26         2        2       4      14 
     
    Misses in library cache during parse: 1 
    Parsing user id: (8) SCOTT 
    Concerning
    Evelyne

    For

    SQL > show parameter dump;

    ORA-00942: table or view does not exist
    >
    Use

     GRANT SEECT ON v_$parameter to Your_User_Name
    

    For

    SQL > ALTER SESSION SET EVENTS = 10046 trace name forever, context level 12';

    ERROR:
    ORA-01031: insufficient privileges
    >
    Use

     GRANT ALTER SESSION to your_user
    

Maybe you are looking for

  • HP 15-g030so windows 7 drivers

    Hello My parents bought a HP 15-g030so, but Windows 8 is just too weird for them to work woth. I try to downgrade to Windows 7, but need help with drivers. After I installed Windows 7 I need network drivers to get operational wifi. No idea where to l

  • Install Angry Birds Game will not allow installation

    When I try to download the game Angry Birds and install it, I get a Message telling me that the system administrater has put parimiters tha will not allow this installation. What should I do to correct this?

  • LaserJet Color Laserjet cp3525 printing issues

    already replace the itb, Toners and Fuser... Help!

  • BlackBerry White Screen of Death on Curve 8520 Smartphones

    Hello! I have a problem with my BB 8520 curve, the appliance does not start and crashes at can (EMPTY) white screen and nothing more. The steps I've done so far so that it make it easy for advisors: Hard reset. NOGO Tried searching for updated softwa

  • SSH on context not admin

    Hi, in FWSM 3.1 code, I can ssh to a non-admin context directly? Is it supported? I am able to ssh to the context of the admin, but with the same configs, I couldn't directly connect to other contexts...