Collapsing two tables into one table or one queue
When you have data that exists in 2 tables A and B and B is essentially a child of A if you want to process these records such that you see all A's before their assoociated B how can you use either Streams or AQ to collapse these two tables into one? The data exists at it's source in database tables it will be replicated to another location and at that location I want to keep the data as it exists at the source but also process it in the ordered fashion I described above. My thinking is to publish the data to one queue but the challenge is to ensure that all A's are put on the queue before their B is. I don't just want a priority queue whereby all A's are processed before B's because if that happens B's will never be processed. but I simply want to avoid reading a B off the queue before I've read it's A.
No version number and no clarity of what you are trying to accomplish.
Without knowing that the problem is a nail ... I'd hardly be recommending using a hammer.
Similar Messages
-
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
ABPA code to compress table into a table of fixed-length strings
Hi all,
I need to compress a large, sparse table into a table of fixed-length strings in my ABAP code, and then uncompress it. Is there a standard format or facility to do this? I seem to remember a function that does this, but any other hints would be appreciated.
Thank you in advance,
SunnyFor example, given a table like:
Column0 Column1 Column2
abc C !@#&@
P
def $*(
Compress it into a table consisting of one column of fixed-length strings, like:
Column0
0abc1C2
!@#&@01
P20def1
2$*(
..and then uncompress it back out to the original table.
Sunny -
Break table into multiple tables
I have a table with 700000 records and I need this data for calculating a value in excel using one of the third-party add-ins and then import all the data back into Oracle table. Since excel can only hold about 65000 records, I will have to break the oracle table into about 11 excel files each holding about 65000 records and then run my function and then import the calculated data back into Oracle. My question is how do I split the oracle table into 11 tables with each having 65000 records. There is no unique field in the table.
Format of table is like this;
num1 num2 cdat
12 43
12 34
45 65
32 45
I will need to use excel and calculate cdat column and then import it back to excel with cdat column calculated.
num1 num2 cdat
12 43 232
12 34 543
45 65 343
32 45 244
Any tips to guide me would be helpful.No, I cannot do that because I have a third-party add-in that is installed in excel and it accesses its own proprietary database to peform some calculation and then gives the calculated number in excel. I cannot access this thirdparty database in oracle and I do not know the algorithm it uses to give me the desired number. The only option I have for now, is to get the data from oracle into excel, do my calculations and then import it back into oracle.
-
How can i put below table into internalt table
how can i put below table into internalt table and want to add both internal table into 3rd internal table.
SELECT * FROM J_1IEXCHDR WHERE STATUS = 'P'.
WRITE: / J_1IEXCHDR-LIFNR,
J_1IEXCHDR-DOCNO,
J_1IEXCHDR-EXYEAR,
J_1IEXCHDR-BUDAT.
SELECT * FROM J_1IEXCDTL WHERE TRNTYP = J_1IEXCHDR-TRNTYP
AND DOCYR = J_1IEXCHDR-DOCYR
AND DOCNO = J_1IEXCHDR-DOCNO.
WRITE: / J_1IEXCDTL-EXBAS,
J_1IEXCDTL-EXBED,
J_1IEXCDTL-RDOC1,
J_1IEXCDTL-ECS.
ENDSELECT.
ENDSELECT.
please help
thanks in adavaced.hi laxman,
use for all entries and get the required data.
SELECT * FROM J_1IEXCHDR into table itab1 WHERE STATUS = 'P'.
if not itab1[] is initial.
SELECT * FROM J_1IEXCDTL into table itab2 for all entries in itab1 WHERE TRNTYP = itab1-TRNTYP
AND DOCYR = itab1-DOCYR
AND DOCNO = itab1-DOCNO.
endif.
so itab2 will have the common records...This will solve ur problem..
also u can do other method declare an final internal table with the common fields of the two internal table.
then after getting data in itab1 and itab2.
loop at itab1.
move-corresponding itab1 to itab3.
read table itab2 with key <give the fields> = ......
if sy-subrc eq 0.
move-corresponding itab2 to itab3.
endif.
append itab3.
endloop.
Regards,
nagaraj -
Insert internal table into datbase table
Hi,
I want to insert internal table into database table.
i have use following code
loop at it_header.
INSERT ZTAB from table it_header accepting duplicate keys.
endloop.
but above code insert only first line not multipal.
Thanks in Advance.
SamHi SAM,
Creating a SingleRecord -
>>>>
INSERT INSERT INTO <dbtab> VALUES <wa>.
Eg. DATAwa_spfliTYPEspfli.
wa_spfli-carrid = 'LH'.
wa_spfli-connid = '0007'.
wa_spfli-cityto = 'SINGAPORE'.
INSERT INTO spfli VALUES wa_spfli.
Fsy-subrc NE 0.
Creating Several Records---->>>>
INSERT <dbtab> FROM TABLE <itab>.
Eg.
DATA:it_spfli TYPE STANDARD TABLE OF spfli,
wa_itab LIKE LINE OF it_spfli.
wa_itab-carrid= 'LH'.
wa_itab-connid= '0009'.
wa_itab-cityto= 'HONGKONG'.
APPEND wa_itab TO it_spfli.
APPEND wa_itab TO it_spfli.
INSERT spfli FROM TABLE it_spfli.
IFsy-subrc NE 0. -
Re: join cluster table into transperant table in ABAP Queries
Hi gurus
How to join cluster tables into transperant tables in ABAP Queries,
I want to join KNA1, KNB2, BSEG(cluster table)
pls explain me
amkHi
You can use join for KNA1 and KNB1 which will much faster
then use for all entries of this itab to get the BSEG to improve the performance
here you need to do some trial and error method by joining removing the tables and also for all entries
regards
Shiva -
Inserting data from one table into another table using PL/SQL
HI,
I am trying to insert values from one table into another using PL procedure, the values I want to retrieve from the table riverside1 are charac_id and charac_type and insert these values into another table called riverside2 , the stored procedure zorgs_gorfs(x,y) accepts two parameters which are 2 charac_id's of d characters in riverside1 then using insert statements inserts these characters from riverside1 into riverside2.
CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
BEGIN
INSERT INTO riverside2
(charac_id)
VALUES
(x);
INSERT INTO riverside2
(charac_id)
VALUES
(y);
END zorgs_gorfs;
/This works but the problem im having is that when I also try to insert the charac_type as well as the charac_id it doesnt work below is the code:
CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
BEGIN
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id = x);
END zorgs_gorfs;
/can someone kindly sort me outmodify this sql
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id = x);as
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id in ( x,y));But my suggestion would be consider revising your approach. It does not look that good.
Thanks,
karthick. -
Problem with inserting two BLOBs into a table using setBinaryStream
DBMS 9.2.0.1.0, Oracle JDBC driver 10.1.0.2.0
The following code insert in one INSERT two BLOBs
into two columns using PreparedStatement.setBinaryStream(). When the size of the of at least one blob exceeds
some limit (? 2k, 4k ?), the values are swapped and
inserted into wrong columns.
Please, is this a problem in JDBC driver?
====================================================
import java.io.ByteArrayInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
* Test - two BLOBs swapped problem.
* If size of the blob is larger that some treshold, they are swapped in the database.
public class BlobSwapTest {
private static Connection getConnection() throws SQLException {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException cnfe) {
throw new SQLException("ClassNotFoundException: " + cnfe.getMessage());
return DriverManager.getConnection("jdbc:oracle:thin:@//HOST:1521/DB", "USER", "PSWD");
private static void createTable() throws SQLException {
Connection conn = getConnection();
Statement stmt = null;
try {
stmt = conn.createStatement();
try {
stmt.execute("DROP TABLE BlobTest2");
} catch (SQLException e) {
System.err.println("Table BlobTest2 was not deleted: " + e.getMessage());
stmt.execute(
"CREATE TABLE BlobTest2 ("
+ " pk VARCHAR(512), "
+ " blob BLOB, "
+ " blobB BLOB, "
+ " PRIMARY KEY (pk)"
+ ")"
} finally {
try {
if (stmt != null) stmt.close();
} finally {
conn.close();
public static void main(String[] args) throws SQLException {
createTable();
Connection conn = getConnection();
PreparedStatement pstmt = null;
try {
conn.setAutoCommit(false);
pstmt = conn.prepareStatement("INSERT INTO BlobTest2 VALUES (?,?,?)");
final int size = 5000; // change the value to 500 and the test is OK
byte[] buf = new byte[size];
byte[] buf2 = new byte[size];
for (int i = 0; i < size; i++) {
buf = 66;
buf2 = 88;
pstmt.setString(1, "PK value");
pstmt.setBinaryStream(2, new ByteArrayInputStream(buf), size);
pstmt.setBinaryStream(3, new ByteArrayInputStream(buf2), size);
pstmt.executeUpdate();
conn.commit();
} finally {
if (pstmt != null) pstmt.close();
conn.close();
====================================================See my response in the JVM forum.
-
INSERT of two records into different tables (pk value from first to second)
Hi there!
Have probably stupid question
Need to insert one record into table with primary key and then insert into other table record with value of primary key field from first record
How can I do it?
Thanks a lot!!!You have several possibilities. Most easiest one is listed first :)
SQL> create table a (a number);
Table created.
SQL> alter table a add constraint a_pk primary key (a);
Table altered.
SQL> create table b (a number);
Table created.
SQL> alter table b add constraint b_a_fk foreign key (a) references a(a);
Table altered.
SQL> insert into a values (0);
1 row created.
SQL> insert into b values (0);
1 row created.Though that may not help always, so the next possibility maybe just using sequence with nextval and currval (currval can be used only in the same session and only after you have issued at least one nextval)
SQL> create sequence a_seq;
Sequence created.
SQL> insert into a values (a_seq.nextval);
1 row created.
SQL> insert into b values (a_seq.currval);
1 row created.And you can use also famous returning clause. It is a bit easier to show that in the pl/sql block than pure SQL.
SQL> declare
2 v number;
3 begin
4 insert into a values (a_seq.nextval) returning a into v;
5 insert into b values (v);
6 end;
7 /
PL/SQL procedure successfully completed.And at last contents of the tables :)
SQL> select * from b;
A
0
1
2
SQL> select * from a;
A
0
1
2Gints Plivna
http://www.gplivna.eu -
Best way to JOIN 3 tables into internal table ?
Hi friends,
i have the following issue:
i need to join information of 3 different tables ( BUT000, BUT020 and ADRC ) concerning Business Partners and i need them into one internal table.
how would this be achieved with best performance ?
regards,
CLHi clemens,
As per my understanding, u can further improve this SQL By:
1. first select only BU000 and BU020 with inner join and then select material details in different different itabs. and process This will surely reduce load on DB and may increase load on ABAP which u can improve by using BINARY SERARCH!.
(Important: if u are using two table in join and giviing only PARTNER which is primary key field in both tables in WHERE clasuse ... this should be the only criteria in where clasue then i Dont think it will affect performance .... how many record may be there, this query will be BEST performer... I hope it will fetch 750000 records whithin few seconds)
2. Generally, U try to give more and more conditions in where clause on PRIMARY KEY fiedls only and not on not KEY fields...
3. In worst case, fetch data from three differnt tables into three different itabs and then process, this is best and last way to reduce load on DB and will increase load on ABAP which can be manages as above..
Still u want more info .. send codes to me.. We will try to make it more and more fast....
Jogdand M B
null
Message was edited by:
Jogdand M B -
Breaking down SQL table into Multiple tables on the web using struts
I have a SQL table with business names and products. I am trying to display tables on a webpage for each individual business and their products. So one table is for each business and each business table lists all the products for that business. I'm not really sure how to do this. I sorted by the business names so all the related records are next to each other. I did try two nested iterate statements but received an error about missing a getter. Any suggestions would be helpful. I am writing this code in a JSP file and can use most struts commands (bean, html, nested commands). Sorry if this topics isn't very related to JSP but couldn't really find a better spot.Thanks
You are missing the position parameter:
set echo on
drop table t1;
drop table t2;
drop table t3;
create table t1 (fld1 varchar2(5), fld2 varchar2(10), fld3 varchar2(10),
fld4 varchar2(10) );
create table t2 (fld1 varchar2(5), fld2 varchar2(10), fld3 varchar2(10),
fld4 number );
create table t3 (fld1 varchar2(5), fld2 varchar2(10), fld3 varchar2(10),
fld4 varchar2(10), fld5 varchar2(10) );
load data
infile *
append
into table mpowel01.t1
when (fld1 = 'T1' )
( fld1 terminated by ',',
fld2 terminated by ',',
fld3 terminated by ',',
fld4 terminated by whitespace)
into table mpowel01.t2
when (fld1 = 'T2' )
( fld1 position(1) terminated by ',',
fld2 terminated by ',',
fld3 terminated by ',',
fld4 terminated by whitespace)
into table mpowel01.t3
when (fld1 = 'T3' )
TRAILING NULLCOLS
( fld1 position(1) terminated by ',',
fld2 terminated by ',',
fld3 terminated by ',',
fld4 terminated by ',',
fld5 terminated by whitespace)
BEGINDATA
T1,one,one,one
T2,two,two,2
T3,three,three,three,three
UT1 > select * from t3;
FLD1 FLD2 FLD3 FLD4 FLD5
T3 three three three three
UT1 > select * from t2;
FLD1 FLD2 FLD3 FLD4
T2 two two 2
UT1 > select * from t1;
FLD1 FLD2 FLD3 FLD4
T1 one one one
HTH -- Mark D Powell -- -
Transform generated proxy tables into 'z' tables
Hello to everyone,
My doubt is really persistent and it's an important one...
Imagine we have an wsdl and we create a enterprise service proxy client. The R3 will generate 'Z' tables for the structure which the webservice needs for the request and the response.
How can I transform those generated proxy tables into normal 'Z' tables from the R3 Dictionary database?
Is it possible? Or do I have to create similar tables to the proxy tables?
The problem is that the response structure is really huge, and the work needed to create all the tables necessary to acomodate and all the mapping between the generated proxy tables and the ones that I'll have to create is HUGE!!!... Can I transform in any way those proxy tables?
Any help will be appreciated....Hello Gonçalo
The generated proxy tables are indeed structures (and table types). In your case you have plenty of these structures that have to be "converted" into normal Z-tables.
One approach would be to use an
eCATT for this task. The steps could be as following:(1) Create a new z-table
(2) Include the corresponding proxy structure
(2.a) Transfer fields from include and remove .INCLUDE reference
(3) Remove obsolete fields
(4) Add additional fields
(5) Generate the z-table
Regards
Uwe -
Pass Structured table into dynamic table parameter in public method
Ladies and Gentlemen,
I have a requiremet to pass (1 at a time) any number of tables into a reuseable method in a custom class. The Method code is as follows:
method CREATE_OUTBOUND_FILE.
* Importing VALUE( IV_PATHNAME ) TYPE PATHEXTERN File Destination
* Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA Table with Output
* Importing VALUE( IV_RECORD_STRUCTURE ) TYPE STRING OPTIONAL Record Structure
* Importing VALUE( IV_DELIMITER ) TYPE STRING File Delimiter
* Exporting VALUE( EV_RECORD_CNT ) TYPE STRING Record Count
Data:
ls_line_cnt(6) type n,
lt_data_struc type zty_ddic_struc_T,
ls_string type string.
field-SYMBOLS: <fs_string> type any.
* Open Dataset for outputting file details
Open dataset iv_pathname for output in text mode encoding default.
Assign ls_string to <fs_string> CASTING TYPE (iv_record_structure).
loop at it_file_record into <fs_string>.
transfer <fs_string> to iv_pathname.
Add 1 to ls_line_cnt.
clear <fs_string>.
endloop.
ev_record_cnt = ls_line_cnt.
where IV_PATHNAME = output destination & filename
IT_FILE_REC = data table
IV_RECORD_STRUCTURE = is ddic structure definition for the data table
IV_DELIMITER = file delimiter, in this case, let's say it's C (for CSV)
and EV_RECORD_CNT is a count of numbe of records processed.
Lets say, for example, I wish to load data from table SFLIGHT into the method when program A is executed. Then another time I wish to excute Program B which is passing in data of table SFLCONN2. I hope that by using the "type ref to data" defintion, I can pass the table contents through. Is this true?
Secondly, I'm getting a syntax error saying that "IT_FILE_RECORD" is not defined as a table (and therefore can't be looped at), and therefore can't be read. How can I access the data in this table in preparation for output.
Any assistance or thoughts would be greatly appreciated.
Regards,
SteveHi Stephen ,
Graham already gve part of the solution.
If you declare
Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA
it does not make sense to declare to pass by VALUE because you will not change this refernce in the method. Calling this method, you must pass a refefernce.
data:
lr_ref type ref to data.
get reference of <your itab here> into lr_ref.
CREATE_OUTBOUND_FILE( ...IT_FILE_RECORD = lr_ref ... )
In the method, it goes as graham explained.
Anyway, I would declare the table parameter as
Importing IT_FILE_RECORD TYPE TABLE
The your code could work, but you will have troube with any non-character fields in the tables.
Regards,
Clemens -
Split Excel tables into individual tables in Numbers
Is there a way, having opened a file with multiple tables from excel, to make them into separate tables in Numbers. The tables have links between them and if I copy paste into a new sheet I lose the link. I no longer have access to Excel to put them all on separate Tabs. Thanks
RegSelect a range of cells, press shift-command-X (mark for move), go to a cell in the new table and press shift-command-V (move).
-
How to pass the data of the dynamic table into internal table
Hi all,
I had designed an Dynamic table in my Online Interactive form.
I am able to pass only the First row data into the internal table which i had created
Now how can i pass data of all the rows into the internal table.
Needed some coding help
Thanks
AjayHello Ajay,
If you have dynamic table in adobe and you want to capture all the added rows then you need to add corresponding element in the node bound to that table ui.
when u add a row using java script in adobe form there is no corresponding element created in the backend that is ur wd node bound to the table ui. and so u only get 1 row of data back.
try this,
create a button in your view holding adobe form say "add rows" and on click of this button write the code to add one more element to the node bound to ur table ui of adobe form. when server side rendering occurs it will recreate the table in adobe with added row in the node and you will be able to get the data entered by user.
Thanks,
Abhishek
Maybe you are looking for
-
How to get hardware's attention as soon as it gets plugged in?
I have this joystick with a cthulhu board, in case anyone has one and could use the details, and it seems to disconnect right after I plug it in. According to the person who builds the PCBs it appears the cthulhu is trying to go into PS3 mode since n
-
Allowing another computer to access my network
I bought an Airport Extreme Base Station for my roommate and I to share. I set up the network, and I can access the network and get on the internet, but she cannot. She can access the network and gets an excellent signal, but it is just a local conne
-
Restricting change in Tolerance-section of Goods Rcpt. of T-CODE COR1/2
Hello All, I'm required to put a check on the fileds (Under delivery, Over-delivery and Unlimited ) of Tolerance for Goods Receipt in T-Code COR1/COR2. I have tried to use enhancement PPCO0018, but it is not working, may be , as we are working o
-
Nokia 6110 Offline/ Flight Mode
Is it possible to use the 6110 Offline Mode(I presume this if Flight Mode??)when travelling on commercial aircraft? Is it possible to use the Navigator programme when phone is in Offline Mode? and; Is it possible to use Nokia Sports Navigator when in
-
Hi I try to write my first portlet, i follow this tutorial: http://www.onjava.com/pub/a/onjava/2005/09/14/what-is-a-portlet.html?page=4 i get this error message; Error occurred in portlet!, No stacktrace ? Have sombody some ide what is wrong ?