to insert multiple records in another table
Hi all;
How can I increase the number of records in the table?
SQL > insert into tab2 to select * From tab1;
Enter tab2 to select * From tab1
*
ERROR on line 1:
ORA-00926: lack of keyword VALUES
Hi try this...
Insert in tab2 select * from tab1
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 -
Update trigger that inserts the record in another table
I searched the forum and the web for an example like this and I can not find a:
A field is updated in the TABLE_A and it triggers a single record TABLE_B insert that has the old and the new value of the field.
I write a lot of complex data warehouse SQL-based reports, but very rarely do much PL/SQL, any help would be appreciated.
Thanks in advance.Hello
You can specify that the trigger should fire only when certain columns are referenced, like this:
create or replace trigger test_fund_trig before update OF FUNDING on table_a ...
If you do this, the trigger will not draw on statements such as:
UPDATE table_a SET mod_date = SYSDATE;
You should always use an IF statement, as I mentioned earlier, if you do not want to follow the updates where the value of this column has not really changed.
-
Insert the record of one table to another with the help of the cursor
Help, please!
the tables are - 1. countries (country_id pk, country_name, region_id)
2A (country_id, country_name, region_id)
table data are
1 to 1
2 b 2
3 C 3
NULL d 4
5 e 5
6 f 6
7 g 7
-----------------------
Insert the record in the table a country table with the help of the cursor, insert all the non-null records.
This procedure does not correct result
-----------------------
create or replace
Amit procedure as
cursor c1 is select * from a;
RW a % rowtype;
Start
Open c1;
Fetch c1 into rw.
While (C1% found)
loop
insert into countries values (rw.country_id, rw.country_name, rw.region_id);
commit;
Fetch c1 into rw.
If rw.country_id is null then
Fetch c1 into rw.
end if;
end loop;
Close c1;
exception
while others then
dbms_output.put_line ('exception = name ' |) RW.country_name);
end;You don't need cursor at all;
create or replace procedure amit as begin insert into countries (Country_ID, Country_Name, Region_ID) (select a.Country_ID ,a.Country_Name ,a.Region_ID from a ); dbms_output.put_line('Rows inserted : ' || sql%rowcount); commit; end; /
-
Calendar - insert multiple records by account number/length of
Hello
I would write a process allowing to insert multiple rows in a table. I think it should be a LOOP statement, but I don't know how in the APEX.
I got a simple form with the following page:
P2_Calendar_ID-> hidden field, populated by standard processes to Get PK to generate IDS again for the insert statement
P2_Name-> text field
P2_Date-> Date picker field
P2_Duration-> numeric field
The user name (P2_Name), choose a date (P2_Date) and type in a number (P2_Duration) and send the form. Here, I need the above mentioned process of pl/sql.
I think that first of all it must be created a loop to generate the Dates of the picked a (P2_Date) and increment the date by the number (P2_Duration), and store dates in the variable. Then there should be another loop to insert the number of records in a table, so it has inserted the same number of rows depending on the number in P2_Duration and with the dates increment according to the P2_Duration.
Name of the CALENDAR table after columns:
Calendar_ID-> number)
Name-> varchar2
Date-> Date
Example of what the user will fill in the form above:
P2_Name-> Vladimir
P2_Date-> may 9, 2014
P2_Duration-> 3
It must be created the following lines in a table CALENDAR:
Date name Calendar_ID
1 Vladimir may 9, 2014
2 Vladimir 10 may 2014
3 Vladimir may 11, 2014
Of course the Calendar_ID is generated by the standard Get PK process, which might need to be included in the loop... I think so.
Thank you for your help.
Best regards
Vladimir
PS: I use the APEX Version: Application Express 4.2.5.00.08
Hi Vladimir,.
Simply create a process on submit more info here: 8.5 Page understanding the process , with your touch as a trigger and add the code in this document, similar to the below I would say: and you can just get rid of the hidden element calendar_id
Thank you
DECLARE
DATE OF T_DATE;
BEGIN
FOR DATEINC IN 0.TO_NUMBER(:P2_DURATION) - 1 LOOP
T_DATE: = TO_DATE(:P2_DATE,'DD-MON-YYYY') + DATEINC;
INSERT INTO CALENDAR (CALENDAR_ID, NAME, DATE) VALUES (CAL_ID_SEQ.nextval,: P2_NAME, T_DATE);
END loop;
END;
-
Insert multiple records in a form with checkboxes
Hello
I need to insert multiple records in a database of a form using Coldfusion and am stuck - it works correctly when inserting one record at a time. Basically, the user will choose their name of the employee (EmployeeID) in a dynamic list, then several session (open) numbers that represent classes of training.
When I try and select several check boxes, I get this error:
"The number of query values and destination fields is not the same."
The boxes of the open field are not dynamic, as you can see-how use CFLOOP or any other method to allow several checkboxes be selected, and all open documents is entered into the database on a form?
I used server behaviors Dreamweaver 8 to create the form - which is limiting I know but I'm not a coder. I hope I can add code here to do things correctly function.
----APPLICATION CODE------------------------------------------------------------------
<!-get employee names->
< cfquery name = "rsDisplayEmployee" datasource = "FormationRH" >
SELECT *.
OF tblEmployees
ORDER BY LastName ASC < / cfquery >
<!-->-->
<! - insert Records - >
< cfset CurrentPage = GetFileFromPath (GetTemplatePath ()) >
< cfif IsDefined "(FORM. MM_InsertRecord") AND the FORM. MM_InsertRecord EQ 'form1' >
< cfquery datasource = "FormationRH" >
INSERT INTO tblEnrollments (open, EmployeeID)
VALUES)
< cfif IsDefined "(FORM. Open") AND #FORM. Open # NEQ "" > "".
#FORM. Open #.
< cfelse >
NULL VALUE
< / cfif >
,
< cfif IsDefined "(FORM. EmployeeID") AND #FORM. EmployeeID # NEQ "" > "".
#FORM. EmployeeID #.
< cfelse >
NULL VALUE
< / cfif >
) < / cfquery >
< cflocation url = "2.cfm" >
< / cfif >
<!-->-->
--------FORM CODE-----------------------------------------------------------------------
< form action = "" < cfoutput > #CurrentPage # < / cfoutput > "id = 'form' name ="form"method ="POST">"
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" >
< b >
< td width = "100%" > < h2 > < strong > select an employee name < facilities > < / h2 > < table >
< /tr >
< b >
< td > < select name = "EmployeeID" >
< cfoutput query = "rsDisplayEmployee" >
< option value = "#rsDisplayEmployee.EmployeeID #" > #rsDisplayEmployee.LastName #, #rsDisplayEmployee.FirstName # < / option >
< / cfoutput >
< / select > < table >
< /tr >
< /table >
< h2 > < strong > select training class < facilities > < / h2 >
< table width = "600" border = "0" cellspacing = "0" cellpadding = "0" >
< b >
< td width = "227" valign = "top" > class < table >
< td width = "373" valign = "top" > < input name = "Open" type = "checkbox" value = "937" / >
Date < table >
< /tr >
< b >
< td valign = "top" > class < table >
< td valign = "top" > < label >
< input name = "Open" type = "checkbox" value = "936" / >
< / label >
Date < table >
< /tr >
< /table >
< br / >
< input type = "submit" name = "Submit" value = 'Sign Up!' / >
< input type = "hidden" name = "MM_InsertRecord" value = "form" >
< / make >
"Add a line" I want to say that, for each of the checkboxes selected in your form, the code will be to insert a new record in the database table. Sorry I probably didn't phrase it very well.
so, no, the code does not need to wrap around each element. Instead the code examines the form.fieldnames variable (form.fieldnames, which is a list separated by commas of all fields defined in the form, is automatically submitted to each form submission - you don't have to define yourself somehow) and for each selected checkbox will insert a new record in your table with the check box selected and selected value the value of the id of the employee.
-
Insert multiple record Oracle forms 6i/9i / 10g
Hello
How can I insert multiple record using a tabular view as an oracle.
what I use for loop?
can someone help me? I have kindda stuck in this problem...
Scenario:
I have 5 display of last_name text_item and I put 4 names on it...
If I use Insert, it only get the 4th name I drove...
question:
How can I put them all together?I build the block manually.
Not a very good idea, I think, but if you really want to do it this way, you will need to loop through the records:
first_record; <
> loop insert into .... exit when :system.last_record = 'TRUE'; next_record; end loop record_loop; -
Insert multiple records in a database using the DB adapter and stored procedure
Hi all
I want to insert multiple records in a database using a stored procedure. I wanted to insert these records using a data adapter and data adapter must be called by a mediator.
Can anyone suggest me some ideas if it's possible with capabtilities OOB in SOA suite or not?
Thank you for your help in advance.
Thank you
ShivThe trick is in the stored procedure. You must use a data type that will handle multiple records I use varray. An example can be found in this post.
Re: Mutiple calls to AppsAdapter (pl/sql) when the payload has multiple records
When you read the procedure stored in the db adapter wizard looks and xsd / xml if you have maps accordingly.
see you soon
James -
How to find inserted last record in the table.
Version: Oracle 10g
I have a table called 'Manufacturing' and 3 columns as mfno, itemname, quantity.
How to find inserted last record in the table 'manufacturing '.
As I got to know that the Rowid is not a result perfect result. Please provide your inputs.user13416294 wrote:
Version: Oracle 10gThis is not a version. It's a product name. A version is 10.1.0.2 or 10.2.0.4, etc.
I have a table called 'Manufacturing' and 3 columns as mfno, itemname, quantity.
How to find inserted last record in the table 'manufacturing '.Not possible as your data model do not answer for him. As simple as that.
If there is a need to determine an order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or several attributes are necessary to represent this information. Your data model in this case is therefore unable to meet your requirements.
If the requirements are valid, set the data model. In other words - your question has nothing to do with Oracle and nothing to do with the other pseudo columns in Oracle, the rowscn or the rowid. It is a question of pure data modeling. Nothing more.
-
How to insert huge records in the table for the practice.
Hello
I created a new database in my personal inbox. Now, I want some specimen for different practical feature of oracle 10g. I need at least 1,00,000 records with different lines and columns.
any buddy tell me of any request or package that can create the table and insert unique records in this table.
Looking for valuable advice.
Thank youCan be dbms_random.string, dbms_random.value and dbms_random.random can help.
-
Insert multiple records in a query from a loop
Hello
Im am seriously struggling with something here...
PROBLEM:
I want to insert multiple records of checkbox in my db...
A simple insert statement inserts the 1 record...
How can I insert all records?
For example: 10 family names must be inserted at the same time...
Check my code...
PLEEEASE, im really craving for help!
Thank you. Worked perfectly!
-
Insert multiple records in the single form
Hi all
I met already insert many rows into a table using ADF BC. The solution is in the following thread
However,.
The above solution is useful when you want to enter new values as well as all the table entries is displayed.
What can I do if I don't want all values in the table, but just a page 'AddEntries' where I can only add new lines without going through the table entries is displayed.
As,
Say a form has 5 rows
Each line has empId, eMailSlNo, send attributes
EmpId is the same for all 5 recordings but emailId is different.
EmpId eMailSlNo plus the PK.
empId generated by the sequence.
Now, on presentation of the form, I want all five records to be inserted.
(can I use ADF form instead of the table of the ADF for the ViewObject in this case. I tried ADF form but I could only insert 1 plug at the same time).
I use 10.1.3.4
Help, please.
Thanks in advance,
Shri
Published by: newtoOTN on December 29, 2009 18:02Shri salvation,
ADF form is intended for the single insert/update. For multiple insert/update/delete using the collection as table UI is preferred. I guess your db table or table design INTERFACE default (in my opinion but I do not know your usecase entirely, so I guess might b wrong).
I would say,
-make EmpId as PK
-have another table to store EmpId (foreign key), emailSiNo, email
-Having the relationship of the master / detail between the British Colombia ADF db tables.
-Create master / detail UI and on the selection of the master, view the details and if no record is found does not add files and commit.See these examples:
http://www.Oracle.com/technology/products/jdev/tips/Mills/MasterDetailSync/Master_Detail_Synchronization_in_ADF_Faces.html
http://andrejusb.blogspot.com/2007/06/create-edit-and-delete-operations-in.htmlHope it makes sense.
~ K
-
ADF Mobile: Insert a record into a table by WS - DC method
It's something that is very basic and I could not know.
There is this method of 'create' base on the service project to insert a single record in a table.
I created a WS - DC on my mobile project. I see my createItem on the list method. But what I have this XItem.xsd.
So when I get the ValueExpression binding, I don't know how to set the attribute values...
ValueExpression ve = AdfmfJavaUtilities.getValueExpression ("#{bindings.xItemView1.inputValue}", Object.class);
PS: GenericType does not work.Your service must expose a method create and then you drag this method to your page and call it with an object as a parameter.
Should be similar to the way in which an update is done here:
https://blogs.Oracle.com/Shay/entry/adf_mobile_update_through_web -
Impossible to insert a record into a table
Hello
I was working on a procedure in which I had to insert 1,00,000 records each in 3 tables. But the process stopped after inserting 56000 records.
After that I ran the query again, but now it is not insert a single record.
I just created a fictitious table
create the table vinod1 (no number);
and I tried to insert a value by using
insert into vinod1 values (100);
But to my surprised the query has executed since the past 10 years and has not inserted a line.
I also tried on SQLPLUS and I use oracle 10g
Can you please help me and explain why I'm unable to insert the same if I am able to create the table.
Thank you
-Vinodare you using an option can be REPLICATED in your session, also what is the quota given to the user on the tablespace. The storage space that you used to create the table.
-
How to insert duplicate values in another table.
angle of attack!
I created two tables a and b
create table one
(key primary code number);
create table b
(code number,
DAT date);
insert into the table of a (code)
values (1234);
insert into the table of a (code)
values (1235);
commit;
Select * from a;
one
-----
1234
1235
-----
insert into the table of a (code)
values (1234);
commit;
ERROR on line 1:
ORA-00001: unique constraint (GMS. SYS_C0030897) violated
{color: #ff0000} * I need, when the user inserts duplicate data, must be inserted into another table b.* {color}
How can I do in forms 6i? Help, please. Thanks in advance.
Hello
What is the relationship with the forms?
Anyway, you can create a trigger on table A that intercepts the error in an exception block, and then create a new row in table B.
If the error comes from a forms based block, intercept the error in a trigger insert.François
Maybe you are looking for
-
Re: Satellite A300-19 t has suddenly stopped working (power led is off)
Hello I have a 19 t A300 Toshiba, model PSAJ4E that I have used for more than 1 year and a half. Yesterday, I just started, started to work for 5 min and all of a sudden it has stopped working and remained silent. I'm not through the shutdown process
-
HP 15 ac 042TU: malfunctioning suggest software
Dear Sir My Hp laptop display quality is very bad view that all bars of time show all by playing any video, although I downloaded the Hd from HP site graphics driver, my web cam is not working I installed you cam but the message all the time came you
-
Properties servicepk3 and bluetooth XP
Recently I got a mobile phone that dosnt Bluetooth usb dowload photos but uses. I'm trying to set up the computer to activate bluetooth frrom this new mobile. I use a dell optiplex 280 sff with xp servicepk3I ran searches and cannot find the bluetoot
-
Windows could not load the installer for the display
Whenever I try to open the NVIDIA settings, it gives me the error message "Windows has no load installer for display. I did what some post said and went to the Device Manager and tried to find the graphics card. To realize that I could not find them.
-
HP C7280 All IN ONE PRINTER: Cartridges HP 02 introduction
The C7280 printer was given to me still in the box, but the HP 02 cartridges were missing. So I bought new cartridges and installed. A message appears on the printer that the ' introductory cartridges provided with the printer must be installed. " Wh