How to insert data from a table to database
Hi all,
My problem statement is that:
I have jsp page, which has a table with some columns editable for inserting data. I am using MySql database.
Now when I insert the data in the table and click submit button , the data entered must get stored in the database.
If its a single data I can do it , but how to do for mulitple rows or columns.
Please suggest me a solution
Regards,
Suraj
i did one program similar to this requirement. when the rows and columns are fixed then what is the problem.
use java script and capture all the values into an array and pass this to servlet and there call a method which will set
the bean objects. or else no need to pick the array directly pass all the parameters and set the beans by retrieving these
parameters(request.getParameter()).
Diablo
Similar Messages
-
HOW TO MOVE DATA FROM INT-TABLE TO DATABASE STRUCTURE?
DEAR ALL!
CAN ANY ONE GIVE ME SAMPLE CODE TO MOVE DATA FROM INT -TABLE TO DB-STRUCTURE PLEASE.
I HAVE THE VALUES IN TABLE AND I NEED TO UPDATE STRUCTURE.
REGARDS,
VJHi,
If you want to update a db STRUCTURE it is not possible because Structure doesnot hold any data.
If you are trying to update a db table then the update command should do the work.
Eg : UPDATE VBPA3 FROM TABLE DA_XVBPA3U.
Note : The Internal table should be of same structure and should not have duplicate entries.
Regards,
Srini. -
How to insert data from a table into itself if they don't already exist meeting a certain condition
First, let me apologize as I did not write/design this mess, just inherited this terrible design and legacy application!
I have table of companies and a table of suppliers with various attributes and of them being a bit column of is_public. The public suppliers then need to be inserted into the table as suppliers for the other suppliers.
As an example, in the company table company 'PUB01' is flagged as a public supplier (Company.IS_PUBLIC_SUPPLIER = 1). Therefore in the Suppliers table I need to insert a row for each each of PUB01's suppliers in that same table to all the other suppliers
in that table if they do not already exist as follows:
Here is a sample of the table structure:
CREATE TABLE [dbo].[COMPANY](
[COMPANY_ID] [nvarchar](15) NOT NULL,
[COMPANY_NAME] [nvarchar](100) NOT NULL,
[IS_PUBLIC_SUPPLIER] bit NOT NULL,
CONSTRAINT [PK_COMPANIES] PRIMARY KEY CLUSTERED
[COMPANY_ID] ASC
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[SUPPLIERS](
[SUPPLIER_ID] [int] IDENTITY(1,1) NOT NULL,
[COMPANY_ID] [nvarchar](15) NOT NULL,
[SUPPLIER_NAME] [nvarchar](100) NOT NULL,
[PUBLIC_SUPPLIER_ID] [int] NULL,
CONSTRAINT [PK_SUPPLIER_MASTER] PRIMARY KEY CLUSTERED
[SUPPLIER_ID] ASC
GO
Thanks!Thanks Visakh! Will that work if some have already been inserted previously?
Yes
but if you want to exclude them use this
INSERT INTO Suppliers(Company_ID,Supplier_Name,PUblic_Supplier_ID)
SELECT s1.Company_ID,
s2.Supplier_Name,
s2.Supplier_ID
FROM Suppliers s1
CROSS JOIN Suppliers s2
WHERE EXISTS(
SELECT 1
FROM Company
WHERE Company_ID = s2.Company_ID
AND IS_PUBLIC_SUPPLIER = 1
AND s1.COMPANY_ID <> s2.COMPANY_ID
AND NOT EXISTS (SELECT 1
FROM Suppliers
WHERE Company_ID = s1.Company_ID
AND Supplier_Name = s2.Supplier_Name
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to Export Data from a table in database directly to Excel.
Hi,
I have some sqls that i need to run on a daily basis.My client wants them to be scheduled through a job and the result output of the query should be in the form of Excel.
Now i am no sure how to do this.Is there any in-built function in the DBMS package that can export data drectly from table to Excel. ?
Please Help me !!SQL> spool exlfile.cvs
SQL> set colsep ','
SQL> set lines 300
SQL> set pages 9999
SQL> set trimspool on
SQL>
SQL> select * from DEPARTMENTS
2 /
DEPARTMENT_ID,DEPARTMENT_NAME ,MANAGER_ID,LOCATION_ID
10,Administration , 200, 1700
20,Marketing , 201, 1800
30,Purchasing , 114, 1700
40,Human Resources , 203, 2400
50,Shipping , 121, 1500
60,IT , 103, 1400
70,Public Relations , 204, 2700
80,Sales , 145, 2500
90,Executive , 100, 1700
100,Finance , 108, 1700
110,Accounting , 205, 1700
120,Treasury , , 1700
130,Corporate Tax , , 1700
140,Control And Credit , , 1700
150,Shareholder Services , , 1700
160,Benefits , , 1700
170,Manufacturing , , 1700
180,Construction , , 1700
190,Contracting , , 1700
200,Operations , , 1700
210,IT Support , , 1700
220,NOC , , 1700
230,IT Helpdesk , , 1700
240,Government Sales , , 1700
250,Retail Sales , , 1700
260,Recruiting , , 1700
270,Payroll , , 1700 -
How to show data from different tables in database in ADF Jdeveloper 11g R2
Hi,
My requirement is to display the data in the grid (html > table), the data is to be displayed from more than one table in a single grid and thereafter I am supposed to display the sum of some of the records in another table, I am confused about this, plz help.
RajatThe view link is generally used to relate two view objects together in the AMs data model, for example in a master-detail relationship. If you use them properly, ADF takes care of coordinating master/detail records - for example, ensuring that the detail record has the correct FK to the master record.
Have you read the Fusion Developers Guide for ADF? [url http://docs.oracle.com/cd/E26098_01/web.1112/e16182/bcquerying.htm#CEGJCAHC]This section, for example?
John -
*Urgent*How to insert data from MS SQL to the table that create at the adobe form?
Hi,
I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
ThanksTou need to do a couple of things
1. On the Essbase server, set up an odbc system connection to your MySQL database
2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it -
How to insert data from JTable to mysql Table....
hello everybody
i need help about how to insert data from JTable to mysql table... i know about how to create Table model...facing problem about how to insert data from JTable to mysql table....any helping link or code ... ill be thankfulll....for giving me solution...table1.getValueAt(table1.getSelectedRow(),0)you are getting the value of a selected row... or if you want you can just use a loop..
for(.....){
table1.getValueAt(x,y);
}I think you know INSERT STATEMENT.. here on it just string concat
sample e.g. (This not insert)
"delete from accrule " +
"where ruleid= " + tblRA.getValueAt(tblRA.getSelectedRow(),0)+
" and accountname='"+tblRA.getValueAt(tblRA.getSelectedRow(),1)+"'" -
How to insert data into two tables linke with foreign key..
I have two tables
1)EMP(emp_ID,username,emp_type_code)
emp_ID is primary key, emp_type_code is a foreign key references emptype table.
2)emptype(emp_type_code,emp_type_descripton)
emp_type_code is primary key
Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..CREATE TABLE "CATDB"."DWDIMUSER"
"USER_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_ID" NUMBER(10,0),
"FULLNAME" VARCHAR2(20 BYTE),
"FNAME" VARCHAR2(20 BYTE),
"LNAME" VARCHAR2(20 BYTE),
"USER_SUBTYPE" VARCHAR2(20 BYTE),
CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
CREATE TABLE "CATDB"."DIMSPECIALTY"
"SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_NAME" VARCHAR2(100 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
SELECT DISTINCT
Engineer AS FullName,
regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
'Engineer'
FROM EMPLOYEELOOKUP;
INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
SELECT DISTINCT SPECIALITY
FROM EMPLOYEELOOKUP;
COMMIT;
CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
"EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
"ENGINEER" VARCHAR2(25 BYTE),
"SPECIALTY" VARCHAR2(20 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
DATA IN EMPLOYEELOOKUP
Engineer, Specialty,
John, Dow, Electronis,
Dow, Jons, Technician
Stan Smithers Sales
Mark, Richards Marketing
Jenny, Lane Marketing
John, Lee Sales
I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY. -
How to copy data from transparent table to our own ceated z table?
How to copy data from transparent table to our own ceated z table?
Plz tell me different methods and which one is best?
Is get data from sflight into table z* is correct?Hi Ajay,
let us consider you have to copy EKKO table to ZEKKO table
1. In ABAP program define internal table based on EKKO
<b> eg: i_ekko</b>
2. Select the data from EKKO to i_ekko
<b> eg: select * from ekko into table i_ekko.</b>
3. insert into Z-TABLE from the internal table
<b> eg: INSERT EKKO FROM TABLE I_EKKO.
COMMIT WORK.</b>
<u>To insert in internal table you can use the following:</u>
1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].
2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.
3. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO itab2 [INDEX idx3].
4. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO TABLE itab2.
<u>To inert in database table, use the following:</u>
1. INSERT INTO <dbtabname> [CLIENT SPECIFIED] VALUES wa.
2. INSERT <dbtabname> [CLIENT SPECIFIED] FROM TABLE itab.
3. INSERT <dbtab> [CLIENT SPECIFIED]. oder
4. INSERT <dbtabname> [CLIENT SPECIFIED] ... .
<b>Reward points.. if helpful.
Cheers !
Moqeeth.</b> -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
How to select data from a table using a date field in the where condition?
How to select data from a table using a date field in the where condition?
For eg:
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = '31129999'.
thanks.Hi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
How to insert data from access to sql server ?
How to insert data from access to sql server ?
Please help me
thanksphamtrungkien wrote:
How to insert data from access to sql server by JAVA?The first four words of my last post:
masijade wrote:
JDBC with two connectionsGet a resultset from the jdbc-odbc bridge access connection, cycle through it and add batch insert commands to the jdbc connection to sql server. Give it a try and if the code has an error, then post your code ans ask a question.
The real question, though, is why you think it absolutely necessary to use Java for this. -
How to select data from cluster table
hi experts,
I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
please advice.
maniHi Manikandan,
The following code may be helpful to understand how to select the data from cluster table.
Types: Begin of ty_kna1,
Kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_kna1,
begin of ty_bseg,
belnr type bseg-belnr,
kunnr type bseg-kunnr,
end of ty_bseg,
begin of ty_final,
belnr type bseg-belnr,
kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_final.
Data: it_kna1 type table of ty_kna1,
wa_kna1 type ty_kna1,
it_bseg type table of ty_bseg,
wa_bseg type ty_bseg,
it_final type table of ty_final,
wa_final type ty_final.
Select kunnr adrnr from kna1 into table it_kna1 where....
if sy-subrc = 0.
select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
endif.
sort it_kna1 by kunnr.
Loop at it_bseg into wa_bseg.
move wa_bseg-belnr to wa_final-belnr.
read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-kunnr to wa_final-kunnr,
wa_kna1-belnr to wa_final-belnr.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
Loop at it_final into wa_final.
write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
endloop.
Reward if useful.
Thankyou,
Regards. -
How to Retrieve data from Variant Table
Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?
Hello Mohan,
if u already have data and u want to populate it in F4 help then use below code -
u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
REPORT ZGILL_VALUE_REQUEST .
data: begin of lt_all occurs 0.
include structure DYNPREAD.
data end of lt_all.
data: begin of lt_selected occurs 0.
include structure DDSHRETVAL.
data: end of lt_selected.
DATA: BEGIN OF lt_code OCCURS 0,
code LIKE zgill_main-PERNR,
END OF lt_code.
data no_dyn like sy-dynnr.
Parameters : ECODE like zgill_main-PERNR.
*parameters: pernr like pa0001-pernr .
no_dyn = sy-dynnr. "give the scren no directly or sy-dynnr in case of report.
At selection-screen on value-request for ECODE.
select PERNR into table lt_code from zgill_main.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ECODE'
dynpprog = sy-repid
dynpnr = no_dyn
dynprofield = 'ECODE'
window_title = 'Employee Details'
value_org = 'S'
DISPLAY = 'F'
TABLES
value_tab = lt_code
RETURN_TAB = lt_selected.
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
*if sy-subrc eq '0' .
write: 'success'.
*endif.
read table lt_selected index sy-tabix.
move lt_selected-fieldval to ECODE.
Maybe you are looking for
-
After several failed attempts to send a picture via imessage my iphone 4 always says that I am sending a message to that one person, but nothing is being sent. I can still send them texts via imessage and it will deliver, but the sending notice remai
-
Hello , I have created one workbook template, and did the setting for global template so that it can be used for all the workbooks. But the problem is-- its opening in 2003 but giving problem with 2007. I am not able to open it in 2007.
-
Setting Undo/Redo menu text
When artwork is changed, the text for the Undo menu will be something like "Undo Move" or "Undo Color". The AIUndo suite has a SetUndoText function that "Specifies the localizable text for Undo and Redo menu items". However, when I use this functio
-
Deployment of simple JSP to Oracle Servlet Engine
Hi Anyone there tried to deploy a simple JSP running against OSE. Please advice where can I get more information for this. Thanks
-
Update the record after insert
Hi All, We have a requirement in Oracle Forms where the user should be able to insert the data into the custom table through the form. Once the user enters the data and does 'Ctrl+S', the record is saved in the database. After this if he has changed