How to display multiple records in a loop

Hello

This procedure returns some data.

so please tell me how I can write a loop to display all the records from a Table.

This is my procedure:

create or replace procedure getEmpName
*(*
Employee in V_EMPID. EMPID % TYPE,
V_EMPNAME employees. EMPNAME % TYPE
*)*
is
Start
Select empname into V_EMPNAME from employees where empid = '2';
end;


It's my block: how to write a loop here to display all of the records in my Table

declare
v_EMPNAME EMPLOYEE. EMPNAME % TYPE;
Start
getEmpName (2, v_EMPNAME);
dbms_output.put_line (v_EMPNAME);
end

user10503747 wrote:
so please tell me how I can write a loop to display all the records from a Table.

Hello
given the procedure displays all records in the table emp...

CREATE OR REPLACE PROCEDURE Testloop
AS
CURSOR test1
IS
SELECT EMPNO, ENAME FROM EMP;
BEGIN
I'm IN test1
LOOP
DBMS_OUTPUT. Put_line (' Emp - ' | i.empno |) » -'|| i.ename);
END LOOP;
END;
/

Thnx
MB

Tags: Database

Similar Questions

  • [ADF, JDev 12.1.3] How to display multiple records on the same page... not in a table but they appear a form for each record

    Hallo,

    I need to create a page that displays the records of a VO, but I would not use a table.

    Instead, I would like to display a form for each record to be displayed.

    Forms must appear one above the other and each form should have 2 buttons: one to remove the file/form itself and one to add a new file/form.

    When you press the button Add a new empty form should be dynamically added to the page (so that the user can fill) and created related record.

    When REMOVE button is pressed the form (which contains the operated button) should be disappear and the record shuould be deleted.

    Creations and destruction must be applied only if the user clicks a button on CONFIRMATION / COMMIT.

    Maybe this http://digilander.libero.it/flattit82/OTN_FILES/MultiFormPage.png picture can help to understand what I want to do.

    You kindly help me?

    Thank you

    Federico

    Hi Federico

    I was saying that your page layout can be achieved using af: table

    See this image:

    This provision is af:table (I think same as yours), just add a column in the table and put all the fields in this column then correct layout allows to design as a provision on the form or group layouts

    I'm not saying it's the best approach, but you can try this

    Thank you

  • How to view multiple records to a report form - as the model?

    Hi all
    I developed a form - like model report
    I want to show him several records at once (on the same page)
    I tried assigning a value of "Maximum records per page" property for the extensible framework 10
    but when I close the range property and open it again the value returns to 1!
    How to display multiple records on the same page?

    Thank you

    Hello

    check around your formatting images if all have the "vertical stretch" value to the variable or develop.

  • How to display specific records on the form of the ADF

    Dear experts,

    I need to create a form of adf Wizard.

    -If the user is new, this form will show action createInsert.

    -If the user is not new (already have saved data), then this screen displays data based on the user login id.

    I can do the application module class createInsert part but not the specific data display part.

    You have a suggestion how to display specific records based on user login id, and how to filter the old and the new user?

    Kind regards

    Ricky

    You can use a router in a workflow as I've shown here https://tompeez.wordpress.com/2012/12/01/jdeveloper-11-1-1-5-0-use-router-to-create-new-row-or-edit-existing/

    Timo

  • How to display multiple pages in Folio Builder LCA preview?

    I created a folio with an article that has two directions, but what displayed preview image shows only the first page. How to display multiple pages in Folio Builder LCA preview?

    You've probably noticed only the layout, not the article or folio.

    When you preview in InDesign using the file > preview Folio or when you click the button Preview in the Panel inlays Folio, you preview a version of raster of the provision itself. This preview contains no article property. If you use the Folio Builder Panel to get a preview of the article or the folio, you will have an overview of the double orientation.

    Moreover, most publishers prefer creating single-direction folios to reduce the dimensions of design efforts and folio.

  • How to display multiple images in a single window?

    How to display multiple images in a single window?  I want to compare images side by side, not in tabs.

    The editor preferences > General > turn on enable floating documents, then window > images > float all in windows.

  • How to display multiple images at the same time in CS6?

    How to display multiple images at the same time in CS6?

    Hello

    If you go to window > reorganize you can choose from several display options. Below, I have chosen two horizontal spaces since I have two images, but you can select other options if you have more than one image.

  • How to display the records from a query in the non-base data field

    Hello

    I have a problem:
    I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
    I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
    Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
    Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.

    How I did it:
    I create a cursor with the query, and then
    start the open cursor
    loop
    Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
    end loop;
    close the cursor;
    end;

    It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.

    Can someone help me with this problem?
    Thank you.

    Published by: 928437 on October 1, 2012 02:55

    Creating a view and the query in a database block are a great solution.

    To use the block non-base of data:
    You are missing the most important Next_Record; command.

     Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;

  • How to concatenate multiple records in a single

    Hello world:

    I want to know if is a way to concat multiple records into one without the help of the sliders. For example, I have a table named "Authors" like this:

    LAN | Author
    -----------------
    English | Ernest Hemingway
    Spanish | Octavio Paz
    Spanish | Mario Vargas Llosa
    English | Sinclair Lewis
    Spanish | Gabriel García Márquez


    And I want to get this:

    Author
    -----------------
    Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez

    I have worked with SQL Server and I can do something like this:

    CREATE FUNCTION dbo. MyConcat (@lan varchar (10))
    RETURNS varchar (5000) AS
    BEGIN
    declare @retvalue varchar (5000)
    Set @retvalue = "
    Select @retvalue = @retvalue + author + ',' authors where lan = @lan
    return substring (@retvalue, 1, len (@retvalue)-1)
    END

    That is to say, do not use cursors to concatenate records. However, with ORACLE, I do something like that.

    FUNCTION MyConcat(P_Lan IN VARCHAR2) VARCHAR2 IS BACK
    v_ret VARCHAR2 (4000);
    v_element VARCHAR2 (4000);
    v_cursor sys_refcursor;
    BEGIN
    OPEN to SELECT V_cursor author of authors where Lan = P_Lan
    LOOP
    SEEK v_cursor INTO v_elemento;
    OUTPUT WHEN v_cursor % NOTFOUND;
    IF v_ret IS NULL THEN
    v_ret: = v_element;
    ON THE OTHER
    v_ret: = v_ret | ', ' || v_element;
    END IF;
    END LOOP;
    RETURN v_ret;
    END;

    There is another way to to do?

    Best regards
    Jack

    You can find plenty of examples here:

    http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php

    and also here:

    http://www.sqlsnippets.com/en/topic-11787.html

    Published by: hoek on October 21, 2010 17:50

  • How to display only records double-obiee

    Hello
    I want to show only the duplicate records in the report of 10g of obiee. How we do that.

    Please reply if anyone knows...

    Thank you

    806756 wrote:
    Hello
    I want to show only the duplicate records in the report of 10g of obiee. How we do that.

    Please reply if anyone knows...

    Thank you

    Two ways you can do it, one being demand Direct from database and the second using the RPD. Visit this link for the second approach (http://carpediemconsulting.wordpress.com/2008/08/13/displaying-duplicate-values-in-obiee-reports/)

  • How to: display a message while for loops, with no required user input

    Hi everyone, I'm relatively new to LabView, using 8.5.

    I want to display a message all in one for the loop runs, requiring no user input to delete the dialog box (that is to say, the box disappears after the end of the loop For).

    Any ideas?

    Thank you

    Darren


  • How to enter multiple records

    Hi all

    I use oracle 10g and 10g db forms.

    I developed a form and the user will enter data into the form and click that box and press save data button get inserted into the table.

    If the user enters data two times and then click on the checkbox and enter the backup of the data that one button get inserted.

    Inside this XXBANK_GUARANTEE_HEADERS procedure. XXBANK_GUARANTEE_INSERT I wrote my insert statement.

    I have my code is like this

    BEGIN
    Premier_enregistrement;
    LOOP
    IF (: System.Last_Record = 'TRUE') THEN
    EXIT;
    ELSIF: BANK_GUARANTEE_BLK. CHECK_IN_OUT = 'Y '.
    THEN
    XXBANK_GUARANTEE_HEADERS. XXBANK_GUARANTEE_INSERT;
    Next_Record;
    END IF;
    END LOOP;
    END;


    Can someone pls correct me where I went worng.

    concerning
    srikkanth

    Hi try

    BEGIN
    First_Record;
    LOOP
    IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
    THEN
    XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;
    END IF;
    Exit when :System.Last_Record = 'TRUE'
    Next_Record;
    END LOOP;
    END;
    

    It is because once it reaches the last record, you have coded out, even before processing the file.
    Now, I put this condition of release at the last

  • How to display database records in the text element

    Hello friends,
    I use forms6i...
    I called "username" in the layout of text editor. I created this point in the text of the data block Wizard... I put the number of items displayed = 3 in this wizard...
    In the 'user name' property palette I have following changes
    Number of displayed items = 3;

    When I click on the button named "list_user" must watch all the user names in the text element...
    My shutter button pressed when code is:


    declare
    cursor c1 is
    Select Logid log1 where logout_date is null;
    Start
    Open c1;
    Fetch c1 into: name of user;
    end;

    But my problem is when I run the user a single form displayed in the text element... The text elements two remaining are have no data...

    The result of the cursor query is:



    SQL > ed
    A written file afiedt.buf

    1 Select logid log1 where logout_date is null
    SQL > /.

    LOGID
    --------------------
    104
    105
    106


    Please help me

    Published by: Bauer on February 23, 2011 01:45

    1.
    There is no loop in your code, so it stops after the first extraction.

    2.
    with each loop you overwrite the same text field. Add CREATE_RECORD:

    DECLARE
        CURSOR c1 IS
            SELECT logid
            FROM   log1
            WHERE  logout_date IS NULL;
    BEGIN
        OPEN c1;
        LOOP
            IF :username IS NOT NULL THEN
               CREATE_RECORD;
            END IF;
           FETCH c1
           INTO  :username;
           EXIT WHEN c1%NOTFOUND;
        END LOOP;
    END;
    
  • How to access multiple buttons in a loop?

    Hello

    I have 29 buttons, named img1, img2... .till img29... I need to access it in a loop. I had asked this question earlier, but at that time buttons must be accessible via their holding company movieclip, but this time the code is in the clip, so I need direct access to the key.

    If the original code I was using to access was

    _root.folioholdermc ["img" + i] //thanks to Ned Murphy ._alpha

    now I need to access it as

    This.img2._alpha //due to change the path

    I tried to use

    This.img [i] ._alpha, but it does not work.

    I want to put this in a loop where I spend from 1 to 29. How can I do this? Any help will be greatly appreciated... I'm sure that the answer is really simple, but I'm new to AS and don't know wat will work.

    Use:

    This ['img' + i] ._alpha

  • Display multiple records of repeat region


    I have two sets of data:

    Recordset1, as well as other information, contains the index corresponding recordset2

    I have set up a repeating region and need a field of recordset2 to display data record1. I really tried everything, but it seems no way to control what cs3 order puts the php for mysql read code. I can easily put on a list menu and cs3 doing the code for select recordset2 correctly but it is a display and I don't know there is something simple, I'm missing and appreciate in advance your time and advice.



    I am running php 5 and mysql 5 on my vista IIS machine.

    azunoman wrote:
    > I have two sets of data:
    >
    > recordset1, as well as other information, contains the index of
    > corresponding recordset2
    >
    > I have set up a repeating region and need a recordset2 field to display
    > given record1. I really tried everything, but it does not seem possible
    > control what cs3 order puts the php for mysql read code. I can easily put
    > in a menu list and cs3 will do the code to select recordset2 correctly, but it is
    > a screen and I'm sure there's something simple I'm missing and enjoy
    > to advance your time and advice.
    >
    >
    >
    > I'm using php 5 and mysql 5 on my vista IIS machine.

    You need a set of records, and that we will use what is called a JOIN.
    You implement the join in your SQL statement. Do a google on mysql join
    and see if it makes no sense. Otherwise, post your 2 existing SQL
    statements and we will see if we can do for you.

    Steve

Maybe you are looking for

  • HP Designjet T770 PS hard drive - no driver for win7 64 bit

    I am desperately looking for the drivers for this printer. Whenever I go to the url of the driver and click the driver that I only find broken links. I tried office and hospitality to make sure this isn't bloked by my company COMPUTER Department, but

  • Portege M750 starts no-power light flashes

    I have an orange flash on my power light error code (1 long flash 3 short 1 long 2 short 1 long 1 short)... I have to take the power connector on battery and start battery to operate... I use image windows 7 Toshiba with all Microsoft updates (now I

  • Satellite A30: how to replace the HARD drive?

    Hi guys can someone tell me how to get into my hard drive on my Toshiba Satellite A30, I need to renew... as one who is in all at the time does not work... even in the plans or photos of how it is all set up help of mites... Thank you weman4u

  • MOTOBLUR stopped syncing with hotmail

    Hello I have a question where my hotmail email worked fine for months no problem then stopped on 8 August. It wasn't long after that I got the new UK update for my phone 4.4.20 I have not received e-mails. I have not changed any setting my battaries

  • Great email is stuck in the output area. In any case to determine if it will send or should it be deleted?

    Send emails with large attachments When trying to send emails with large attachments, sometimes the email seems to be simply stuck in the "Outbox" and the system continuously tries to send the email without success. Is there a way to determine if e-m