Posting modified data from adf table.
Hi,
I'm still novice in JDeveloper and ADF.
I need to exchange data between two records and store changes in the database.
If I'm using the code below
public void exchangeData(String iterator) {
BindingContainer bindings = getBindings();
DCIteratorBinding it = (DCIteratorBinding)bindings.get(iterator);
RowSetIterator rit = it.getRowSetIterator();
Row curRow = rit.getCurrentRow();
Row prevRow = null;
if (curRow != null && rit.hasPrevious()) {
prevRow = rit.previous();
String value = (String)prevRow.getAttribute("Comments");
prevRow.setAttribute("Comments", curRow.getAttribute("Comments"));
curRow.setAttribute("Comments", value);
} else { //TODO there is no current Record}
rit.setCurrentRow(prevRow);
the data is exchanged with previous record properly, but corresponding "Commit/Save" button is not going to be activated.
What should be done to post or submit data and then commit it?
Thanks in advance!
alexander,
Generally when working with business logic, the work is done in the model layer. You can more easily manipulate the data in a View Ojbect java class than on the form.
1. Look up how to retrieve/iterate data in a View Object or application module class.
2 Expose thoese methods on the view object/application module so that they will be accessable from the data control.
3. Then create a button that will initiate that method from the JSF form.
Stuart
Similar Messages
-
Jdev 11.1.1.5 R1 How To Get Row Data From ADF Table
Hi everyone,
I have an ADF Table Populated with dummy data (for now). Below the Table there is an InputText field.
What I need to do is have the body of the message show up in the InputText field when the user clicks on a message in the inbox(Table).
I've been trying to figure this out for quite some time now, unsuccessfully of course. Hopefully you guys can help me change that.
I do consider myself a beginner still, so please be as clear and specific as possible.
Thanks in advance!
Here is the code I have for the Table/InputText and Backing Beans
<tr>
<td>
<af:table value="#{TableBean.messageAll}" var="message"
rows="5"
inlineStyle="color:Navy; border-style:outset; border-color:Background; border-width:thick; font-size:small; text-align:center; vertical-align:middle; height:135.0px;"
width="610" rowBandingInterval="0" id="t1"
rowSelection="single"
selectionListener="#{TableBean.messageSelected}"
immediate="true" summary="Message Inbox"
disableColumnReordering="true"
columnSelection="none"
columnResizing="disabled">
<af:column sortable="false" align="center"
id="chechboxCol" width="25"
minimumWidth="25">
<f:facet name="header">
<h:selectBooleanCheckbox id="selectAll"
onclick="selectAll();"></h:selectBooleanCheckbox>
</f:facet>
<h:selectBooleanCheckbox id="selectMessage"
value="#{message.selected}"
immediate="true"></h:selectBooleanCheckbox>
</af:column>
<af:column id="urgentCol" width="25" align="center"
minimumWidth="25">
<f:facet name="header">
<h:outputText id="urgentHeader">
<img src="urgent.gif" height="14"
width="14" alt="Urgent Icon"/>
</h:outputText>
</f:facet>
</af:column>
<af:column sortable="true" headerText="From"
align="start" id="fromCol" width="175"
minimumWidth="175">
<af:outputText value="#{message.from}"
id="ot1"/>
</af:column>
<af:column sortable="true" headerText="Subject"
align="start" id="subjectCol" width="175"
minimumWidth="175">
<af:outputText value="#{message.subject}"
id="ot2"/>
</af:column>
<af:column sortable="true" headerText="Type"
align="start" id="c5" width="100"
minimumWidth="100">
<af:outputText value="#{message.type}"
id="ot3"/>
</af:column>
<af:column sortable="true"
headerText="Date Received" align="start"
id="c6" width="80" minimumWidth="80">
<af:outputText value="#{message.date}"
id="ot4"/>
</af:column>
<af:column sortable="true" headerText="Body"
rendered="false" align="start" id="c7"
width="100" minimumWidth="100">
<af:outputText value="#{message.body}"
id="ot5"/>
</af:column>
</af:table>
</td>
</tr>
<tr>
<td>
<p>
<af:commandButton text="Print" id="printButton"
inlineStyle="font-size:x-small;"/>
</p>
<af:inputText binding="#{TableBean.textArea}" rows="10"
readOnly="true" partialTriggers="t1"
contentStyle="width:620px;"
inlineStyle="color:Black; outline-color:Background; outline-style:outset;"
id="it1"></af:inputText>
</td>
</tr>
package Backing;
import javax.faces.event.ActionEvent;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.component.rich.output.RichOutputText;
import java.util.List;
import java.util.ArrayList;
import oracle.adf.view.rich.component.rich.data.RichTable;
import org.apache.myfaces.trinidad.event.SelectionEvent;
public class TableBean {
private RichInputText textArea;
private message[] messageAll =
new message[] { new message("Sender 1", "Author 1", "Message 1",
"Alert", "6/21/2011",
"This is the body 1."),
new message("Sender 2", "Author 2", "Message 2",
"Notification", "6/22/2011",
"This is the body 2."),
new message("Sender 3", "Author 3",
"Message 3", "Broadcast", "6/23/2011",
"This is the body 3."),
new message("Sender 4", "Author 4",
"Message 4", "Alert", "6/24/2011",
"This is the body 4."),
new message("Sender 5", "Author 5", "Message 5",
"Notification", "6/25/2011",
"This is the body 5."), };
public message[] getmessageAll() {
return messageAll;
public void messageSelected(SelectionEvent selectionEvent) {
textArea.setValue("Message body should go here.");
public void setTextArea(RichInputText textArea) {
this.textArea = textArea;
public RichInputText getTextArea() {
return textArea;
public class message {
boolean selected;
String from;
String to;
String subject;
String type;
String date;
String body;
public message(String from, String to, String subject, String type,
String date, String body) {
this.from = from;
this.to = to;
this.subject = subject;
this.type = type;
this.date = date;
this.body = body;
public String getFrom() {
return from;
public String getTo() {
return to;
public String getSubject() {
return subject;
public String getType() {
return type;
public String getDate() {
return date;
public String getBody() {
return body;
}try this code in selection method
RichTable object = (RichTable)selectionEvent.getSource();
Row row = null;
for (Object facesRowKey : object.getSelectedRowKeys()) {
object.setRowKey(facesRowKey);
Object o = object.getRowData();
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;
row = rowData.getRow();
} -
How can I modify data from a Transparent Table without ABAP code.
Hi,All
How can I modify data from a Transparent Table (like TCURR), and important thing is I want do all that with no ABAP code here. It is like that we always do that in a Oracle database use TOAD or PLSQL third party tools, with no script code here.
I had fond that there is a way can do that:
1, type 'se11',and Display Database table 'TCURR', click Contents, then click Execute to display all data
2, type '/h' and let debugging on
3, select one of this data then click 'Display',enter in debugging system.
4, then make a breakpoint in the code. But... display a dialog let I type a 'ABAP Cmnds', I want to know what can be type in for that?
and, My system is ECC6.
thank you all
Edited by: xuehui li on Aug 20, 2008 6:30 PMHello,
Your approach (with Vijay's suggestion) MAY work. However, depending on how tight security is at the company that you are working at you may or may not be able to acutaly change the value of the SHOW field to EDIT. This will be especially true if you are working in a Production environment. Vijay's other comment is true as well. This is not a recommended approach to change data (especially data with a financial impact like TCURR) in a production environment. The auditors will not be impressed.
Explore the option of a maintenace view or look at tcode TBDM to upload a file which includes daily rates from providers like Reuters or try tcode s_bce_68000174 which is a maintenance view on TCURR.
Regards
Greg Kern -
Populate ADF Rich Table taking data from two tables of database
Hi,
Can anyone please guide me as to how I can populate ADF Rich Table taking data from two tables A and B of a database.
The condition is
I want to fetch row 1 from table A and populate into ADF Rich Table at row 1
then
I want to fetch row 1 from table B and populate into ADF Rich Table at row 2
and so on....
Many thanks for your help..
Regards,
RohitThe better place where you will learn:
http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcquerying.htm -
How to get data from COSP table, field HRKFT as the key to data from PM?
Dear ladies and gentlemen!
I need to get data from COSP table, field HRKFT as the key to data from PM tables (AFKO and AUFK).
The problem is that it is a key field to the COSP, and all non-key fields as an alternative to HRKFT are not suitable for this task.
All this is necessary for the extractor, which loads the data from the R \ 3 systems in the BW-system. I need to perform SELECT from a table COSP and maybe also JOIN, most likely between tables COSP and AUFK.
What should I do in this case?
Thank you very much in advance!From information on help.sap.com I've made a conclusion that one of possible solutions in theory is to modify standard extractor PM_OM_OPA_1 in order to make HRKFT field available for work, because by default it is hidden by SAP and not available for use as a key field.
Of course, it's not a very good solution, but for now I know no other way to solve this problem.
Maybe someone knows better ways? In this case I will be very grateful for any help!
Moderator: You'd better post it on BI forums -
Error while selecting date from external table
Hello all,
I am getting the follwing error while selecting data from external table. Any idea why?
SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
2 SE_CUST_ID NUMBER(38),
3 SE_TRAN_AMT_LCY FLOAT(126),
4 SE_REVERSAL_MARKER VARCHAR2(255))
5 ORGANIZATION EXTERNAL (
6 TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY ext_tables
8 ACCESS PARAMETERS (
9 RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ','
11 MISSING FIELD VALUES ARE NULL
12 (
13 country_code CHAR(5),
14 country_name CHAR(50),
15 country_language CHAR(50)
16 )
17 )
18 LOCATION ('SE2.csv')
19 )
20 PARALLEL 5
21 REJECT LIMIT UNLIMITED;
Table created.
SQL> select * from se2_ext;
SQL> select count(*) from se2_ext;
select count(*) from se2_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: SE_REF_NO
ORA-06512: at "SYS.ORACLE_LOADER", line 19It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
HTH -- Mark D Powell -- -
Copying data from one table to another, but not duplicate
Good afternoon!
I am new to Oracle SQL, I have a difficulty.
I have a script that copies or add another table with data from another table.
If the table already has 01 "Registry 01" when you make a copy of the data in table 02, can not duplicate the "Registry 01" again.
As the table already exists since the beginning of the year before last and duplicate information, I can not apply the UNIQUE constraint because of the error. I have to make this change from now.
How to perform this validation so that no duplicate data?
DECLARE
w_cont NUMBER;
CURSOR c_simpro IS
SELECT sc.cd_simpro,
sc.ds_produto,
sp.qt_embalagem,
MAX(sp.dt_vigencia)
FROM simpro_cadastro sc,
simpro_preco sp
WHERE sc.cd_simpro = sp.cd_simpro
GROUP BY sc.cd_simpro,
sc.ds_produto,
sp.qt_embalagem;
BEGIN
FOR r_simpro IN c_simpro LOOP
w_cont := 0;
SELECT COUNT(1)
INTO w_cont
FROM pls_material pm
WHERE pm.cd_material_ops = r_simpro.cd_simpro;
IF w_cont = 0 THEN
INSERT INTO pls_material(nr_sequencia,
dt_atualizacao,
nm_usuario,
dt_atualizacao_nrec,
nm_usuario_nrec,
ie_tipo_despesa,
cd_estabelecimento,
nr_seq_estrut_mat,
cd_simpro,
ds_material,
ie_situacao,
ds_material_sem_acento,
dt_inclusao,
cd_material_ops_orig,
cd_unidade_medida,
cd_material_ops,
qt_conversao_simpro)
VALUES(pls_material_seq.nextval,
SYSDATE,
'ES-SIMPRO',
SYSDATE,
'ES-SIMPRO',
3,
1,
3,
r_simpro.cd_simpro,
r_simpro.ds_PRODUTO,
'A',
r_simpro.ds_PRODUTO,
SYSDATE,
r_simpro.cd_simpro,
'un',
TRIM(to_char(r_simpro.cd_simpro,'0000099999')),
r_simpro.qt_embalagem);
COMMIT;
END IF;
IF w_cont > 0 THEN
UPDATE pls_material p
SET p.qt_conversao_simpro = r_simpro.qt_embalagem,
p.dt_atualizacao = SYSDATE
WHERE p.cd_simpro = r_simpro.cd_simpro;
COMMIT;
END IF;
END LOOP;
END;
Edited by: 983464 on 22/01/2013 10:30Hi,
in addition to what Marwin has already said, I suggest you to post CREATE TABLE and INSERT statements (as mentioned in the FAQ).
The error you are getting from MERGE command is because you need a way to uniquely identify within the table. So it's is important to know also if your table has a primary key/unique index so the keys could to be used in the MERGE command.
Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
Regards.
Al -
How to get edited row values from ADF table?
JDev 11.
I have a table which is populated with data from Bean.
I need to save changes after user make changes in any table cell. InputText is defined for table column component.
I have defined ValueChangeListener for inputText field and AutoSubmit=true. So when user change value in inputText field, method is called:
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
getSelectedRow();
SaveMaterial(material);
This method should call getSelectedRow which take values from selected table row and save them into object:
private Row getSelectedRow(){
RichTable table = this.getMaterialTable();
Iterator selection = table.getSelectedRowKeys().iterator();
while (selection.hasNext())
Object key = selection.next();
table.setRowKey(key);
Object o = table.getRowData();
material = (MATERIAL) o;
System.out.println("Selected Material Desc = "+material.getEnumb());
return null;
Problem is that getSelectedRow method doesnt get new (edited) values, old values are still used.
I have tried to use ActiveButton with same method and it works fine in that case. New values are selected from active row and inserted into object.
JSF:
<af:table var="row" rowSelection="single" columnSelection="single"
value="#{ManageWO.material}" binding="#{ManageWO.materialTable}">
<af:column sortable="false" headerText="E-number">
<af:inputText value="#{row.enumb}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
<af:column sortable="false" headerText="Description">
<af:inputText value="#{row.desc}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
</af:table>
<af:activeCommandToolbarButton text="Save" action="#{ManageWO.EditData}"/>
What is a correct place from where save method should be called to get new (edited) values from ADF table?
Thanks.Did you look into the valueChangeEvent?
It has oldValue and newValue attributes.
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
Object oldVal = valueChangeEvent.getOldValue();
Object newVal = valueChangeEvent.getNewValue();
// check if you see what you are looking for.....
getSelectedRow();
SaveMaterial(material);
}Timo -
Generic datasource by function module to fetch data from multiple tables?
I'm writing a function module to fetch price, for generic datasource.
At first, extract test is OK. But InfoPackage never stop when loading data to PSA in BW.
And I find the example codes:
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
Now I fetch data from multiple tables, I don't think I can use Cursor.
Then How can I handle this?
Thanks a lot.Thanks
IF IT_999[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
* A~DATBI >= SY-DATUM AND
LOEVM_KO = ''.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_997[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A997 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_997
WHERE
* A~KNUMH = IT_997-KNUMH AND
A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_996[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A996 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_996
WHERE
* A~KNUMH = IT_996-KNUMH AND
A~KSCHL = 'ZPRB' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
SELECT MATNR "u7269u6599u53F7u7801
MEINH "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
UMREZ "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
UMREN "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
FROM MARM
INTO CORRESPONDING FIELDS OF TABLE IT_MARM
FOR ALL ENTRIES IN TP_DATA
WHERE MATNR = TP_DATA-MATNR AND MEINH = TP_DATA-KMEIN.
LOOP AT TP_DATA.
IF TP_DATA-KPEIN NE 0.
TP_DATA-KBETR = TP_DATA-KBETR / TP_DATA-KPEIN.
TP_DATA-KHETR = TP_DATA-KHETR / TP_DATA-KPEIN.
ENDIF.
IF TP_DATA-KSCHL = 'ZPRA'.
* TP_DATA-MEINH = 'ZI'.
* TP_DATA-KSCHL = 'B4'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRB'.
* TP_DATA-KSCHL = 'L0'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPR3'.
* TP_DATA-KSCHL = 'B2'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ENDIF.
TP_DATA-MEINH = '01'.
MODIFY TP_DATA.
E_T_DATA-MATNR = TP_DATA-MATNR.
E_T_DATA-KSCHL = TP_DATA-KSCHL.
E_T_DATA-KHETR = TP_DATA-KHETR.
E_T_DATA-KBETR = TP_DATA-KBETR.
E_T_DATA-KMEIN = TP_DATA-KMEIN.
E_T_DATA-DATAB = TP_DATA-DATAB.
E_T_DATA-DATBI = TP_DATA-DATBI.
APPEND E_T_DATA.
CLEAR WA_MARM1.
CLEAR WA_MARM2.
ENDLOOP.
Edited by: Shen Peng on Oct 20, 2010 10:09 AM -
Copying data from one table to another table thru java
Hi
I have to copy data from table emp in Database A to table emp in Database B. My input would be table name and number of rows to be fetched. these rows i need to insert in table B.
The problem over here is I won't be having any info. of table emp i.e the number of columns it has and their type.
So is their any way i can copy the data from one table to other without having the info abt the number of cols and their type.
TIACross post - http://forum.java.sun.com/thread.jspa?threadID=5169293&messageID=9649839#9649839
-
Loading data from one table to another using cursor
Hi,
I have given the below command to load the data from 1 table to another using cursor.
declare
cursor mycursor IS
SELECT extract_name,from_date,to_date,BETA from temp_table where EXTRACT_NAME='GIFTCARD_DETAILS';
Begin
for mycursor_1 IN mycursor loop
insert into tmp_tab columns(col1,col2,col3,col5) values(mycursor_1.EXTRACT_NAME,mycursor_1.from_date,mycursor_1.to_date,mycursor_1.BETA);
End loop;
commit;
end;
It is working fine.
But I want to hard code some of the columns ( like flags ) which are not there in 1st table and load them into 2nd table.
In db2 we will give commands like
varSqlStatus=`db2 "declare mycurs cursor for select extract_name,from_date,to_date,BETA,'N','Y' from temp_table"`
varSqlStatus=`db2 "load from mycurs of cursor modified by identityignore insert into tmp_tab(col1,col2,col3,col5,col6,col7) nonrecoverable"`
But I want it in oracle 10g, Can any one help me in this.Have you tried either of the two options :
1. Modify the CURSOR itself :
cursor mycursor IS
SELECT extract_name,from_date,to_date,BETA,'N','Y' from temp_table where EXTRACT_NAME='GIFTCARD_DETAILS';2. Modify the INSERT statement itself :
insert into tmp_tab columns(col1,col2,col3,col5,col6,col7) values(mycursor_1.EXTRACT_NAME,mycursor_1.from_date,mycursor_1.to_date,mycursor_1.BETA,'N','Y'); -
How to display multiple data from different table in one table? please help
Hi
I got sun java studio creator 2(the separate installation not the one in the net beans)....
My question is about displaying data that have been taken from the database.... I know how to display data in a table(just click on the table "bind data" )... but my question is that:
when i want to use a sql statement that taken the data from different table...
how can i display that data in the table(that will be shown in the web) ??? when i click bind data on the table i can only select one table i can't select more than one....
Note:
1) i'm using the rowset for displaying the data in the table, since the sql statement is depending on a condition(i.e. select a from b where c= ? )...
2) i mean by different table is that( i.e. select a from table1,table2 )..
thanks in advance...Hi,
937440 wrote:
Hi every one, this is my first post in this portal. Welcome to the forum!
Be sure to read the forum FAQ {message:id=9360002}
I want display the details of emp table.. for that I am using this SQL statement.
select * from emp where mgr=nvl(:mgr,mgr);
when I give the input as 7698 it is displaying the corresponding records... and also when I won't give any input then it is displaying all the records except the mgr with null values.
1)I want to display all the records when I won't give any input including nulls
2)I want to display all the records who's mgr is null
Is there any way to incorporate to include all these in a single query..It's a little unclear what you're asking.
The following query always includes rows where mgr is NULL, and when the bind variable :mgr is NULL, it displays all rows:
SELECT *
FROM emp
WHERE LNNVL (mgr != :mgr)
;That is, when :mgr = 7698, it displays 6 rows, and when :mgr is NULL it displays 14 rows (assuming you're using the Oracle-supplied scott.emp table).
The following query includes rows where mgr is NULL only when the bind variable :mgr is NULL, in which case it displays all rows:
SELECT *
FROM emp
WHERE :mgr = mgr
OR :mgr IS NULL
;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL it displays 14 rows.
The following query includes rows where mgr is NULL only when the bind variab;e :mgr is NULL, in which case it displays only the rows where mgr is NULL. That is, it treats NULL as a value:
SELECT *
FROM emp
WHERE DECODE ( mgr
, :mgr, 'OK'
) = 'OK'
;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL, it displays 1 row. -
Deleting data from a table where there are no indexes on the table
Hi
We have one interface program for one time process.When I was testing the process it was taking too much time to load the data around 1000 records.
it happens in 2 steps
1 puts into stage table
2 puts into base table
in the process/package I have delete statement that deletes data from stage table before each process.
Stage table did not have any indexes but the base table has(obvisiosly)
any idea?
please help me on this.
Thanks,
YHi,
Please post the application/database details along with the OS.
Is this interface program a seeded or custom one?
Please enable trace on this concurrent program as per (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12) and generate the TKPROF to find out why it takes that long to load/delete the data.
Thanks,
Hussein -
In PL-SQL archive data from a table to a file
I am currently developing a vb app where I need to archive data from a table to a file. I was hoping to do this with a stored procedure. I will also need to be able to retrieve the data from the file for future use if necessary. What file types are available? Thanks in advance for any suggestions.
What about exporting in an oracle binary format? The export files cannot be modifiable. Is there a way to use the export and import utility in PL/SQL?
null -
Module pool transfer of data from one table control to another
Hi all,
I have been assigned to module pool object wherein i have to display table control on screen and that table control contains only 10 rows on screen for display. Now my internal table it_out has 15 rows
Describe table it_out
line v_l. " v_l = 15.
There is a pushbutton below table control and when i select multiple rows and click on that pushbutton it will navigate me to the next screen containing another table control on which i need to display those selected records.
Now the problem is that when i select first record and move cursor down to select last record then i am seeing only last record on next screen table control. why is it happening? please provide me with solution. For rest of cases it is working fine for example if i select first record and second record then i am seeing both these selected records on next screen table control . Only the problem arises when i tried to select first and lets say last record when scrolling down on table control.
I think the problem is with scrolling but when i loop on next screen with moved records i am seeing that 2 records are their but it is transferring only one record to next screen not the last one.
Your response is highly appreciated.
Thanks
ParagHi Parag,
Screen 8002 (with table control) --> select records --> press a button --> move to screen 8003 --> display selected records in screen 8002.
First problem that if you select first record in table control and scroll to end to select the last record, the first record in deselected.
Next problem, that if you select say 3 records in table control you want the to be displayed in another table control, the use this code.
Also take another internal table and work area same as the initial internal table and work area used in screen 8002.
On screen 8002, take a button with function code 'PROCESS', on which user clicks the screen 8003 should display selected records.
Now, use this code, its working:-
Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
You must have passed a code in PBO of the screen for reading internal table into the table control.
So it reads the internal table into the table control whenever you perform any action on use command.
All you need to do is to write a code to modify the internal table form the table control while performing any user action.
Remember to change the LINE SEL option in attributes of table control as MULTIPLE.
At Screen Logic:-
PROCESS BEFORE OUTPUT.
MODULE status_8002. "for pf-status
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE pass_data. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8002. "to handle other user commands (back and exit)
LOOP WITH CONTROL po_tab. "po_tab is name of table control
MODULE modify_data. "to modify data from table control into internal table
MODULE process_data. "to display selected records on another screen
ENDLOOP.
In PBO,
*& Module STATUS_8002 OUTPUT
MODULE status_8002 OUTPUT.
SET pf-status 'ZAB_PFSTA'. " pf-status
DATA : line_count TYPE i.
DESCIRBE TABLE it_ekpo
LINES line_count.
po_tab-lines = line_count + 10.
" to make table control scrollable
ENDMODULE. " STATUS_8002 OUTPUT
*& Module PASS_DATA OUTPUT
MODULE pass_data OUTPUT.
READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE. " PASS_DATA OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*& Module MODIFY_DATA INPUT
MODULE MODIFY_DATA INPUT.
MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA INPUT
*& Module PROCESS_DATA INPUT
MODULE PROCESS_DATA INPUT.
CASE sy-ucomm.
WHEN 'PROCESS'.
IF wa_ekpo-flag = 'X'.
wa_ekpo1 = wa_ekpo.
APPEND wa_ekpo1 TO it_ekpo1. "if record selected move to another internal table
ENDIF.
ENDCASE.
"modify records from table control into the internal table
ENDMODULE. " PROCESS_DATA INPUT
Now if you select some records in this table control the values will retain in internal table.
Screen 8003 with selected records to be displayed in another table control.
At Screen Logic:-
PROCESS BEFORE OUTPUT.
MODULE status_8003. "for pf-status
LOOP WITH CONTROL po_tb. "po_tb is name of table control
MODULE pass_data1. "to pass data into table control from internal table
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_8003. "to handle other user commands (back and exit)
LOOP WITH CONTROL po_tb. "po_tb is name of table control
MODULE modify_data1. "to modify data from table control into internal table
ENDLOOP.
In PBO,
*& Module STATUS_8003 OUTPUT
MODULE status_8003 OUTPUT.
SET pf-status 'ZAB_PFSTA'. " pf-status
DATA : line_count1 TYPE i.
DESCIRBE TABLE it_ekpo1
LINES line_count1.
po_tb-lines = line_count1 + 10.
" to make table control scrollable
ENDMODULE. " STATUS_8003 OUTPUT
*& Module PASS_DATA1 OUTPUT
MODULE pass_data1 OUTPUT.
READ TABLE it_ekpo1 into wa_ekpo1 INDEX po_tb-current_line.
ENDMODULE. " PASS_DATA1 OUTPUT
"it_ekpo is internal table and wa_ekpo is the work area
In PAI,
*& Module MODIFY_DATA1 INPUT
MODULE MODIFY_DATA1 INPUT.
MODIFY IT_EKPO1 INDEX PO_TB-CURRENT_LINE FROM WA_EKPO1.
"modify records from table control into the internal table
ENDMODULE. " MODIFY_DATA1 INPUT
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
Maybe you are looking for
-
I lost my iPhone 4S yesterday and it is showing as offline on fmip. Is it true that Apple can still track it even though it's off
-
Until recently I was able to use click-n-ship with either Navigator or IE. Then I had a hard drive failure and Apple's fix was to reformat my HD. Now I no longer have IE and no other browser seems to work for me with click-n-ship. I've tried Safari,
-
Using WiFi and 3G at the same time
If I am hooked up to wi-fi, but my cell/3G connection is still active, is there a way to ensure that I'm maximizing my wi-fi use and minimizing depletion of my data plan? Comment edited to start new discussion. Message was edited by: Admin Moderator
-
Hello guys i bought my iphone 4 today and everything works on it including the camera but when i switch to record mode the shutter animation plays and opens and its juat a black screen :S any idea whats going on? Proto
-
How do i fix pairing record is missing
I have the latest iTunes and the latest iPod Touch OS. I connected my iPod to the computer for the first time and got the message "iTunes could not connect to the iPod "Larry's iPod" because the pairing record is missing. How to I fix that problem.