Delete row internal bank problem
Hi,
i wasn't able to delete row of my internal bank, despite i delete this bank in my BP account and in all payment method.
Also i delete all the information in internal banck account ( branch, count number, iban,etc) but when i delete the row the system give me this messagge error
bank account is currently in use and therefore can not be eliminated 705-20
i currently use 2007A SP 01 patch level 7
how can i resolve this problem? thanks a lot
Hi,
thanks a lot, but this bank is not linked to any one field in Sap B1
1) in initial details there isn't
2) in payment methods there isn't
3) in registry BP there isn't
where can i has to find it????
By copy espress i had copied all payment methods ( with this bank), and after i deleted this payment methods without using this payment method in anyone Sap b1 documents....and here the strange thing
Similar Messages
-
Delete rows dynmically from internal table
Hi Gurus,
I have got an problem. I have an internal table itab.
Case 1. It has got some 10 rows. I want to delete rows between those two rows containing same field value of a Field 'X'. Here same value of that field could come on 1st and 7th row. Then mean, I need to delete 2nd to 6th row.
It could come in 4th and 10th row. Then I need to delete 5th to 9th row.
Case 2. It has got some 20 rows. Now same I want to delete rows between those two rows containing same field value of a Field 'X'. Here again, same value of that field could come on 1st and 17th row. Mean I will delete 2nd to 16th row. It could come in 7th and 19th row. Then I need to delete 8th to 18th row.Hi Vaibhav
Please find the code, I hope it helps
DATA: BEGIN OF itab OCCURS 10,
val,
END OF itab.
DATA: jtab LIKE itab OCCURS 0 WITH HEADER LINE,
l_ind1 TYPE i,
l_ind2 TYPE i,
l_lines TYPE i,
l_flg.
itab-val = 'a'.
append itab.
itab-val = 'b'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'd'.
append itab.
itab-val = 'e'.
append itab.
itab-val = 'f'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'g'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'h'.
append itab.
jtab[] = itab[].
DESCRIBE TABLE itab[] LINES l_lines.
LOOP AT itab.
MOVE sy-tabix to l_ind1.
l_ind2 = l_ind1 + 1.
LOOP AT jtab FROM l_ind2 to l_lines WHERE val eq itab-val.
l_ind1 = l_ind2.
l_ind2 = sy-tabix.
l_flg = 'X'.
exit.
ENDLOOP.
IF l_flg eq 'X'.
exit.
ENDIF.
ENDLOOP.
delete itab FROM l_ind1 to l_ind2.
LOOP AT itab.
WRITE: /2 itab-val.
ENDLOOP.
Still if you want to apply this multiple values, create another internal table and store the values which have been deleted already. So before you going to delete them again you can check from these new internal table.
Please let me know, if any issues still exists.
Regards
Praveen -
DELETED rows from internal table
Hi Experts,
If I delete row/s from an internal table
using the command DELETE ADJACENT DUPLICATES,
is there a way to get these deleted rows.
Thanks in advance.
RoseHi roselie,
1. ofcourse not.
2.hence, before that,
u can declare another internal table,
similar to original,
and use like this.
3. ITAB1[] = ORIGINALITAB[].
regards,
amit m. -
Delete rows from table...Bizarre problem.
Folks
i HAVE this bizarre problem.
I hava a Java class which displays data read into a table with a delete
option by the side of each row.
Now lets assume you have 3 rows in the Table.
abc deleteButton
efg deleteButton
xyz deleteButton
When I click the first delete,that row gets deleted from the table.(perfect...)
Now I have 2 rows.
When I click on the first row,I get the error
'You clicked -1'
java.lang.ArrayIndexOutofBoundsException: -1 < 0.
Can anyone tell me why this is happening even though there are rows in the table.???
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("You clicked row : " + table.getSelectedRow());
javax.swing.table.TableModel model = table.getModel();
Object o = model.getValueAt(table.getSelectedRow(),0);
//System.out.print(model.getValueAt(table.getSelectedRow(), 0));
//System.out.println();
MyDeleteFunction(o.toString());
// Delete row from window.
((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
table.revalidate();
table.repaint();Hi ritu,
This class is called
new DisplayCall_IDTodisconnect(hashTable);
its a long file.
its attached below.
The rows are displayed by reading a hashtable into a vector
and the vector is iterated and appended..
public class DisplayCall_IDToDisconnect {
public static JTable createTable(Vector data, String buttonLabel, ActionListener action){
return createTable(data.iterator(), buttonLabel, action);
public static JTable createTable(
Iterator dataIterator,
String buttonLabel,
ActionListener action) {
DefaultTableModel model = new DefaultTableModel() {
public boolean isCellEditable(int row, int col) {
return col == 1;
model.setColumnCount(2);
while (dataIterator.hasNext()) {
Object[] row = { dataIterator.next().toString(), null };
model.addRow(row);
DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
columnModel.addColumn(new TableColumn(0, 100));
columnModel.addColumn(new TableColumn(1, 80,
new TableButtonCellRenderer(buttonLabel),
new TableButtonCellEditor(buttonLabel, action)
JTable table = new JTable(model, columnModel) {
public void valueChanged(ListSelectionEvent e) {
super.valueChanged(e);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
return table;
private static class TableButtonCellRenderer implements TableCellRenderer {
final JButton button;
TableButtonCellRenderer(String buttonLabel) {
button = new JButton(buttonLabel);
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus, int row, int column) {
return button;
private static class TableButtonCellEditor
extends AbstractCellEditor
implements TableCellEditor, ActionListener {
final JButton button;
final ActionListener callback;
TableButtonCellEditor(String buttonLabel, ActionListener callback) {
button = new JButton(buttonLabel);
this.callback = callback;
button.addActionListener(this);
public Component getTableCellEditorComponent(
JTable table,
Object value,
boolean isSelected,
int row, int column) {
return button;
public Object getCellEditorValue() {
return null;
public void actionPerformed(ActionEvent e) {
button.getParent().requestFocus();
callback.actionPerformed(e);
static JTable table;
Vector items;
final ClientManager clientMgr;
// Constructor.
public DisplayCall_IDToDisconnect(Hashtable callLegTable,ClientManager clientMgr){
Vector vCSeqnos = displayCSeqNos(callLegTable);
this.clientMgr = clientMgr;
JFrame frame = new JFrame("Disconnect Options");
/*Vector*/ items = new Vector();
Enumeration vEnum = vCSeqnos.elements();
while(vEnum.hasMoreElements()){
items.add(vEnum.nextElement());
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
//System.out.println("You clicked row ,col: " + table.getSelectedRow()+
// table.getSelectedColumn());
javax.swing.table.TableModel model = table.getModel();
Object o = model.getValueAt(table.getSelectedRow(),0);
System.out.print(model.getValueAt(table.getSelectedRow(), 0));
System.out.println();
closeConnection(o.toString());
// Delete row from window too.
((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
table.revalidate();
table = DisplayCSeqNos.createTable(items, "Disconnect", al);
frame.getContentPane().add(new JScrollPane(table));
frame.pack();
frame.show();
} // End Constructor.
public void closeConnection(String s){
/*1. Disconnect the current session*/
this.clientMgr.disconnectCall(s);
/*2. refresh the Disconnect window*/
this.refreshWindow();
public Vector displayCSeqNos(Hashtable callLegTable){
Enumeration eNum;
String str;
Vector v = new Vector();
eNum=callLegTable.keys();
while(eNum.hasMoreElements()){
str = (String) eNum.nextElement();
//System.out.println("Key : " + str + " Value : " + callLegTable.get(str));
v.addElement(str);
return v;
} // End of displayCSeqNos. -
I'm having a problem with the add row and delete row for my table. I have a table set up with the add row button in the header, and the delete row button in the first cell of the row beneath the header. I have it set so that the initial count of the row is 2. My problem is if the user adds several rows with data, and save the form. When that user goes back into the same form later, it keeps the several rows that the user entered, which is fine, but then it automatically adds 3 more blank rows to the table, which I don't want. I don't understand why it is doing this. Does anyone have a clue to why this is happening?
Thanks
ConnieHi Connie,
Just make sure that you have checked the below thing.\
File > Form Properties > Run tIme > Scripting > Automatically is checked.
Thanks,
Bibhu. -
Problem deleting rows from a JTable
I've got an editable JTable and a button outside that deletes rows selected by a user from the model. The problem is that if the user has clicked on an editable cell in the table, while rest of the information in that row is deleted, the entry in the editable cell remains. So even though the entry has been deleted from the model, the JTable does not update correctly. I am using a custom editor/renderer for the editable cells.
So it appears that I need to get my custom editor to release, i.e., stop editing on demand, so I can reset the information on the entire row properly.
Any ideas how I can do so ?
Thanks, BhishmaThanks that worked perfectly ! Full points assigned.
In case the above link stops working the solution that worked for me was using a client property as below.
jTable1.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
Ciao.
Edited by: Bhishma on Dec 20, 2008 7:53 PM -
JTable & AbstractTableModel(Delete row problem)
Hi!!
I have used AbstractTableModel in my JTable.In case of multiple rows, i want to delete rows from interface as well as from database. As removeRow method is absent in AbstractTableModel.so DefaultTableModel has been used by casting but CastClassException throws. Here is Partial code(tried in many ways).Plz help me to solve the problem.
void jButtonCancel_actionPerformed(ActionEvent e) {
try{
jTable1.setModel(myModel); //jtable is object of JTable and myModel is of Abstract TableModel
DefaultTableModel model=((DefaultTableModel)jTable1.getModel());
int row=jTable1.getSelectedRow();
if(row>=0){
model.removeRow();
jTable1.revalidate();
model.fireTableDataChanged();
System.out.println("Rows Delete");
catch(Exception sq){
sq.printStackTrace();
sq.getMessage();Hmm...
A bit of studying java awaits you.
Anyway.
Your class:
public class MyModel extends AbstractTableModel
// Do various sorts of coding here
}Is not an instance of DefaultTableModel, so, if you try to cast your model to a DefaultTableModel it will throw an exception since the conversion is impossible.
Recomended solution:
Add a remove method for your class MyModel that does the following:
public void removeRow(int row)
// data removed
// fire removed data event
}Then instead of casting to DefaultTableModel, cast it to 'MyModel' and call the method 'removeRow'.
When it comes to inheritance and casting you can always cast an object to any of it's superclasses or any of the interfaces it supplies or it's superclasses suppplies. You can not cast an object to a instance of which it has no relation with.
In you example, your table model class extends the abstract table model but it does not extend the DefaultTableModel. An instance of your class can be casted to AbstractTableModel and so can an DefaultTableModel because they are both subclasses from AbstractTableModel. They can also be casted to TableModel since all of these implement the interface needed to fullfill TableModel's specification.
If you cast a DefaultTableModel instance to TableModel you can not try to cast it upwards to something the instance wasn't from the beginning.
Example:
DefaultTableModel dtm = new DefaultTableModel();
// When you do casting uppwards, there is no need for paranthesis
TableModel tm = dtm;
// You can easily later on cast this back to what is what or to any step
// in between
DefaultTableModel stillSameModel = (DefaultTableModel)tm;
// You can not however cast to something the instance never was
// Row below will cause an compile error:
JComboBox jb = (JComboBox)dtm;
// This since JComboBox can never be an superclass to the DefaultModel
// More dangerous errors that can't be catched until runtime is the
// one you made. Ie: I do what could be an valid cast
MyModel mm = (MyModel)tm;
// Since MyModel is an TableModel and tm refers to an TableModel,
// this casting is approved by the compiler.
// It will on the other hand throw an ClassCastException when run since
// the variable tm contains an instance of DefaultTableModel which
// is not an MyModel instance.Recomended that you read up on inheritance and basic OO.
Regards,
Peter Norell -
How to add or delete rows in tablecontrol?
Hi,
I am using a tablecontrol to enter data records.
I want to use 2 buttons, one to insert a row into a tablecontrol and another to delete a selected row of a tablecontrol.
How do I insert or delete rows of a tablecontrol?
Thanks.Hi Kumar,
Please look at the below sections......
ADDING BLANK LINES
To add blank lines to table control we do not need to change any of the fields of the structure CXTAB_CONTROL simply adding blank lines to the internal table will do.
INSERT INITIAL LINE INTO itab.
DELETING SELECTED ROWS
Deletion of selected rows is simple. To delete selected rows first we will determine the rows which have been selected through selection column .
FOR SINGLE ROW SELECTION
IF mark EQ 'X' . "mark is the name of selection column field
DELETE itab FROM workarea .
ENDIF.
FOR MULTIPLE ROW SELECTION
*To deetermine the rows selected we will use the selection column field to loop
*through the internal table.
LOOP AT itab WHERE mark EQ 'X'. "mark is the name of selection column field
DELETE itab " and is part of the internal table .
ENDLOOP.
Thanks,
Ravi Kanth -
Right way to delete row before insert
I create a new row with method of ViewObject.
Row row = viewObject.createRow();Then I want to delete this row. I found there are 4 methods. Which is the right answer?
//1.
row.remove();
//2.
row.refresh(Row.REFRESH_REMOVE_NEW_ROWS);
//3.
row.refresh(Row.REFRESH_FORGET_NEW_ROWS);
//4.
row.removeFromCollection();Thanks,Timo, we're having a problem when deleting as you describe, maybe you can offer some advice?
We have a button to delete a row from an editable table, this is set to immediate=true (obviously the user should be able to skip validation when doing a delete). After deleting, if the user then clicks another button to add a new row, the values from the deleted row show in the new row :(
If we set immediate=false this seems to fix the problem, but we then get the undesirable side effect that the user has to make sure all the values in the row are correct before it can be deleted (because the validation is firing). The user experience becomes a bit strange. -
PL/SQL procedure for deleting rows
We have to delete rows from a table by initiating parallel processes depending on no of connections, and also variable commit frequency. The procedure has to start by itself in case of failure of 1 or more parallel processes, by identifying the position where it stopped. Please some one help me what would be th elogic needed to write the [rocedure.
Thanks in Advance
Edited by: 864979 on Jun 9, 2011 10:02 PMBe careful of how this is designed and coded. It is very easy to do it horribly wrong, causing contention and problems.
Have a look at DBMS_PARALLE_EXECUTE.
If the package is not available on your Oracle version, then look at {message:id=1534900} for a manual approach. -
Delete row in a table (not ALV)
i have a table on my web-dynpro-view. I defined a delete-Button and a method with some coding.
If the User marks a row and press the button, the row is deleted. Here's the code:
METHOD onactioneintrag_loeschen .
DATA: wd_node TYPE REF TO if_wd_context_node,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'LV' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
LOOP AT lt_temp INTO wa_temp.
wd_node->remove_element( EXPORTING element = wa_temp ).
ENDLOOP.
ENDMETHOD.
My problem: in the context-change-log i can't identify the deleted rows. It's impossible to make a difference between a change of selection and a delete.Hi David,
You can declare one attribute in the view of type ur row.
and store the deleted row in this attribute in ur delete method.
DATA: wd_node TYPE REF TO if_wd_context_node,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'LV' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
LOOP AT lt_temp INTO wa_temp.
<Attribute_name> = wa_temp .
wd_node->remove_element( EXPORTING element = wa_temp ).
ENDLOOP.
ENDMETHOD.
Hope this will help you.
Thanks & Regards,
Arvind -
How to delete rows in the target table using interface
hi guys,
I have an Interface with source as src and target as tgt both has company_code column.In the Interface i need like if a record with company_code already exists we need to delete it and insert the new one from the src and if it is not availble we need to insert it.
plz tell me how to achieve this?
Regards,
sai.gatha wrote:
For this do we need to apply CDC?
I am not clear on how to delete rows under target, Can you please share the steps to be followed.If you are able to track the deletes in your source data then you dont need CDC. If however you cant - then it might be an option.
I'll give you an example from what im working on currently.
We have an ODS, some 400+ tables. Some are needed 'Real-Time' so we are using CDC. Some are OK to be batch loaded overnight.
CDC captures the Deletes no problem so the standard knowledge modules with a little tweaking for performance are doing the job fine, it handles deletes.
The overnight batch process however cannot track a delete as its phyiscally gone by the time we run the scenarios, so we load all the insert/updates using a last modified date before we pull all the PK's from the source and delete them using a NOT EXISTS looking back at the collection (staging) table. We had to write our own KM for that.
All im saying to the OP is that whilst you have Insert / Update flags to set on the target datastore to influence the API code, there is nothing stopping you extending this logic with the UD flags if you wish and writing your own routines with what to do with the deletes - It all depends on how efficient you can identify rows that have been deleted. -
Restore deleted rows in sql server 2008
Hi,
I have problem, I used import and export wizard in sql server 2008, and select wrong database in source data and wrong database in destination data (i Reflect databases) and in editing mapping i make check for delete rows in destination table.
the step final complete and i lost my data and i don't have backup
how i can restore my dataits not a straight forward activity if you don't have backups, first thing you need to do is to create proper maintenance plan for you databases. You can refer below links which could give some clue about your probles.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/86befdbe-9806-4d96-9e9f-ead753d0fc20/recover-deleted-rows-from-sql-server-database?forum=transactsql
http://sqlserver2000.databases.aspfaq.com/how-do-i-recover-data-from-sql-server-s-log-files.html
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page -
Internal bank info associated with R12 payment batch (PPR)
All,
I am working on the R12 report for AP Checks and have a question regarding the same. The eTrm for 12.1.1 says ((http://etrm.oracle.com/pls/etrm/etrm_pnav.show_object?c_name=AP_INV_SELECTION_CRITERIA_ALL&c_owner=AP&c_type=TABLE) that the bank_account_id is no longer used in ap_inv_selection_criteria_all table.
Now, inorder to get the (internal) bank account information for which the PPR (payment batch/payment process request) is created, I was planning to use the ce_bank_acct_use_id in ap_inv_selection_criteria_all table as bank_account_id is no longer used but when I created a couple of PPRs, I found that the bank_account_id is ALWAYS populated and the ce_bank_acct_use_id is NEVER populated. Has anyone faced this problem before? Please let me know what is the right thing to do to get the internal bank account info associated with the PPR.
Thanks.Hi Ash,
I'm not aware of an open interface for Oracle "payment batches", so what you could do is:
1. Load the details as AP Invoices via the Payables Open Interface tables, with check number, check date, payment status as DFF fields, and using a specific pay group.
2. Import the invoices using open interface import (you specify a payables batch name here)
3. Pay the invoices in Oracle using a dummy payment batch that does nowhere.
4. Modify the standard reports so that the check number / date is picked up off the invoice DFF.
Note that this method assumes you already have the Vendor and Bank Account created in Oracle. There is an open interface for suppliers, but not bank accounts.
Regards,
Gareth
Blog: http://garethroberts.blogspot.com -
How to delete row by row comparing to first collumn?
Hello!
I have a problem - I need to delete row by row , but the problem is, that I know that first COLUMN of any table is a PK.
To retrieve COLUMN NAME I use:
SELECT column_name, table_name FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = c1.tmp_table_name;
But this somehow doesn't work.
Below you can see my script (not worked for now):
declare
xxx varchar2(100);
begin
for c1 in (select table_name, tmp_table_name from tmp_tables) loop
EXECUTE IMMEDIATE
' SELECT column_name into '|| xxx ||' FROM USER_TAB_COLUMNS WHERE column_id = 1 and table_name = ' ||''''||c1.tmp_table_name||'''';
execute immediate
'begin
for c2 in (select * from '|| c1.tmp_table_name || ') loop begin
insert into '|| c1.table_name || ' values c2; delete from '|| c1.tmp_table_name || ' where ' || xxx ||' = c2.'||xxx ||'; exception when others then null; end; end loop; end;';
end loop;
end;
P.S. Inserts work perfect. I have a problem with delete rows that are in c1.table_name, from c1.tmp_table_name (this two tables have the same structure, PK, always), because I have different column names in another tables tables that are PK. (for example: K, ID, NS and so on) please help me to write correct script.
For example for first fetched row it will be like:
begin
for c1 in (select table_name, tmp_table_name from tmp_tables) loop
execute immediate
'begin for c2 in (select * from '|| c1.tmp_table_name || ') loop begin
insert into '|| c1.table_name || ' values c2; delete from '|| c1.tmp_table_name ||' where K = c2.K; exception when others then null; end; end loop; end;';
end loop;
end;
That script works perfect. But I have many others tables with different PK - not K.Solution with error-logging table
-- create the error-logging table
CREATE TABLE tbl_MergeErrors (
Stamp TIMESTAMP(3),
TableName VARCHAR2(30),
KeyColumn VARCHAR2(30),
KeyValue VARCHAR2(4000),
ErrorCode NUMBER(5),
ErrorMsg VARCHAR2(4000),
CONSTRAINT pk_MergeErrors
PRIMARY KEY (TableName, Stamp)
USING INDEX
-- procedure to insert errors
CREATE OR REPLACE
PROCEDURE LogMergeError (pTableName IN VARCHAR2,
pKeyColumn IN VARCHAR2,
pKeyValue IN VARCHAR2)
IS PRAGMA AUTONOMOUS_TRANSACTION;
-- you couldn't insert SQLCODE or SQLERRM directly into a table (ORA-00984)
nSQLCODE NUMBER(5) := SQLCODE;
vcSQLERRM VARCHAR2(4000) := SQLERRM;
BEGIN
INSERT INTO tbl_MergeErrors
(Stamp, TableName, KeyColumn, KeyValue, ErrorCode, ErrorMsg)
VALUES (SYSTIMESTAMP, RTrim( SubStr( pTableName, 1, 30)),
RTrim( SubStr( pKeyColumn, 1, 30)), SubStr( pKeyValue, 1, 4000),
nSQLCODE, vcSQLERRM);
COMMIT WORK;
-- if an error occured here, then just roll back the autonomous transaction
EXCEPTION
WHEN OTHERS THEN ROLLBACK WORK;
END LogMergeError;
-- create the tables and insert test-data
CREATE TABLE TMP_TABLES (
TABLE_NAME VARCHAR2(200),
TMP_TABLE_NAME VARCHAR2(200),
CONSTRAINT TMP_TABLES_X PRIMARY KEY (TABLE_NAME)
CREATE TABLE TMP_KL002 (
K VARCHAR2(40),
N VARCHAR2(200)
CREATE TABLE TMP_TABLE1 (
NS VARCHAR2(40),
N VARCHAR2(200)
CREATE TABLE KL002 (
K VARCHAR2(40),
N VARCHAR2(200),
CONSTRAINT PK_KL002 PRIMARY KEY (K)
CREATE TABLE TABLE1 (
NS VARCHAR2(40),
N VARCHAR2(200),
CONSTRAINT PK_TABLE1 PRIMARY KEY (NS)
INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('kl002','tmp_kl002');
INSERT INTO TMP_TABLES (TABLE_NAME, TMP_TABLE_NAME) VALUES ('table1','tmp_table1');
INSERT INTO tmp_KL002 (K, N) VALUES ('00', 'none');
INSERT INTO tmp_KL002 (K, N) VALUES ('07', 'exists');
INSERT INTO tmp_KL002 (K, N) VALUES ('08', 'not assigned');
INSERT INTO tmp_table1 (NS, N) VALUES ('2000', 'basic');
INSERT INTO tmp_table1 (NS, N) VALUES ('3000', 'advanced');
INSERT INTO tmp_table1 (NS, N) VALUES ('4000', 'custom');
COMMIT WORK;
-- to test, if it works correct when primary key values exists before
INSERT INTO KL002 VALUES ('07', 'exists before');
COMMIT WORK;
-- check the data before execution
SELECT * FROM TMP_KL002 ORDER BY K;
SELECT * FROM KL002 ORDER BY K;
SELECT * FROM TMP_TABLE1 ORDER BY NS;
SELECT * FROM TABLE1 ORDER BY NS;
-- empty the error-logging table
TRUNCATE TABLE tbl_MergeErrors DROP STORAGE;
-- a solution
DECLARE
PLSQL_BLOCK CONSTANT VARCHAR2(256) := '
BEGIN
FOR rec IN (SELECT * FROM <0>) LOOP
BEGIN
INSERT INTO <1> VALUES rec;
DELETE FROM <0> t WHERE (t.<2> = rec.<2>);
EXCEPTION
WHEN OTHERS THEN
LogMergeError( ''<1>'', ''<2>'', rec.<2>);
END;
END LOOP;
END;';
BEGIN
FOR tabcol IN (SELECT t.Tmp_Table_Name, t.Table_Name, c.Column_Name
FROM Tmp_Tables t,
User_Tab_Columns c
WHERE (c.Table_Name = Upper( t.Tmp_Table_Name))
AND (c.Column_ID = 1)
) LOOP
EXECUTE IMMEDIATE Replace( Replace( Replace( PLSQL_BLOCK,
'<0>', tabcol.Tmp_Table_Name),
'<1>', tabcol.Table_Name),
'<2>', tabcol.Column_Name);
END LOOP;
END;
-- check the data after execution ...
SELECT * FROM TMP_KL002 ORDER BY K;
SELECT * FROM KL002 ORDER BY K;
SELECT * FROM TMP_TABLE1 ORDER BY NS;
SELECT * FROM TABLE1 ORDER BY NS;
-- ... and also the error-logging table
SELECT * FROM tbl_MergeErrors ORDER BY Stamp, TableName;
-- of couse you must issue an COMMIT (the ROLLBACK is only for testing
ROLLBACK WORK;
-- drop the test-tables
DROP TABLE TABLE1 PURGE;
DROP TABLE KL002 PURGE;
DROP TABLE TMP_TABLE1 PURGE;
DROP TABLE TMP_KL002 PURGE;
DROP TABLE TMP_TABLES PURGE;
-- you shouldn't drop the error-logging table, but I use it to free up my db
DROP TABLE tbl_MergeErrors PURGE;Greetings, Niels
Maybe you are looking for
-
How to use Kerberos & GSS-API to authenticate in Windows OS
Hi, I need to use Kerberos and GSS-API authentication for user loing in my JSP/Java application against Active Directory in Windows 2003 Server. I have goen through one thread which is quite similar to my need, but it's used for Linux host, which u c
-
I cannot access Help in PSE 12. Tbe error message is not numbered is as follows: "There was an error launching the default browser.. You may need to reinstall the application and the Help component." Do I uninstall and the reinstall? Or do I deac
-
Hello, I have Lync 2013 running on Windows Server 2012 R2. It is fully patched and up to date. I have one Front End Server and one Edge Server. One of our Federated partners uses Comodo certs. He has exported them from his Edge Server, and I have imp
-
Kernel Panics (AFPFS) when using airport discs AND user switching!
Ok, I would love to see if anyone else has had this happen; I can replicate this on 2 Mac Pro's we use: We have airports discs (in accounts mode) connected, all works fine. However, IF one user does not log out, and another logs on (user switching) w
-
Creating Rolling Sums in Reports
If the underlying database does not having rolling sums computed for you, how can you report rolling sums? I tried to use the runningsum function but have no dimension to make the sum reset. If I have a table in the report like: Customer Month