How to display more than one Record in a Loop

Hi ,
This procedure will return more than one data .
so please tell me how can i write a loop to display all the records of a Table .
This is my procedure :
create or replace procedure getEmpName
V_EMPID IN employee.EMPID%TYPE,
V_EMPNAME OUT employee.EMPNAME%TYPE
is
begin
select empname into V_EMPNAME from employee where empid='2';
end ;
This is my block : How to write a loop here to display all records of my Table
declare
v_EMPNAME EMPLOYEE.EMPNAME%TYPE;
begin
getEmpName(2, v_EMPNAME);
dbms_output.put_line(v_EMPNAME);
end

user10503747 wrote:
so please tell me how can i write a loop to display all the records of a Table .hi,
given procedure will display all records of emp table...
CREATE OR REPLACE PROCEDURE Testloop
AS
CURSOR test1
IS
SELECT EMPNO, ENAME FROM EMP;
BEGIN
     FOR i IN test1
     LOOP
     DBMS_OUTPUT.PUT_LINE ( 'Emp - '||i.empno ||'-'||i.ename );
     END LOOP;
END;
Thnx
MB

Similar Messages

  • How to display more than one column with for each

    Hi guys,
    how to display more than one column with for each like below?
    for each
    Item1
    Item2
    Item3
    Item4
    Item5
    Item6
    Item7
    Item8
    Item9
    Item10
    End for each
    for each          
    Item1     Item2     Item3
    Item4     Item5     Item6
    Item7     Item8     Item9
    Item10          
    End for each

    Take a look at this to see if the solution provided would work for you: https://blogs.oracle.com/xmlpublisher/entry/multi_column_row_woes
    Won't you have more than 10 records in your data file ? If you are going to have only 10 items then you may be able to use position() function to limit it to 3 each..
    Take a look at this: https://blogs.oracle.com/xmlpublisher/entry/turning_rows_into_columns
    Thanks,
    Bipuser

  • How to show more than one record at a form-like style report?

    Hi All,
    I developed a form-like style report
    I want it to show more than one record at once (At the same page)
    I tried that by setting the value to "Maximum records per page" property for the repeating frame to 10
    but when I close the property palete and open it agian the value is returned to 1 !!!
    how to show more than one record at the same page?????
    Thank u

    Hi,
    there's perhaps another property like "page protect". If than 2 records didn't fit at one page there's a page break. Or is there any object inside the repeating frame with page-break properties? Sorry .. it's like looking into a chrystal ball ...
    Regards
    Rainer

  • How to display more than one documents on windows 8 desktop?

    how to display more than one documents on windows 8 desktop?

    Adobe Reader Touch doesn't show more than one file on screen and doesn't show them on the desktop. Apparently these are very old fashioned things that Microsoft doesn't think we'll want to do any more and calls them "legacy" to make them sound antiquated.
    If you want to do these things use the legacy Adobe Reader, a much more powerful and flexible app (and not obsolete in the slightest). http://get.adobe.com/reader . There are no legacy apps in the Windows App Store.

  • How to return more than one record through OUT parameter in procedure

    Hi,
    I want to create a procedure which accepts one input and returns more than one record as output.
    example:
    Input = DeptNo
    Output= Empno,ename,sal,comm,job
    Scenario:
    There can be more than one employee in department we pass as the IN parameter. OUT parameter has to return all the records of the corresponding employee details in that department.
    Thanks in advance for your help
    Regards,
    K.Vijay

    -- I think you can try something like this using ref cursor:
    -- create a package for the type ref cursor and execute
    CREATE OR REPLACE PACKAGE PACK_REFCURSOR_FOR_TABLES AS
         TYPE DATA_TableRows IS REF CURSOR;
    END;
    -- after executing the package above, create your procedure:
    CREATE OR REPLACE PROCEDURE GET_EMP (
         IN_nDeptNo IN number,
         OUT_Emp OUT PACK_REFCURSOR_FOR_TABLES.DATA_TableRows)
    IS
    BEGIN
    -- leave query open (implicit) as this will return data
         OPEN OUT_Emp FOR
         SELECT *
         FROM tblEmp
         WHERE DeptNo = IN_nDeptNo;
    END;
    --execute the procedure and you're done                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I display more than one record with result set meta data?

    Hi,
    My code:
        ArrayList<String> resultList = new ArrayList<String>();
        rs=ps.executeQuery();      
        ResultSetMetaData rsmd = rs.getMetaData();      
        while(rs.next()){      
         for(int k=1;k<=rsmd.getColumnCount();k++){            
            resultList.add(rs.getString(k)); 
        ps.close();       
        }catch(Exception e){                                 
        e.printStackTrace();      
        return resultList;
        public String test(ArrayList result)throws Exception{ 
        String data=         
            "<tr>"+ 
            "<td class=normalFont>"+result.get(0)+"</td>"+ 
            "<td class=normalFont>"+result.get(1)+"</td>"+ 
            "</tr>"; 
        return data; 
        }  All the things are wroking but the problem is that ArrayList is displaying just one record whereas I have more than 20 records to display. I tried with loop like: i<result.size(); and result.get(i) then its throwing exception
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 I stuck here for the last more than 2 days. Please help me
    Best regards

    Raakh wrote:
    Still waiting .....I would have answered much earlier, but when I saw this little bit of impatience, I decided to delay answering for a while.
    ArrayList<String> list = new ArrayList<String>();
    list.add("abc");
    list.add("def");
    list.add("ghi");
    System.out.println(list.get(0));
    abc
    System.out.println(list.get(1));
    def
    System.out.printnln(list);
    [abc, def, ghi]That list has 3 items. Each one is a String.
    But here is what you appear to be doing:
    select * from person
    +-----+-------------+-------------+--------+
    | id  |  first name |  last name  | height |
    +-----+-------------+-------------+--------+
    |   1 | Joe         | Smith       | 180    |
    +-----+-------------+-------------+--------+
    |   2 | Mary        | Jones       | 144    |
    +-----+-------------+-------------+--------+
    for each row in ResultSet {
      for each column in ResultSet {
        list.add(that element);
    // which becomes
    list.add(1);
    list.add("Joe");
    list.add("Smith");
    list.add(180);
    list.add(2);
    list.add("Mary");
    list.add("Jones");
    list.add(144);
    System.out.println(list.get(0));
    1
    System.out.println(list.get(1));
    Joe
    System.out.printlN(list);
    [1, Joe, Smith, 180, 2, Mary, Jones, 144]That list has 8 items. Some of them are Strings and some of them are Integers. I would assume that, for this sample case, you would want a list with 2 items, both of which are Person objects. However, it really isn't clear from your posts what you are trying to do or what difficulty you're having, so I'm just guessing.

  • How to update more than one records at one time

    hello guys..
    how to update a few records (more than one) with different
    IDs at the same time? i tried to make a query like this (see
    below), but only one record (more than one data in the same
    field)has been updated.
    <cfquery name="rec" datasource="DatKoku">
    select *
    from tbl_pilih
    where id_pel = '#form.idpel#'
    </cfquery>
    <cfquery name="updtrecord" datasource="DatKoku">
    update tbl_pilih
    set
    kptsn = '#form.suk_pil#',
    trkh_kptsn =
    '#Dateformat(TodayDate,"dd/mm/yy")#|#TimeFormat(Now(),"hh:mm:ss
    tt")#'
    where id_pel = '#rec.id_pel#'
    </cfquery>
    <cfquery name="outputrecord" datasource="DatKoku">
    select *
    from tbl_pilih
    where id_pel = '#form.idpel#'
    </cfquery>

    Take the query,
    <cfquery name="rec" datasource="DatKoku">
    select *
    from tbl_pilih
    where id_pel = '#form.idpel#'
    </cfquery>
    If every row in the table has a distinct id_pel, then what
    you ask is actually an impossible question. It will have no answer.
    Distinct IDs imply that the resultset will contain
    at most one distinct value of id_pel. That means, there can
    be at most one row that satisfies the condition,
    where id_pel = '#rec.id_pel#' in the update query. That in
    turn means the update query can update at most one row at a time.
    If, however, the resultset of
    rec consists of multiple rows, it will mean that there are
    multiple rows in the table that have the same
    id_pel . Then, your update query,
    updtrecord, should update all the rows that share that value
    of id_pel.

  • How to display more than one data on the same page?

    Hello all,
    I have a question that is if I want to choose more one data on the same page and the data is selected from the same column.
    I.E I want to tick more than one boxes in the page but the data is selected from the same column.

    Select all the item to burn... right click...
    Or
    Place all items into a folder and burn the folder to the disc.
    Or
    Make a Burn Folder in the Finder (place items into the folder) and burn from there to a disc.

  • How to display more than one PDF-Document

    Can anyone tell me how i can show more that one pdf-form without having to use the container-window in the sdk-example. i would like to open and show a number of pdf-documents and react e.g. when a form closes.

    I don't have an answer, but it may help if you post more imformation
    about your problem. What API are you using (e.g. OLE, plug-in,
    JavaScript)? What language are you writing in? What is the name of the
    example you are looking at?
    Aandi Inston

  • How to Insert more than one record at a time- with fixed set of values in one field

    Can someone guide as to how to insert multiple records at a time using ASP VBScript in Dreamweaver CS4 or ADDT.
    If someone can guide then the exact problem is given below.
    I have a MS access database with one table. The table has three fields. The first field is an autonumber field for ID number.
    The second field contains string values- One out of 7 predefined values. One set of records consists of 7 records containing all the seven types of predefined values in fields no 1.
    The third field is a numeric field and can contain integers.
    I want that the user can enter data for the table using an ASP form in such a way that he enters one set of records at a time in one single screen. This way he will not have to remember that he has /has not entered all the seven set of values for the field no 1.
    I am not creating fields with the 7 types of field1value as their names as it will increase the number of fields drastically.
    Please help for dreamweaver ASP VBScript.

    I have successfully inserted seven records in one form submit operation by looping through the command object execute method.
    However, the data that is being inserted by the command object is repetition of the first record and the command object is not taking any data from the text boxes for the second record onwards. In this I had used the isert record behavious generated by DW CS4 and modified it to suit my requirement. However, the data inserted in the first row is getting repeated in all the seven rows.
    Please help.
    Also advise if there are any free dreamweaver server side validation extensions available.

  • How to Insert more than one record at a time

    How to insert multiple records at a time?
    If someone can advise on this, then the actual problem is described below:
    I have a MS access database with one table. The table has three fields. The
    first field is an autonumber field for ID number.
    The second field contains string values- One out of 7 predefined values. One
    set of records consists of 7 records containing all the seven types of
    predefined values in fields no 1.
    The third field is a numeric field and can contain integers.
    I want that the user can enter data for the table using an ASP form in such
    a way that he enters one set of records at a time in one single screen. This
    way he will not have to remember that he has /has not entered all the seven
    set of values for the field no 1.
    I am not creating fields with the 7 types of field1value as their names as
    it will increase the number of fields drastically.
    Please help with inserting multiple records at a time.

    I have successfully inserted seven records in one form submit operation by looping through the command object execute method.
    However, the data that is being inserted by the command object is repetition of the first record and the command object is not taking any data from the text boxes for the second record onwards. In this I had used the isert record behavious generated by DW CS4 and modified it to suit my requirement. However, the data inserted in the first row is getting repeated in all the seven rows.
    Please help.
    Also advise if there are any free dreamweaver server side validation extensions available.

  • How do  I display more than one region as a modal popup?

    Hello all!
    I have a popup that displays a report region. I now want it to display more than one region, say a report region and another report region underneath it.
    Here's the code that I currently have (and this one can popup one region):
    $.fx.speeds._default = 1000;
    $( function(){
      $('#ModalForm').dialog(
         modal: true,
         autoOpen: false,
         width: 650,
         height: 450,
         buttons:{ Calculate: function(){calculateTotal();},
                         Close: function(){closeForm();}        
    function openForm(pFoodTemplateId, pMealTypeId)
    var getone = new htmldb_Get('shiny',&APP_ID.,"APPLICATION_PROCESS=DUMMY", &APP_PAGE_ID.); // initialize get
    getone.add('P24_TEMPLATEID', pFoodTemplateId);
    getone.add('P24_MEALID', pMealTypeId);
    gReturn = getone.get();
    getone = null;
    $('#ModalForm').dialog('open');
    function closeForm()
    {$('#ModalForm').dialog('close');}
    $(document).ready(function()
        {$('a.temppop').click(function() {openForm();});
    });The class of the button (or in my case, the link in another region that's not displayed as a popup) is temppop.
    QUESTION:_
    How do I edit my existing code, so that it can now display another region?
    The ID of the region it displays now is ModalPopup. I would like to add another region, with another ID off course. Pick any ID, as long as you can explain to me how.

    Magali wrote:
    Hello all!
    I have a popup that displays a report region. I now want it to display more than one region, say a report region and another report region underneath it.
    Here's the code that I currently have (and this one can popup one region):
    $.fx.speeds._default = 1000;
    $( function(){
    $('#ModalForm').dialog(
    modal: true,
    autoOpen: false,
    width: 650,
    height: 450,
    buttons:{ Calculate: function(){calculateTotal();},
    Close: function(){closeForm();}        
    function openForm(pFoodTemplateId, pMealTypeId)
    var getone = new htmldb_Get('shiny',&APP_ID.,"APPLICATION_PROCESS=DUMMY", &APP_PAGE_ID.); // initialize get
    getone.add('P24_TEMPLATEID', pFoodTemplateId);
    getone.add('P24_MEALID', pMealTypeId);
    gReturn = getone.get();
    getone = null;
    $('#ModalForm').dialog('open');
    function closeForm()
    {$('#ModalForm').dialog('close');}
    $(document).ready(function()
    {$('a.temppop').click(function() {openForm();});
    });The class of the button (or in my case, the link in another region that's not displayed as a popup) is temppop.
    QUESTION:_
    How do I edit my existing code, so that it can now display another region?
    The ID of the region it displays now is ModalPopup. I would like to add another region, with another ID off course. Pick any ID, as long as you can explain to me how.First build your dialog for new ID (please replace NEWREGIONID with your region static id)
    $( function(){
    $('#NEWREGIONID').dialog(
    modal: true,
    autoOpen: false,
    width: 650,
    height: 450,
    buttons:{ Calculate: function(){calculateTotal();},
    Close: function(){closeForm();}
    And now you could open or close the dialog
    $('#NEWREGIONID').dialog('open');

  • How to apply data into 2 tables AND to more than one record in same table?

    Hello,
    I am trying to apply/insert data into 2 tables AND at the same time apply data to more than one record (in the same table). How would I do this in APEX?
    I have updated using one table with no problem, however, when I try updating with the two tables/ multiple record sets, I get errors.
    I appreciate the help.
    Thanks.
    Linda

    You can achieve what you want using PL/SQL. Can you post ur code?

  • How can i select more than one record in a LOV

    I want to select more than one record in a LOV and put them together before to display them in an item.

    This is not possible with a default LOV, so you'll need to create your own. There are a number of ways to select multiple records:
    a) you can use a tree and set Multi-Selection to Yes
    2) you can use a normal block with a checkbox on each row for the user to select records
    three) with the [SYSTEM.MOUSE_BUTTON_MODIFIERS|http://www.oracle.com/webapps/online-help/forms/10g/topics/designing_forms/mouse/at0604.html?tp=true] variable you can allow users to ctrl+click to select many records in a block. set the background colour to indicate a record has been selected
    iv) there is a pjc in the [demo code section|http://download.oracle.com/otndocs/demos/Forms_Demos_10gr2.zip] which lets you select many rows in a poplist

  • How to concat columns from more than one record?

    I have a function that takes an Oracle long and returns it as a varchar so that I can use it in the Microsoft world. My problem is that the SELECT returns more than one row (which is valid) and I need the Long fields to be concatenated into the one varchar returned. Currently I get an error saying more than one record is returned. This is my function:
    CREATE or replace function m4owner.Get_Request_Text
    (av_REQUEST_ID varchar2, av_REQUEST_LINE number, av_TEXT_LINE_CODE varchar2)
    RETURN varchar2
    IS
    long_var LONG;
    BEGIN
    SELECT TEXT INTO long_var
    FROM M4OWNER.REQUEST_TEXT
    WHERE REQUEST_ID = av_REQUEST_ID
    AND REQUEST_LINE = av_REQUEST_LINE
    AND TEXT_LINE_CODE = av_TEXT_LINE_CODE;
    return long_var;
    END;

      CREATE or replace function m4owner.Get_Request_Text (av_REQUEST_ID varchar2,
                                                           av_REQUEST_LINE number,
                                                           av_TEXT_LINE_CODE varchar2) RETURN varchar2 IS
        long_var LONG;
      BEGIN
        for t1 in  (SELECT TEXT FROM M4OWNER.REQUEST_TEXT
                     WHERE REQUEST_ID = av_REQUEST_ID
                       AND REQUEST_LINE = av_REQUEST_LINE
                       AND TEXT_LINE_CODE = av_TEXT_LINE_CODE) loop
          long_var := long_var || t1.text;
        end loop
        return long_var;
      END; note: untested

Maybe you are looking for

  • Read External List Field on Custom ECB action

    I tryed to show a Custom ECB action on an External List. The External List have a Field "LOGICAL_ID" with an IP address, but the GetAttributeFromItemTable works only with Standard List. How i read the External List Field and open some shell or browse

  • Java card confusing Issues!!!!!!! java card architecture, advantage!!!!!

    QUESTION -1 As I know about architecture of any application is -                 //normal java software                          java card                                  java card                   //  1                                             

  • Share videos along with photos over Bonjour?

    I'm sharing my photos over Bonjour, and it all seems to work fine. Only I noticed that the item count differs. It appears that iPhoto isn't sharing any of the short video clips taken with my camera that are in my library. Is it possible to have iPhot

  • Change Calendar Color?

    Recently, the "dot" by my "work calendar" on my iphone 3G changed colors. It now has the same color as one of the calendars I sync with MobileMe. The Work calendar is synced with Outlook 2010. Is it possible to change the color of the dot by my work

  • Redirecting A Form Back To HomePage After Submission

    Hello, I am trying to custom edit a form to redirect the user to my site's home page, instead of having them land back on the list, after submitting the form. How would I accomplish this? I know the URL that I need to redirect to, but I am unsure of