How to insert multiple rows in a table by the user (pl/sql)

Hello
I was trying to insert several rows in a table by a user by some pl/sql, but not every time entry. :/
What is happening is that the program requires each time ask the user for the new value but the loop
1 values inserts actually four times (the loop is run four times). can any point on what I am
doing wrong or solutions will be fun ;)

what I wrote here

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

Set serveroutput on
set verify off

declare

EmpNo number;
EmpName varchar2 (20);

Start

because loop me in 1.4
EmpNo: = & empno;
EmpName: = '& empname';

insert into values(empno,empname) of the employee;

end loop;

end;

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

do not laugh at my code, I'm new to this oracle :D

Thank you, prospects for the future for a response

user13371438 wrote:
Thanks for the info, looks like a nice tool will ;) try
but I really want (my problem) in pl/sql

Take a quick re-read my post above.

PL/SQL is a process running on the database server. This process cannot interact with the client computer. He can't ask for user input, and it cannot display the output to the client. Client interface tools can only do. You are eager to get feedback from a user, if you need an interface tool to do. SQL * Plus can interface and application of entry, but only as variable substition, and it does not really provide a programming construct that allows you to run a program in a loop to do. Do this using SQL * Plus you must pair it with shell/dos scripting languages, but more ideally you should use an interface appropriate as Apex.

I was wondering if it all works in pl/sql to release cached data (as fflush (stdin) in c ++)

PL/SQL does not a customer entry, so there is no sense to have something to release the cached data. You pass the values of PL/SQL code using procedures or functions with parameters.

Tags: Database

Similar Questions

  • inserting multiple rows of another table with incremented recordid

    Hi all

    I HAVE TWO TABLES:

    CREATE TABLE TEMP_TEST1)
    NUMBER OF RECID,
    TESTCHAR VARCHAR2 (500)
    )

    AND

    CREATE TABLE TEMP_TEST2)
    TESTCHAR VARCHAR2 (500)
    )

    Both the table contains data in it. I want to insert data from TEMP_TEST2 in TEMP_TEST1 with RECID incremented for each record, which must be greater than max (RECID) of TEMP_TEST1.
    PS: I have to query insert only, I cannot make changes in the structure of table or RECID of TEMP_TEST1 is not automatically incremented.
    Please suggest a query that selects the record of TEMP_TEST2 and TEMP_TEST1 insert with recid incremented for each record.


    Thank you.
    SQL> insert into TEMP_TEST2(TESTCHAR)
      2  select 'Test'||level from dual connect by level < 10
      3  /
    
    9 rows created.
    
    SQL>
    SQL>
    SQL> insert into TEMP_TEST1(RECID,TESTCHAR)
      2  select (select nvl(max(RECID),0) from TEMP_TEST1) + rownum, t2.TESTCHAR
      3  from TEMP_TEST2 t2
      4  /
    
    9 rows created.
    
    SQL>
    SQL> select * from TEMP_TEST1
      2  /
    
         RECID TESTCHAR
    ---------- ----------
             1 Test1
             2 Test2
             3 Test3
             4 Test4
             5 Test5
             6 Test6
             7 Test7
             8 Test8
             9 Test9
    
    9 rows selected.
    
    SQL> insert into TEMP_TEST1(RECID,TESTCHAR)
      2  select (select nvl(max(RECID),0) from TEMP_TEST1) + rownum, t2.TESTCHAR
      3  from TEMP_TEST2 t2
      4  /
    
    9 rows created.
    
    SQL>
    SQL> select * from TEMP_TEST1
      2  /
    
         RECID TESTCHAR
    ---------- ----------
             1 Test1
             2 Test2
             3 Test3
             4 Test4
             5 Test5
             6 Test6
             7 Test7
             8 Test8
             9 Test9
            10 Test1
            11 Test2
    
         RECID TESTCHAR
    ---------- ----------
            12 Test3
            13 Test4
            14 Test5
            15 Test6
            16 Test7
            17 Test8
            18 Test9
    
    18 rows selected.
    
    SQL>
    

    Good bye
    DPT

  • Could not use DB function call to insert a row into a table OBIEE

    Hello

    At the prompt of the OBIEE report, I create a DB function in a variable column of the guest, so whenever I'm in the dropdown variable ob column call the function DB call.

    The function call is insert a row into a table in the database. However, it seems impossible to insert the row into the table.

    I have test the function in the sqlplus and it works, if the function has no problem. The problem is OBIEE failed to insert something in the datebase, it can only read from it.

    Any ideas on how I could fix it?

    Thank you!

    Hello
    Use your Evaluate function and the variable correctly. In the case where u called this function evaluate in the report in a column, and he has 100 files it contains, it will call db 100 times.

    Kind regards
    Anitha.B

  • How to insert multiple lines using a single query

    Hi all

    How to insert multiple lines using a single query to the emp table?
    I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.


    Thank you
    Sunil

    Like this?

    SQL> create table test(id number , dt date);
    
    Table created.
    
    SQL> insert into test values(&a,&b);
    Enter value for a: 1   --- It asked me and I entered 1
    Enter value for b: sysdate  --- It asked me and I entered sysdate
    old   1: insert into test values(&a,&b)
    new   1: insert into test values(1,sysdate)
    
    1 row created.
    
    SQL> 
    

    g.

  • How to insert multiple images into a file

    How to insert multiple images into a file

    Hi Mary,

    See this tutorial on adding images in Photoshop Mix and the grantor together: http://tv.adobe.com/watch/learn-photoshop-cc/combine-two-photos/

    Hope that helps,

    Concerning

  • Insert multiple rows in a database

    Hello
    I worked on a project that takes a JMS queue xml document and inserts the data into db. But the problem here is that there may be any number of data sets. I use EPCO for my work, but no matter what I do, the data is not simply inserted. Could you any body please help me? Here is an example of the message that I'm trying to insert as the XSD for the JCA and entry documents.

    XSD for JMS Message:

    <? XML version = "1.0" encoding = "windows-1252"? >
    < xsd: Schema container = "http://www.w3.org/2001/XMLSchema".
    xmlns = "http://www.example.org".
    targetNamespace = "http://www.example.org".
    elementFormDefault = "qualified" >
    < xsd: element name = "canonical" >
    < xsd: complexType >
    < xsd: SEQUENCE >
    < xsd: element name = "order" >
    < xsd: complexType >
    < xsd: SEQUENCE >
    < xsd: element name = "data" maxOccurs = "unbounded" >
    < xsd: complexType >
    < xsd: SEQUENCE >
    < xsd: element name = "rowCode" type = "xsd: String" / >
    < xsd: element name = "productNumber" type = "xsd: String" / >
    < xsd: element name = "attributeType" type = "xsd: String" / >
    < xsd: element name = "attributeCode" type = "xsd: String" / >
    < xsd: element name = "transactionType" type = "xsd: String" / >
    < xsd: element name = "timestamp" type = "xsd: DateTime" / >
    < / xsd: SEQUENCE >
    < / xsd: complexType >
    < / xsd: element >
    < / xsd: SEQUENCE >
    < / xsd: complexType >
    < / xsd: element >
    < / xsd: Schema >


    JCA XSD:

    <? XML version = "1.0" encoding = "UTF - 8"? >
    < xs: Schema targetNamespace = "http://xmlns.oracle.com/pcbpel/adapter/db/top/InsertData" xmlns = "http://xmlns.oracle.com/pcbpel/adapter/db/top/InsertData" elementFormDefault = "qualified" attributeFormDefault = "qualified" xmlns: XS = "http://www.w3.org/2001/XMLSchema" >
    < xs: element name = "OrderDataCollection" type = "OrderDataCollection" / >
    < name XS: complexType = "OrderDataCollection" >
    < xs: SEQUENCE >
    < xs: element name = "OrderData" type = "OrderData" minOccurs = "0" maxOccurs = "unbounded" / >
    < / xs: SEQUENCE >
    < / xs: complexType >
    < name XS: complexType 'OrderData' = >
    < xs: SEQUENCE >
    < xs: element name = "prodnum" type = "xs: Decimal" / >
    < xs: element name = 'attrtype"minOccurs ="0"nillable ="true">
    < xs:simpleType >
    < xs:restriction base = "XS: String" >
    < xs:maxLength value = "20" / >
    < / xs:restriction >
    < / xs:simpleType >
    < / xs: element >
    < xs: element name = "attrcode" minOccurs = "0" nillable = "true" >
    < xs:simpleType >
    < xs:restriction base = "XS: String" >
    < xs:maxLength value = "10" / >
    < / xs:restriction >
    < / xs:simpleType >
    < / xs: element >
    < xs: element name = "transtype" minOccurs = "0" nillable = "true" >
    < xs:simpleType >
    < xs:restriction base = "XS: String" >
    < xs:maxLength value = "1" / >
    < / xs:restriction >
    < / xs:simpleType >
    < / xs: element >
    < xs: element name = "ordertime" type = "xs: DateTime" minOccurs = "0" nillable = "true" / >
    < / xs: SEQUENCE >
    < / xs: complexType >
    < / xs: Schema >

    Input samples:

    <? XML version = "1.0" encoding = "windows-1252"? >
    < ProductData >
    < header >
    < rowCode >: < / rowCode >
    < interfaceCode > H6D9J7 < / interfaceCode >
    < createdOn >
    < date >
    < year > 2011 < / year >
    < month > 05 < / month >
    < day > 23 < / day >
    < / date >
    < time >
    < time > 02 < / time >
    < minute > 05 < / minute >
    < seconds > 11 < / seconds >
    < / time >
    < / createdOn >
    < description > Front Shop of the attributes of FMS to JDA PMM < / description >
    < / header >
    < body >
    < data >
    < rowCode > D < / rowCode >
    < other > 0004567 < / productNumber >
    < attributeType > MIMI < / attributeType >
    < attributeCode > CCCCCCCjjj < / attributeCode >
    < transactionType > A < / transactionType >
    < timestamp >
    < date >
    < year > 2011 < / year >
    < month > 02 < / month >
    < day > 19 < / day >
    < / date >
    < time >
    < time > 02 < / time >
    < minute > 05 < / minute >
    < seconds > 11 < / seconds >
    < / time >
    < / timestamp >
    < / data >
    < data >
    < rowCode > D < / rowCode >
    < other > 0004567 < / productNumber >
    < attributeType > TTTTTT2 < / attributeType >
    < attributeCode > CCCCCCjjj2 < / attributeCode >
    < transactionType > A < / transactionType >
    < timestamp >
    < date >
    < year > 2011 < / year >
    < month > 02 < / month >
    < day > 19 < / day >
    < / date >
    < time >
    < time > 02 < / time >
    < minute > 05 < / minute >
    < seconds > 11 < / seconds >
    < / time >
    < / timestamp >
    < / data >
    < / body >
    <>footer
    < rowCode > Z < / rowCode >
    < interfaceCode > H6D9J7 < / interfaceCode >
    < numberOfRows > 000000000002 < / numberOfRows >
    < / footer >
    < / ProductData >

    I will be really grateful if someone can help me. Thank you.

    Check below link it may help you

    How to insert multiple records using the single DB adapter

    Thank you
    AJ

  • How to insert a block of digital signatures for the form fillable

    Just upgraded to Adobe Acrobat DC. How to insert a block of digital signatures for the form to fill out?

    Tools > prepare the form

    Insert a signature field

  • Deletion of rows in a table while the filter condition is in another table

    Hi all

    I am facing a problem of deletion of a row in a table where the condition is in the other table. To ealaborate the scenario further Let's say I have two tables T1 (the transactions table) and T2 (Master Table). I want to delete a record in the table T1 by checking conditions lies in table T2.
    I tried with the query below, but this request deletion of records in the table two.

    DELETE FROM (SELECT * high INNER JOIN T2 on T1 page TP)
    THE top. TID = TP. TID
    WHERE at the top. DEAL_SITE_ID = inputparameter1
    AND (TP. SEGMENT <>inputparameter2 OR tp.segment is not null));

    Here the record is deleted in the two tables, but I don't want to delete the data in my table master i.e table T2.

    Any help would be much appreciated. Thanks in advance.

    Kind regards
    Delphine
    SQL> select *
      2   from the_table;
    
    X          Y
    ---------- ----------
    AA         a
    BB         a
    CC         a
    AA         b
    DD         b
    
    SQL> select *
      2   from the_table_2;
    
    X          Y
    ---------- ----------
    AA         a
    BB         a
    CC         a
    
    SQL>  delete from
      2  (
      3  select *
      4  from the_table  t1 inner join the_table_2 t2
      5  on  t1.x = t2.x
      6  and t1.y = t2.y);
    
    3 rows deleted.
    
    SQL> select *
      2   from the_table;
    
    X          Y
    ---------- ----------
    AA         b
    DD         b
    
    SQL> select *
      2   from the_table_2;
    
    X          Y
    ---------- ----------
    AA         a
    BB         a
    CC         a
    
  • Expdp unable the aud$ table as the user sys

    Hello
    Oracle 11 g 2
    OS: Solaris

    Expdp unable the aud$ table as the user sys

    Audit tables is size: 5 GB to check tablespace

    Error details:

    Current estimation using BLOCKS method...
    Total estimation using BLOCKS method: 0 KB
    ORA-39166: Object SYS. AUD$ has not been found.
    ORA-31655: no data or metadata of objects selected for employment

    Export is suspended for 4 hours and shows 0kb of dumpfile to the os levl.

    kindly, one please help on this issue.

    Thank you
    visu.

    try to export the table SYS. AUD$ using the traditional export...

    $exp system / file yourdmpfile.dmp log = yourlogfile.log = tables = sys.aud$

    Please see below notes for more information.
    DBMS_AUDIT_MGMT to manage and purge Audit information [ID 731908.1]

  • GRANT SELECT on a table to the user / role changes for the tab last_DDL

    Hello

    Is grant select (or any private object) to the user/role a DDL statement?

    GRANT SELECT on a table to the user / role changes the last_DDL to the table.
    1 > is this expected behavior?
    2 > no way in which we can grant select on a table by another user, without changing the DDL? (for example create view).


    The test is performed:

    Prior to the issuance:


    OBJECT_NAME CREATED TIMESTAMP LAST_DDL_TIME OWNER
    ------- ---------------------- ---------- ------------- --------------------
    AR HZ_CUSTOMER_PROFILES 8 MAY 00 13 MARCH 13 2003-06 - 26:12:41:29



    Grant statement:
    GRANT SELECT ON "AR". "' HZ_CUSTOMER_PROFILES ' TO 'AR_VIEW ';

    Note: AR_VIEW is a role, I tried granting also directly to the user.


    After the grant:

    OBJECT_NAME CREATED TIMESTAMP LAST_DDL_TIME OWNER
    ------- ---------------------- ---------- ------------- --------------------
    AR HZ_CUSTOMER_PROFILES 8 MAY 00 21 MARCH 13 2003-06 - 26:12:41:29



    Old thread, discuss whether Grant is DDL or not, but no documented conclusions.
    ( Re: Grant, revoke is DDL and DCL? )

    Please help in the assessment above.

    -Best regards,.
    Mani

    It's the DOF.

    After all, this isn't DML, it implicitly committed and you cannot use it directly in PL/SQL: features of DDL. :-)

  • How can I force a send this page if the user presses a tab?

    This may be obvious buy I start everything just with the APEX then maybe someone can tell me...
    How can I force a send this page if the user presses a tab and they go to another page before I run the backup of page variables?
    Thank you!!!
    C

    Hello

    If you use version 4.x Apex while you can create a dynamic action for this.

    * If this answer is useful or appropriate then please mark and award points.

  • How to insert multiple lines to the DB table

    I create processes in BPM Studio 10 g.

    I write below the code snippet to insert data in the database.
    However, it does not work.

    In the flow of the screen, the user can key in several rows of data. I try to add the to_char (element.purpose), but the Studio does not allow me to do.

    I think the code is wrong, but I don't know how to change it.

    ----------------code in PBL------------------------------------------------------------------------------
    for each item in BPMObject.group1
    do

    Insert in DBM. SOADEMO. SZ_TABLE (id, amount, purpose, result)
    values (element.id, element.amount, element.purpose, element.result)

    end

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

    ID, amount: decimal
    Purpose, result: String

    DBM: Module
    A group is under a BPMObject but not inherit a table.

    Hello

    It seems that you do not use a variable in the statement "for each.

    Right now you have:

    for each item in BPMObject.group1...

    You can add a new instance variable called 'bpmObject' which is of the type "BPMObject". You must use this variable in the job call the interactive component fills the table of the group. Then, you would change your logic to reflect this change by making it to read:

    for each item in bpmObject.group1...

    Hope this helps,
    Dan

  • How to insert a row into the table from an entity class

    I use JDeveloper 11.1.2.3.0 using ADF.  I would like to insert a row in Table B, when A table is inserted into the database based on a value selected by the end user.  I could do in a database trigger, but I would try in the ADF. I think that the best place to do it would be in the entity based on the table A class. I could override the doDML method and search for DML_INSERT

    and make the table insert B here, but I don't know the best way to achieve this.  I guess I want to avoid using a SQL "insert". I'm new to ADF and it can be difficult to get

    a question using the appropriate terminology. I hope this makes sense.

    Hello

    Check out this blog: http://andrejusb.blogspot.com/2008/02/complex-insert-in-easy-way.html

    Arun-

  • How to get multiple rows in the table is displayed on the form

    I am looking for a way to get more table rows that appear on the form.  I created a table with a header and a line with the add-in and remove button option.  I like how the sample purchase order form has it setup in the designer it shows one line and it appears on the form so the table has three rows to start with.  How do I do that?  I looked at the code on the sample and I couldn't find it anywhere.  Please help, thanks.

    Hello

    I have an example here in the construction of a dynamic array markets.

    http://www.assuredynamics.com/index.php/category/portfolio/building-dynamic-tables/

    You must select the line and then go to object > Binding palette and set it to repeat. You can set the minimum and initial number to what you want.

    The form should be saved in a dynamic form of XML in the Save as dialog box.

    Also the page must be set to Flowed, so that as the table grows, push another object down. In addition, you need to configure the paging settings so that the flow of the page as the number of lines is superior to a single page.

    Give a start and if you need more help,

    Niall

    Ensure the dynamics

  • Inserting multiple rows - need help

    Hi all

    I need to insert several rows in the table with a single query, and the number of lines is 269470.
    Here one of the columns is determined by another sub query that returns multilple lines and the other 2 columns remain same for all.

    I came up with the following query, but need a loop to turn several times (269470 times).

    insert into EMLUSRRECV
    (user_id, storeent_id, receiveml)
    values
    (+ (select user_id from users including the user_id not in (select distinct user_id of EMLUSRRECV) and CURR = 'USD' and rownum = 1) +, 11154, 1);

    Thanks in advance.

    And how did you think of sql developer can help you with that?

    Why don't mark you this question ANSWER and post in the forum SQL and PL/SQL.
    SQL and PL/SQL

Maybe you are looking for

  • How to import playlists in itunes from my old computer or an iPod nano?

    Recently bought a new PC.  Managed to transfer my music library to the new PC from the old PC.  However... the playlists are not present in iTunes on the new PC.  They are still present on my iPod Nano and iTunes on the old PC.  Any help is greatly a

  • connection of the controller

    Hello I bought a stepper motor (http://www.newmarksystems.com/linear-positioners/nls4-series/) and a controller (http://www.newmarksystems.com/motion-controllers/nsc-a1/). How can I connect my controller to the labview? I used the driver instrumentat

  • For rtl 8029as driver

    Where can I find the driver for realtek 8029as?

  • The upgrade of Movi thru TMS

    Have a TMS 13.1 operation and VCS 5.1.1 Downloaded the current model of implementation of the Movi 4.2 in TMS Followed their instructions on the configuration of the URL and Version of Windows software software windows Problem is Movi users do not re

  • David Westwood

    I just bought a new computer with Windows 8 is installed. I find that I can't connect to any Web site with which I was already registered with my passwords, such as my library and energy suppliers. I can still do it from my laptop with Windows 7. I'm