JDBC sender: after read insert records into another table
Hi all,
I send records from a SQL view (not a table) to RFC via proxy method.
After reading a record from the view I would like to move this record to a database table called CHECKED. Can anyone provide me a solution for this or is this impossible. (there are 6 fields that have to be inserted in DB CHECKED after reading: admin, bukrs, dagbknr, bkstnr, datum, regel)
Can I use an INSERT statement in my Update SQL Statement with variables or do I have to create an SP?
Hope someone can help me out of here...
Thanks in advance!
Wouter.
ur strucutre would of:
<root>
<Satement1>
<TableName action=INSERT>
<table>checked</table>
<access>
<admin>val</admin>
<bukrs>val</bukrs>
<dagbknr>val</dagbknr>
<bkstnr>val</bkstnr>
<datum>val</datum>
<regel>val</regel>
</access>
</dbTableName>
</StatementName1>
</root>
or u can use a SQL DML which wud pose a strucutre similar to
<root>
<stmt>
<Customers action="SQL_DML">
<access> INSERT CHECKED SET admin=$admin$, bukrs=$bukrs$', dagbknr=$dagbknr$, bkstnr=$bkstnr$', datum=$datum$, regel.=$regel.$'
</access>
</Customers>
</stmt>
</root>
for more inputs refer to <a href="/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 link on jdbc</a>
Similar Messages
-
Insert Records into another tables
Hi guyz,
I have four tables as below
1) employee
empid (primary key)
deptid
emp_name
work_location
date_of_join
emp_status
date
2) Termination
empid reference employee
deptid
emp_name
work_location
terminate_date
3) Resignation
empid reference employee
deptid
emp_name
work_location
resign_date
4) Vacation
empid reference employee
deptid
emp_name
work_location
vac_date
i have list item on employee form --> emp_status is list item whic contain Termination, Resignation, Vacation
i want to update employee as well other tables if user select the respected field from the list item.
if the user select termination/resignation from the list item the date item will be enable and user should enter the date,otherwise give the error on commit please enter the date and when user commit the record on employee it should update the table employee and delete the record belongs to Termination/Reisgnation and the record will be insert into Termination/Resignation table as select by user from list item.i tried this before but im fail i write the below code on pre-update trigger as below
begin
insert into termination
(empid,deptid,emp_name,work_location,termination_date)select (empid,deptid,emp_name,work_location,date from employee where emp_status='Termination';
delete from employee where emp_status='Termination' ;
end;
same as on resignation
anybuddy help me how to do this task? to update the tables. im new in oracle.
Regards
Edited by: user10648713 on Dec 21, 2008 4:29 AMYou run into the classic Mutating table problem. You cannot issue DML-statement against the same table the trigger is based on in a FOR EACH ROW-trigger.
But even worse, you will cause any kind of client program to get in trouble if you implement such a logic. The client issues an update and as a result the record gets deleted. And, for you have a forms-module based i tell you that you will get problems with your forms-module.
I still can't see whats the sense behind it, putting records into different tables dependant on a status. Oracle is built to manage large data volumes, so even for a large number of records that doesn't make sense to me.
But anyway if you still want to deal with that multi-table-approach, go for the following:
You will need three triggers on your table: a before-statement, an after-statement and a for-each-row-trigger:
The before-statement will initialize a list of PK-Items
The for-each-row will add the id of the processed row to the list
The after-statement will loop over the list and process the rows.
Create a Package for handling the logic including three procedures
CREATE OR REPLACE PACKAGE PK_TRIGGER IS
PROCEDURE PR_BS;
PROCEDURE PR_ARIU(i_nEmpId IN NUMBER);
PROCEDURE PR_AS;
END;
CREATE OR REPLACE PACKAGE BODY IS
TYPE tData IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
lData tData;
PROCEDURE PR_BS IS
BEGIN
lData.DELETE;
END;
PROCEDURE PR_ARIU(i_nEmpId IN NUMBER) IS
iPos PLS_INTEGER:=lData.COUNT+1;
BEGIN
lData(iPos):=i_nEmpId;
END;
PROCEDURE PR_AS IS
CURSOR crEmp(i_nEmpId IN NUMBER) IS
SELECT *
FROM EMP
WHERE EMP_ID=i_nEmpId;
recEmp crEmp%ROWTYPE;
iPos PLS_INTEGER;
BEGIN
iPos:=lData.FIRST;
LOOP
EXIT WHEN iPos IS NULL;
-- Do whatever you want with the data in the record
OPEN crEmp(lData(iPos));
FETCH crEmp INTO recEmp;
IF crEmp%FOUND THEN
IF :NEW.EMP_STATUS='Termination' THEN
DELETE FROM emp
WHERE EMPID=lData(iPos);
INSERT INTO TERMINATION (
empid,
deptid,
emp_name,
work_location,
t_date
) VALUES (
recEmp.empid,
recEmp.deptid,
recEmp.emp_name,
recEmp.work_location,
sysdate
END IF;
END IF;
CLOSE crEmp;
-- Process next record
iPos:=lIds.NEXT(iPos);
END LOOP;
lIds.DELETE;
END;
END;Now create the three triggers calling the appropiate procedures. -
Inserting records into a table with all caps
Hello
I have a procedure that inserts records into a table. How do I ensure that the text values inserted are recorded all capital letters into the table?
Thanks.You can use UPPER(..) function in your insert statement, so that values are converted to UPPER, before insert.
If you want to check at table level, you can achieve that by writting a before insert trigger and in that trigger check
IF UPPER(:new.<col>) != :new.<col> THEN
RAISE_APPLICATION_ERROR(-20101,'Error: Not all values are in upper case')
END IF; -
Using Crystal 2008 to insert records into a table
Hi,
We have a unique need to use Crystal to insert records into a table. We have managed to test a report that can write into a temporary table. This is done by using sql command object and uses the following code :
INSERT INTO TEMP_TABLE (ORDERID)
VALUES ({?orderid}) (-- where orderid a parameter).
This test report asks for an order id and then inserts the record perfectly fine.
Now moving on to the real report - This report basically prints orders in batches and we want to insert order id into a temporary table to ensure we don't print orders that were already printed. To do this we created a sub report "insert orders" that has the above insert command. The main report passes the orderid to subreport and the idea is that the subreport would insert each time an order is passed. So if main report printed 50 orders ids, the then it would do 50 inserts individually into the temp table.
This however is NOT working. The report runs fine but there is no insert. Our hunch is that Crystal is not committing after every order id is passed from the main report. Not sure if we can set the AUTO COMMIT ON as a default somewhere?
Wondering if any one has attempted this or has any insights?
Regards,
Mohit.
Environment is - Crystal 2008 and Oracle 11GR2, we are using Oracle drivers (and not odbc)Hmmm... I don't use Oracle but the syntax looks good...
You've already tested it and I assume that you are using the same driver in the production report as you used in the test, so that shouldn't be an issue...
how are you pulling the data? Is the final SELECT statement that pulls the report data in the same command as the INSERT script, or is the INSERT script in it's own command?
The reason I ask... If you are trying to pass a multi-valued parameter to a command, it won't work. If you have the insert command as it's own command while the data is being pulled with linked tables or a separate command, it is possible that the report itself will execute as expected w/o passing a value to the insert script.
If it's all in 1 command (as it should be), a bad parameter would fail in the final SELECT causing an error.
Also... are rows null or empty string values being added to table when the report executes? This would be an indication that the command is being executed but isn't getting the parameter value.
Jason -
Can BO Enterprize SDK inserts records into user table
From Infostore can we create a jsp script using Java SDK to inserts records into user table??
Thanks
AmarHi Amar,
I want to retrieve data/records from Infostore and insert into a user table using JSP script. Is it possible to do this?
Infostore is a database used by BO Server. so any changes made in infostore through BO enterprise session is valid.
Say u want to retrive on of report present in folder <my folder>.
The you have to query for that. for eg.
boinfostore.query("select * from ci_infoobjects where si_kind ='report' and si_foldername='my folder'");
Create/add/insert any new information in infostore is done by functionalities provide by SDK.
like adding the user or scheduling a report will add new object to infostore.
If you directly access cms database and make any changes then , I am afraid you will end up with nightmare.
So it is always recommneded to access infostore/ cms database only from bo session.
For more information refer below link
[http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm]
then under Contents
BusinessObjects Enterprise SDK >> COM developer guide and API reference >> Query Language Reference
do revert if any queries
Thanks,
Praveen. -
How to retrive one table records into another table by multiple records
how to retrive table X records into another table Y by multiple records (means at once i want display 10 records) in form 6i .
when i am written cursor it is ftching only one record.But i want to display all records at once.
Declare
Cursor cur_name is
select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae WHERE PROTOCOL_NO='KP229';
Begin
open cur_name;
loop
fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
exit when cur_name%notfound;
next_record;
end loop;
close cur_name;
End;Hi,
Make sure the cursor is in the detailed block. For that use 8GO_BLOCK* built-in. So the code will be
Declare
Cursor cur_name is
select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae;
Begin
GO_BLOCK('<detailed_block_name>');
open cur_name;
loop
fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
exit when cur_name%notfound;
next_record;
end loop;
close cur_name;
End;Regards,
Manu.
If my response or the response of another was helpful or Correct, please mark it accordingly -
Insert records into A table in Oracle from SAP
Hello All,
I want to know how can we insert a record into a table which is in another server say Oracle and this needs to be done everyday.
For example, I have a record which gives the information whether the Daily Job has run Successfully or not. Now , I have to update this information in the Oracle table.refer amit perfect answer.
Re: Need to put data in oracle table from sap. -
How to insert records into the Table?
Dear Sir,
I'm new to JDeveloper. Now I managed to create a Frame in JDeveloper with many Text fields and a button. In the back end, I have a procedure to insert records to a table, to which I pass the values of the fields as parameters. Now I'm not getting the steps to call the PL/SQL Stored procedure when I click on the button. I'm using Oracle 9i JDeveloper version 9.0.3.1. and Oracle 9i Database.
Please give me the complete steps to achieve my task - it is quite urgent.
Thanking You in advance.
Regards,
Senthil .A. Perumal.The JDBC tutorial will show you how to call a stored procedure from Java:
http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/basic.htm
One more thing, why are you using such an old version of JDeveloper? any reason not to upgrade to the 10.1.3 version of JDeveloper?
Also you might want to look into ADF and how it makes these type of database interactions easier.
See this demo:
http://www.oracle.com/technology/obe/obe1013jdev/adf_swing/master_detail_page_adfswing_bc.htm -
Problem - Inserting Records into Hashed Tables
Help for an ABAP Newbie...
How do I insert records into a hashed table?
I am trying the following, but get the error message,
*You cannot use explicit or implicit index operations with types "HASHED TABLE" or "ANY TABLE". "LT_UNIQUE_NAME_KEYS" has the type "HASHED TABLE".
TYPES: BEGIN OF idline,
id TYPE i,
END OF idline.
DATA: lt_unique_name_keys TYPE HASHED TABLE OF idline WITH UNIQUE KEY id,
ls_unique_name_key LIKE LINE OF lt_unique_name_keys.
" Create a record and attempt to insert it into the internal table.
" Why does this cause a compilation error message?
ls_unique_name_key-id = 1.
INSERT ls_unique_name_key INTO lt_unique_name_keys.
Thanks,
WalterINSERT ls_unique_name_key INTO TABLE lt_unique_name_keys.
-
How to delete the Table Contents before inserting records into SQL table ?
Hello Experts,
I have a scenario where in I have to Pick up some records from SAP RFC & insert into SQL table.
i know how to do this scenario but the proble with this is before inserting we first have to ZAP the SQL table & insert a new records. One more twist is The Triggering is happening from SAP side with Sender RFC. If this would have been from SQL Side i could have written a Stored Procedure/ Trigger & could have called this before the SENDER JDBC communciation channel picks up the Triggering event from SQL side.
So how to do this scenarioin XI, First deleting all the Records of SQL table & then inserting the new reocrds. without using the BPM.
Regards,
Umeshhi umesh,
you can achieve this by writing SQL query in message mapping level..
refer this link:
http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
regards. -
How to move milion of records into another table
Hello, I would like to know if there is some way how to move large number of rows from one table into another.
We have several tables storing runtime data. Data older then e.g. 10 days are moved into hitory tables. Currently we do this via pl/sql, but I was wondering if it is possible to do this somehow in SQL only (to make it faster).
It is not possible to simply rename the tables, we need to move the data.
Thanks for ideas.872553 wrote:
Hello, I would like to know if there is some way how to move large number of rows from one table into another.
We have several tables storing runtime data. Data older then e.g. 10 days are moved into hitory tables. Currently we do this via pl/sql, but I was wondering if it is possible to do this somehow in SQL only (to make it faster).
It is not possible to simply rename the tables, we need to move the data.
Thanks for ideas.To me looks like a Regular scheduled activity.
Hence, using DBMS_SCHEDULER should be helpful.
Create a Procedure to Copy the records from Transaction Table to History Table.
create or replace procedure copyTransactionToHistory
is
begin
insert /*+ append */ into history_table
select column_list
from transaction_table
where transaction_date = trunc(sysdate) - 10;
commit;
end;
Use DBMS_SCHEDULER to create Job with specified Time Interval (10 Days in your situation). More information and Examples are provided <a href="http://docs.oracle.com/cd/B28359_01/server.111/b28310/schedadmin006.htm#i1009099">Here</a>.There is also a possibilty of using NOLOGGING, but that will be recommended if the activity is not a regular scheduled activity and I do not think it would be a wise option to change the Table mode from LOGGING to NOLOGGING and vice-versa frequently.
You might also consider options to improve the Data movement.
1. Disabling Indexes/Constraints, if any, on History table.
2. Using PARALLEL DML's option
However, important information viz. your Oracle Version (Output of SELECT * FROM V$VERSION), Number of Records etc. are not mentioned which leaves us with no choice but to assume and suggest what we feel is best.
Please read and post the information accordingly for us to help you. {message:id=9360002} -
Insert Records into database table.
Hello Friends,
I am trying to insert set of records from an Internal table into Database table.
INSERT SPFLI FROM TABLE ITAB ACCEPTING DUPLICATE KEYS.
This is my statement. But It inserts only one record in to SPFLI table.
Cheers
SenthilHi Sentil,
USE THIS STATEMENT.
MOVE-CORRESPONDING ITAB TO SPFLI.
SPFLI-MANDT = SY-MANDT.
MODIFY SPFLI.
thy this....
<b>reward if useful</b>
regards,
sunil kairam. -
Efficient Way of Inserting records into multiple tables
Hello everyone,
Im creating an employee application using struts framework. One of the functions of the application is to create new employees. This will involve using one web form. Upon submitting this form, a record will be inserted into two separate tables. Im using a JavaBean (Not given here) between the JSP page and the Java file (Which is partly given below). Now this Java file does work (i.e. it does insert a record into two seperate tables).
My question is, is there a more efficient way of doing the insert into multiple tables (in terms of performance) rather than the way I've done it as shown below? Please note, I am using database pooling and MySQL db. I thought about Batch processing but was having problems writing the code for it below.
Any help would be appreciated.
Assad
package com.erp.ems.db;
import com.erp.ems.entity.Employee;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.ArrayList;
public class EmployeeDAO {
private Connection con;
public EmployeeDAO(Connection con) {
this.con = con;
// METHOD FOR CREATING (INSERTING) A NEW EMPLOYEE
public void create(Employee employee) throws CreateException {
PreparedStatement psemployee = null;
PreparedStatement psscheduleresource = null;
String sqlemployee = "INSERT INTO employee (FIRSTNAME,SURNAME,GENDER) VALUES (?,?,?)";
String sqlscheduleresource = "INSERT INTO scheduleresource (ITBCRATE,SKILLS) VALUES (?,?)";
try {
if (con.isClosed()) {
throw new IllegalStateException("error.unexpected");
// Insert into employee table
psemployee = con.prepareStatement(sqlemployee);
psemployee.setString(1,employee.getFirstName());
psemployee.setString(2,employee.getSurname());
psemployee.setString(3,employee.getGender());
// Insert into scheduleresource table
psscheduleresource = con.prepareStatement(sqlscheduleresource);
psscheduleresource.setDouble(1,employee.getItbcRate());
psscheduleresource.setString(2,employee.getSkills());
if (psemployee.executeUpdate() != 1 && psscheduleresource.executeUpdate() != 1) {
throw new CreateException("error.create.employee");
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("error.unexpected");
} finally {
try {
if (psemployee != null && psscheduleresource != null)
psemployee.close();
psscheduleresource.close();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("error.unexpected");
}Hi ,
U can use
set Auto Commit function here ..
let it be false first
and when u do with u r all queries ..
make it true
this function take boolean values
i e helful when u want record to be inserted in all or not at all..
Hope it helps -
SBO2005SP01PL04: Inserting records into UDO - Tables
Hi
We need to fill up some values into UDO - tables. I know that there exists an method that uses a file at a specific place but our needs maybe need more flexibility because :
- we will fill the values via Button that can be pressed whenever the user wants.
- existing records with same "Code" shouldn't get overwritten.
ThanksSee Re: SBO2005SP01PL04: Copy UDO's of Type Masterdata from one DB to another
-
Single form.. Insert records into multiple tables
I have an unbound form that kicks off a process and I want to store the results of this process in the database. I can code this the old fashioned way with native jdbc calls, but was wondering if someone had a method for doing this with ADF BC.
For example, the process will need to create:
1 master record in table_a
2 or more records in table_b
2 or more records in table_c
Thanks,
EricHi,
in ADF BC you would create a method e.g. on the AM level and then expose it as a client method to ADF. You can then - from within the method - access VO that are representing a table to create new records in them or - the old way - get access to the connection from the ApplicationModule and issue a prepared statement. It depends on the usecase and whether or not there exist a VO for the table to put in the data
Frank
Maybe you are looking for
-
How to integrate hibernate with Stateless Session bean in weblogic10.0
Hi, I need to invoke hibernate(3.x) DAO from EJB Stateless Session bean(EJB2.x). I am using mysql database. Can somebody please post the configuration. Thanks in advance, Rushi.
-
I would like to run a terminal emulator (eg. minicom) on my Arch box to look into my Netgear DM111P router. I have the 3.3v TTL to RS232 converter already, but my IBM Thinkpad T40 does not have any (DB9) serial ports. I was wondering if I could use t
-
Substituting Fonts in Acrobat 9 Standard
I should start by pinting out that I am not a graphic artist, computer "geek" or polymath. I am a electrical technician who uses Acrobat to edit text in .pdfs sent from other companies and to convert Word documents and spreadsheets to .pdfs. So ple
-
How do I get rid of "inbox search"? It is now where "Google search" used to be.
'''''' I was down loading something but got "Inbox search" instead. It displaced "google search in the normal search box at the upper right corner of the screen. The search I get is now very limited. I am so frustrated that I now go back to Safari to
-
Acrobat is in trial mode after subscribing to Creative Cloud
Hi, I've purchased the creative cloud recently. I had trial versions of Acrobat on my home computer and a laptop before I actually purchased my subscription. When I bought the subscription the Acrobat version on my PC and everything else i had trial