Print,Check,Apppend Row,Delete Row,Insert Row buttons actions code
HI,
I have a ALV table in that buttons Print,Check,Apppend Row,Delete Row,Insert Row buttons are there.But client requirement is they don't want those buttons in ALV they want in above the ALV table.
Can you please let me know how to hide those buttons in ALV.and give me code Print,Check,Apppend Row,Delete Row,Insert Row action code..HI,
I hope you have instantiated your ALV. Check the below code
* Instantiate the used component " You can use code wizard to get this code.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usg_alv( ). "usg_alv should be your usage name
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
* Get Model
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_usg_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
* Hide Standard buttons on ALV toolbar
DATA: l_std_func TYPE REF TO if_salv_wd_std_functions.
l_std_func ?= lo_value .
l_std_func->set_edit_append_row_allowed( abap_false ) .
l_std_func->set_sort_headerclick_allowed( abap_true ) .
l_std_func->set_edit_append_row_allowed( abap_false ) .
l_std_func->set_edit_insert_row_allowed( abap_false ) .
l_std_func->set_edit_delete_row_allowed( abap_false ) .
l_std_func->set_view_list_allowed( abap_false ) .
l_std_func->set_sort_headerclick_allowed( abap_false ) .
l_std_func->set_edit_check_available( abap_false ) .
l_std_func->set_pdf_allowed( abap_false ) .
l_std_func->set_export_allowed( abap_true ) .
Radhika.
Similar Messages
-
Cannot delete newly inserted row from a table
Dear all,
There is a table where I have just inserted a new record. I can do a select query on that record and even update it. However when I try to delete the record, my session hangs and the record does not gets deleted. I also do not get a error message.
Does anyone knows what the problem could be ?
Thanks in advance
LHow many rows are in that table?
from another session, what is that session waiting on?
select sid, event, total_waits, time_waited, round(average_wait,4) as average_wait
, (round( (time_waited/m_sum), 4)*100)|| '%' as pct_tot_wait
from v$session_event, (
select sum(time_waited) m_sum
from v$session_event
where sid = <sid_of_hanging_session>
) s
where sid = <sid_of_hanging_session>
order by 4 desc; -
What is the shortcut to insert rows in Numbers?
I know I can use the arrow on the row number to insert rows, but I need to insert a bunch of rows. What is the keyboard shortcut to insert rows? I don't understand what the screen tip says is the shortcut. Thanks for your help
Hi angneld,
The keyboard shortcut for Add Row(s) is option-arrow, where 'arrow' is one of the four arrow keys.
To add one row above the current row:
Select any cell in the current row.
Press option-up arrow.
To add four rows:
Select a stack of four cells, ending with the one after which you want the new rows inserted:
Press option-down arrow:
Done.
As you've probably guessed, using the left or right arrow (with option) inserts column(s) left or right of the selected cell(s).
This was done in Numbers '09, a Mac application. I don't know if this process is supported on Numbers iCloud.
Regards,
Barry -
Idea
A useful feature I would like to suggest would be to allow the creation of multiple blank rows from the 'insert row' button in a table tab.
Possible Solution
A good solution would be to add a prompt next to the button in order to specify the number of blank rows you wish to create. It should default to one to keep the current behavior intact but would allow the user to specify how many rows to insert.
Issues with Current Behavior
Currently you need to click 'insert new row' 50 times to paste 50 rows (from excel for example). If you click it 30 times and paste 50 rows, it will insert the first 30, then overwrite the first 20 existing values. Plus clicking the insert button for each row you want to insert isn't that productive.
Other Comments
I'm sure that many have experienced this delemma and has issues with the consistency of the current excel import tool. This solution would prove to be an easy alternative to importing with a tool and will prove to be a simple way to really improve the usability and much more importantly the ease of this product.
Feedback
If you have had a situation where this would have been nifty feel free to reply with thoughts.
Oracle
Do you believe this would be possible from a development standpoint and what sort of feedback can you provide on the probability of an enhancement like this.Just in case you haven't tried the following :
When in last cell of the last row, you can hit Tab key and that would create a new row and the focus would be in the first cell of the newly created row.
So you don't need to hit the insert row button. Btw, you can also set an accelerator for "Insert Row" using Preferences->Accelerators.
So, probably your feature request could be to - automatically create appropriate # of rows and insert data into those when you paste the data copied from excel into the grid. That should save you a few clicks and eliminate the need of having a textfield to set the # of rows.
-Raghu -
Multi-Row Delete from a table via a button without submitting the page
Hi,
I have a simple page based on a (temporary) table. There is a submit button that calls a PL/SQL process. However, I would like to have an 'Abort' button that deletes all rows from the table belonging to a specific user.
I had a look at 'Processes -> Data Manipulation --> Multi Row Delete' but this can only be linked to a page level event such as onSubmit. My onSubmit is linked to another process so this is not an option for me.
I thought of creating a PL/SQL function for the deletion and calling it from Javascript linked to a button. I have done the PL/SQL and the button but don't know how to call PL/SQL from JS. And is this the correct way of doing something like a deletion? Any documents that show how can this be done will be much appreciated....
I had a look at the forum and the documentation but could not find anything for multil-row deletion triggered from a button.
Your help is appreciated as I'm a newbie :-)
Thanks
AngelaHi,
I actually found the solution. I created a button (that submits) and a computation that calls the PL/SQL function conditional on that button being pressed. Initially I got confused because I already had another PL/SQL function attached to different button. I didn't think that having two buttons that submit the page and call different functions was possible.
Thanks
Angela -
I have a master table and i need to import the rows into the parent and child table.
Master table name is Flatfile_Inventory
Parent Table name is INVENTORY
Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
Error details will be goes to LOG_INVENTORY_ERROR
I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
Again when i run the query using stored procedure,
its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
Please help me to write the query i have attached the Full stored procedure Script..
Arunraj KumarHi Santhosh,
This is my Script.
-- =============================================
-- Stored Procedure for FLATFILE_INVENTORY
-- =============================================
-- Drop stored procedure if it already exists
DROP PROCEDURE SP_Flatfile_Inventory
GO
CREATE PROCEDURE SP_Flatfile_Inventory
AS
--USE IconicMarketing
GO
DECLARE
@FileType varchar(50) ,
@ACDealerID varchar(50) ,
@ClientDealerID varchar(50) ,
@DMSType varchar(50) ,
@StockNumber varchar(50) ,
@InventoryDate datetime ,
@StockType varchar(100) ,
@DMSStatus varchar(50) ,
@InvoicePrice numeric(18, 2) ,
@CostPack varchar(50) ,
@SalesCost numeric(18, 2) ,
@HoldbackAmount numeric(18, 2) ,
@ListPrice numeric(18, 2) ,
@MSRP varchar(max) ,
@LotLocation varchar(50) ,
@TagLine varchar(max) ,
@Certification varchar(max) ,
@CertificationNumber varchar(max) ,
@VehicleVIN varchar(50) ,
@VehicleYear bigint ,
@VehicleMake varchar(50) ,
@VehicleModel varchar(50) ,
@VehicleModelCode varchar(50) ,
@VehicleTrim varchar(50) ,
@VehicleSubTrimLevel varchar(max) ,
@Classification varchar(max) ,
@TypeCode varchar(100) ,
@VehicleMileage bigint ,
@EngineCylinderCount bigint ,
@TransmissionType varchar(50) ,
@VehicleExteriorColor varchar(50) ,
@VehicleInteriorColor varchar(50) ,
@CreatedDate datetime ,
@LastModifiedDate datetime ,
@ModifiedFlag varchar(max) ,
@InteriorColorCode varchar(50) ,
@ExteriorColorCode varchar(50) ,
@PackageCode varchar(50) ,
@CodedCost varchar(50) ,
@Air varchar(100) ,
@OrderType varchar(max) ,
@AgeDays bigint ,
@OutstandingRO varchar(50) ,
@DlrAccessoryRetail varchar(50) ,
@DlrAccessoryCost varchar(max) ,
@DlrAccessoryDesc varchar(max) ,
@ModelDesc varchar(50) ,
@Memo1 varchar(1000) ,
@Memo2 varchar(max) ,
@Weight varchar(max) ,
@FloorPlan numeric(18, 2) ,
@Purchaser varchar(max) ,
@PurchasedFrom varchar(max) ,
@InternetPrice varchar(50) ,
@InventoryAcctDollar numeric(18, 2) ,
@VehicleType varchar(50) ,
@DealerAccessoryCode varchar(50) ,
@AllInventoryAcctDollar numeric(18, 2) ,
@BestPrice varchar(50) ,
@InStock bigint ,
@AccountingMake varchar(50) ,
@GasDiesel varchar(max) ,
@BookValue varchar(10) ,
@FactoryAccessoryDescription varchar(max) ,
@TotalReturn varchar(10) ,
@TotalCost varchar(10) ,
@SS varchar(max) ,
@VehicleBody varchar(max) ,
@StandardEquipment varchar(max) ,
@Account varchar(max) ,
@CalculatedPrice varchar(10) ,
@OriginalCost varchar(10) ,
@AccessoryCore varchar(10) ,
@OtherDollar varchar(10) ,
@PrimaryBookValue varchar(10) ,
@AmountDue varchar(10) ,
@LicenseFee varchar(10) ,
@ICompany varchar(max) ,
@InvenAcct varchar(max) ,
@Field23 varchar(max) ,
@Field24 varchar(max) ,
@SalesCode varchar(max) ,
@BaseRetail varchar(10) ,
@BaseInvAmt varchar(10) ,
@CommPrice varchar(10) ,
@Price1 varchar(10) ,
@Price2 varchar(10) ,
@StickerPrice varchar(10) ,
@TotInvAmt varchar(10) ,
@OptRetail varchar(max) ,
@OptInvAmt varchar(10) ,
@OptCost varchar(10) ,
@Options varchar(max) ,
@Category varchar(max) ,
@Description varchar(max) ,
@Engine varchar(max) ,
@ModelType varchar(max) ,
@FTCode varchar(max) ,
@Wholesale varchar(max) ,
@Retail varchar(max) ,
@Draft varchar(max) ,
@Inventoryid int;
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY];
OPEN Inventory_Cursor
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @VehicleVIN ;
-- ****************** insert into Inventory Table ***********
INSERT INTO INVENTORY
IconicDealerID,
StockNumber,
DMSType,
InventoryDate
VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
set @Inventoryid = scope_identity();
PRINT @Inventoryid;
--Insert into Inventory_Details Table
INSERT INTO [INVENTORY_DETAILS]
InventoryID,
StockType,
DMSStatus,
LotLocation,
TagLine,
Certification,
CertificationNumber,
CreatedDate,
LastModifiedDate,
ModifiedFlag,
PackageCode,
OrderType,
AgeDays,
OutstandingRO,
Memo1,
Memo2,
Purchaser,
PurchasedFrom,
DealerAccessoryCode,
InStock,
AccountingMake,
SS,
Account,
AccessoryCore,
ICompany,
InvenAcct,
Field23,
Field24,
SalesCode,
Draft,
FTCode
VALUES (
@InventoryID,
@StockType,
@DMSStatus,
@LotLocation,
@TagLine,
@Certification,
@CertificationNumber,
@CreatedDate,
@LastModifiedDate,
@ModifiedFlag,
@PackageCode,
@OrderType,
@AgeDays,
@OutstandingRO,
@Memo1,
@Memo2,
@Purchaser,
@PurchasedFrom,
@DealerAccessoryCode,
@InStock,
@AccountingMake,
@SS,
@Account,
@AccessoryCore,
@ICompany,
@InvenAcct,
@Field23,
@Field24,
@SalesCode,
@Draft,
@FTCode
--Insert into Inventory_Amount Table
INSERT INTO [dbo].[INVENTORY_AMOUNT]
InventoryID,
AllInventoryAcctDollar,
OtherDollar,
PrimaryBookValue,
AmountDue,
LicenseFee,
CalculatedPrice,
OriginalCost,
BookValue,
TotalReturn,
TotalCost,
DlrAccessoryRetail,
DlrAccessoryCost,
DlrAccessoryDesc,
InternetPrice,
InventoryAcctDollar,
BestPrice,
Weight,
FloorPlan,
CodedCost,
InvoicePrice,
CostPack,
SalesCost,
HoldbackAmount,
ListPrice,
MSRP,
BaseRetail,
BaseInvAmt,
CommPrice,
Price1,
Price2,
StickerPrice,
TotInvAmt,
OptRetail,
OptInvAmt,
OptCost,
Wholesale,
Retail
VALUES (
@InventoryID,
@AllInventoryAcctDollar,
@OtherDollar,
@PrimaryBookValue,
@AmountDue,
@LicenseFee,
@CalculatedPrice,
@OriginalCost,
@BookValue,
@TotalReturn,
@TotalCost,
@DlrAccessoryRetail,
@DlrAccessoryCost,
@DlrAccessoryDesc,
@InternetPrice,
@InventoryAcctDollar,
@BestPrice,
@Weight,
@FloorPlan,
@CodedCost,
@InvoicePrice,
@CostPack,
@SalesCost,
@HoldbackAmount,
@ListPrice,
@MSRP,
@BaseRetail,
@BaseInvAmt,
@CommPrice,
@Price1,
@Price2,
@StickerPrice,
@TotInvAmt,
@OptRetail,
@OptInvAmt,
@OptCost,
@Wholesale,
@Retail
--Insert into Inventory_Vehicle Table
INSERT INTO [dbo].[INVENTORY_VEHICLE]
InventoryID,
InteriorColorCode,
ExteriorColorCode,
Air,
ModelDesc,
VehicleType,
VehicleVIN,
VehicleYear,
VehicleMake,
VehicleModel,
VehicleModelCode,
VehicleTrim,
VehicleSubTrimLevel,
Classification,
TypeCode,
VehicleMileage
VALUES (
@InventoryID,
@InteriorColorCode,
@ExteriorColorCode,
@Air,
@ModelDesc,
@VehicleType,
@VehicleVIN,
@VehicleYear,
@VehicleMake,
@VehicleModel,
@VehicleModelCode,
@VehicleTrim,
@VehicleSubTrimLevel,
@Classification,
@TypeCode,
@VehicleMileage
-- Move cursor to Next record
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
END
CLOSE Inventory_Cursor;
DEALLOCATE Inventory_Cursor;
GO
SET ANSI_PADDING OFF
GO
Arunraj Kumar -
How to check if row to be inserted will cause circular circular loop?
Hi-
I'm using connect by clause to do some processing and to check that the data is not causing circular loops (with SQLCODE = -1436).
Customers can add data via API, and this data, after inserted, can cause the problem explained above (loop). Therefore I need to find a way to check that these new values don't collide with the existing data in the table.
One way that currently works is to insert the data, use my pl/sql function to check that there's no loops; if there's a loop, i catch the exception, delete the rows I just inserted, and throw back the error to the user.
I find it very ugly and unneficient, but I can't find the way to use CONNECT BY with data that is not present in the table. example:
table my_table contains
parent_id | child_id
111 | 777
777 | 333
and now customer wants to insert:
parent_id | child_id
777 | 111
Also, if customer wants to insert
333 | 111
if I insert the row and run my script, it will work OK, but only if I insert the row. Is there any way to validate this without inserting/removing the row ?
the script I'm using is similar to the one posted here:
problems using CONNECT BY
thanksThis approach may fail to detect loops introduced by concurrent transactions if one of the transaction uses a serializable isolation level.
For example, assume there are two sessions (A and B), the table and trigger have been created, and the table is empty. Consider the following scenario.
First, session A starts a transaction with serializable isolation level:
A> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Transaction set.Next, session B inserts a row and commits:
B> INSERT INTO my_table (parent_id, child_id) VALUES (111, 777);
1 row created.
B> COMMIT;
Commit complete.Now, session A successfully inserts a conflicting row and commits:
A> INSERT INTO my_table (parent_id, child_id) VALUES (777, 111);
1 row created.
A> COMMIT;
Commit complete.
A> SELECT * FROM MY_TABLE;
PARENT_ID CHILD_ID
111 777
777 111Session A "sees" the table "as of" a point in time before session B inserted. Also, once session B commits, the lock it acquired is released.
An alternative approach that would prevent this could use SELECT...FOR UPDATE and a "table of locks" like this:
SQL> DROP TABLE MY_TABLE;
Table dropped.
SQL> CREATE TABLE MY_TABLE
2 (
3 PARENT_ID NUMBER,
4 CHILD_ID NUMBER
5 );
Table created.
SQL> CREATE TABLE LOCKS
2 (
3 LOCK_ID INTEGER PRIMARY KEY
4 );
Table created.
SQL> INSERT INTO LOCKS(LOCK_ID) VALUES(123);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> CREATE OR REPLACE TRIGGER MY_TABLE_AI
2 AFTER INSERT ON my_table
3 DECLARE
4 v_count NUMBER;
5 v_lock_id INTEGER;
6 BEGIN
7 SELECT
8 LOCK_ID
9 INTO
10 v_lock_id
11 FROM
12 LOCKS
13 WHERE
14 LOCKS.LOCK_ID = 123
15 FOR UPDATE;
16
17 SELECT
18 COUNT (*)
19 INTO
20 v_count
21 FROM
22 MY_TABLE
23 CONNECT BY
24 PRIOR PARENT_ID = CHILD_ID;
25
26 END MY_TABLE_AI;
27 /
Trigger created.Now the scenario plays out like this.
First, session A starts a transaction with serializable isolation level:
A> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Transaction set.Next, session B inserts a row and commits:
B> INSERT INTO my_table (parent_id, child_id) VALUES (111, 777);
1 row created.
B> COMMIT;
Commit complete.Now, when session A tries to insert a conflicting row:
A> INSERT INTO my_table (parent_id, child_id) VALUES (777, 111);
INSERT INTO my_table (parent_id, child_id) VALUES (777, 111)
ERROR at line 1:
ORA-08177: can't serialize access for this transaction
ORA-06512: at "TEST.MY_TABLE_AI", line 5
ORA-04088: error during execution of trigger 'TEST.MY_TABLE_AI'To show that this still handles other cases:
1. Conflicting inserts in the same transaction:
SQL> TRUNCATE TABLE MY_TABLE;
Table truncated.
SQL> INSERT INTO my_table (parent_id, child_id) VALUES (111, 777);
1 row created.
SQL> INSERT INTO my_table (parent_id, child_id) VALUES (777, 111);
INSERT INTO my_table (parent_id, child_id) VALUES (777, 111)
ERROR at line 1:
ORA-01436: CONNECT BY loop in user data
ORA-06512: at "TEST.MY_TABLE_AI", line 15
ORA-04088: error during execution of trigger 'TEST.MY_TABLE_AI'2. Read-committed inserts that conflict with previously committed transactions:
SQL> TRUNCATE TABLE MY_TABLE;
Table truncated.
SQL> INSERT INTO my_table (parent_id, child_id) VALUES (111, 777);
1 row created.
SQL> COMMIT;
Commit complete.
SQL> INSERT INTO my_table (parent_id, child_id) VALUES (777, 111);
INSERT INTO my_table (parent_id, child_id) VALUES (777, 111)
ERROR at line 1:
ORA-01436: CONNECT BY loop in user data
ORA-06512: at "TEST.MY_TABLE_AI", line 15
ORA-04088: error during execution of trigger 'TEST.MY_TABLE_AI'3. Conflicting inserts in concurrent, read-committed transactions:
a) First, empty out the table and start a read-committed transaction in one session (A):
A> TRUNCATE TABLE MY_TABLE;
Table truncated.
A> SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
Transaction set.b) Now, start a read-committed transaction in another session (B) and insert a row:
B> SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
Transaction set.
B> INSERT INTO my_table (parent_id, child_id) VALUES (111, 777);
1 row created.c) Now, try to insert a conflicting row in session A:
A> INSERT INTO my_table (parent_id, child_id) VALUES (777, 111);This is blocked until session B commits, and when it does:
B> COMMIT;
Commit complete.the insert in session A fails:
INSERT INTO my_table (parent_id, child_id) VALUES (777, 111)
ERROR at line 1:
ORA-01436: CONNECT BY loop in user data
ORA-06512: at "TEST.MY_TABLE_AI", line 15
ORA-04088: error during execution of trigger 'TEST.MY_TABLE_AI'If updates are permitted on the table, then they could cause loops also, but the trigger could be modified to test for this. -
Check Box for each row in report -- all rows deleting when pressing DELETE
Hello experts! I have set up a report with a check box for each row. When I click the DELETE button to delete the selected rows, every single one of the rows get deleted...even the ones that are not selected. I have my process point set to "On Submit - After computations and validations".
This is my delete process (SHG is the table and SHG_ID is the primary key):
FOR i in 1..HTMLDB_APPLICATION.G_F01.count
LOOP
DELETE FROM SHG
WHERE SHG_ID = HTMLDB_APPLICATION.G_F01(i);
END LOOP;
Also, I've added to query in the region source this line:
htmldb_item.checkbox(1, SHG_ID) del,
Where does the "1" come into this? Not sure what I am doing wrong!
Message was edited by:
user477193
Message was edited by:
user477193The 1 (first argument to all the htmldb_item.* APIs) corresponds to the array number in htmldb_application.g_fNN. So 1 will populate array g_f01, 2 will populate g_f02 and so on.
Your code seems fine, it should delete only the checked rows. Are you sure there is no other process on the page that might be deleting the rows? See if you can put up an example on htmldb.oracle.com -
How to Display Number of Rows Deleted/Inserted etc... in PL/SQL
In Oracle 10g PL/SQL, I have a delete statement in a stored procedure. It is not in a cursor. I want to see the number of rows I've deleted. I can use the dbms_output.put_line package. I should know this, but I don't have time to perfect the syntax. How would I get the number of rows that get deleted and display it via dbms_output.put_lline?
No time to google either I guess.
http://www.google.co.uk/search?q=number+of+rows+deleted+oracle&rls=com.microsoft:en-gb&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1&rlz=&redir_esc=&ei=Qi5qToGyGYqw8QOGzf3nAg
SQL> create table dt_del_ex(id number);
Table created.
SQL> set serveroutput on
SQL> BEGIN
2
3 INSERT INTO dt_del_ex VALUES(1);
4
5 DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows inserted');
6
7 INSERT INTO dt_del_ex select rownum from dual connect by level <=10;
8
9 DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows inserted');
10
11 UPDATE dt_del_ex SET id = id + 3 WHERE id >= 9;
12
13 DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows updated');
14
15 DELETE FROM dt_del_ex WHERE id <= 10;
16
17 DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows deleted');
18
19 END;
20 /
1 rows inserted
10 rows inserted
2 rows updated
9 rows deleted
PL/SQL procedure successfully completed. -
Insert row and delete row in a table control
Hi Experts,
I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
Thanks in Advance....Santhosh,
Iam using this code..
FORM fcode_delete_row
USING p_tc_name TYPE dynfnam
p_table_name
p_mark_name .
-BEGIN OF LOCAL DATA----
DATA l_table_name LIKE feld-name.
data: p_mark_name type c.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <wa>.
FIELD-SYMBOLS <mark_field>.
-END OF LOCAL DATA----
ASSIGN (p_tc_name) TO <tc>.
get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline
delete marked lines *
DESCRIBE TABLE <table> LINES <tc>-lines.
LOOP AT <table> ASSIGNING <wa>.
access to the component 'FLAG' of the table header *
ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
if <MARK_FIELD> = 'X'.
PERFORM f_save_confirmation_9101.
IF gv_answer EQ '1'.
DELETE <table> INDEX syst-tabix.
IF sy-subrc = 0.
<tc>-lines = <tc>-lines - 1.
ENDIF.
ELSE.
ENDIF.
ENDIF.
ENDLOOP.
in this code ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
if <MARK_FIELD> = 'X'.
this code is not working... -
Checking for duplicate primary keys on row inserts
Checking for duplicate primary keys on row inserts
I have a situation where I will be making bulk table inserts knowing that the primary key value will in some cases already exist. In this is the case I simply want to ignore the duplicate inserts.
Should I be performing a sub-query on the table and using a statement like:
where not exist in
Or is there a cleaner way of discarding or checking for duplicates on insert.
My concerns were mainly one of performance, as my routine will be inserting a few thousand rows in its operation.The MERGE commnad is a good option when a large percentage of the data will exist in the target because it is much more efficient to attempt to update then insert when the update affects zero rows than capture an error and convert it to an update.
However, since in this case it would appear that only a few rows will alreadys exist and we want to ignore the duplicates when they exist then
begin
insert
exception
when dup_value_in_index then null;
end
would be the way to code this one. The bulk insert version has in 9.2 the ability to store the errors so that they can all be handled at once which means the rest of the array insert can work.
HTH -- Mark D Powell -- -
JTable row deletion deleting valuable information --need HELP
Hi Experts and Java Programmers,
I am posting the code that works 99% of the time. It basically creates a JTable and has row insertion and row deletion methods. The row insertion works fine. However, when a row N is deleted it causes the loss of data in the row N+1's cell in whichever cell the cursor is blinking. In other words, when cursor is in cell M of row N, row deletion sets the cell M of row N+1 to blank. So if the cursor is on the 2nd cell of 1st row and if 1st row is deleted, the data in the 2nd cell of 2nd row (now moved to 1st row) is lost.
Thanks for your help.
Murthy
package trunkxref;
* Copyright 1999-2002 Matthew Robinson and Pavel Vorobiev.
* All Rights Reserved.
* ===================================================
* This program contains code from the book "Swing"
* 2nd Edition by Matthew Robinson and Pavel Vorobiev
* http://www.spindoczine.com/sbe
* ===================================================
* The above paragraph must be included in full, unmodified
* and completely intact in the beginning of any source code
* file that references, copies or uses (in any way, shape
* or form) code contained in this file.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import java.text.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.net.*;
public class trnk
//extends JFrame
public JTable m_table;
public TrunkReportData m_data;
public JLabel m_title;
public JLabel m_title2;
public InputStream is;
Image imginsert, imgdel, imgup, imgdown, imgsav;
URL jspURL;
JApplet applet;
public trnk ( JApplet applet,InputStream is, Image imginsert, Image imgdel, Image imgup, Image imgdown, Image imgsav, URL jspURL)
//super ("Trunks Data");
//setSize (600, 300);
this.applet=applet;
this.is=is;
this.imginsert=imginsert;
this.imgdel=imgdel;
this.imgup=imgup;
this.imgsav=imgsav;
this.imgdown=imgdown;
this.jspURL=jspURL;
UIManager.put("Table.focusCellHighlightBorder",
new LineBorder(Color.black, 0));
m_data = new TrunkReportData (this,imgup, imgdown);
m_title = new JLabel(m_data.getTitle(),
null, SwingConstants.LEFT);
m_title2 = new JLabel("(Please make sure to hit TAB or ENTER after making changes to a cell)",
null, SwingConstants.LEFT);
m_title.setFont(new Font("Helvetica",Font.PLAIN,24));
m_title2.setFont(new Font("Helvetica",Font.PLAIN,12));
Color bg=new Color(200,100,30);
//setBackground(header.getBackground());
m_title.setBackground(bg);
m_title.setForeground(Color.white);
m_title2.setBackground(bg);
m_title2.setForeground(Color.yellow);
//getContentPane().add(m_title, BorderLayout.NORTH);
m_table = new JTable ();
m_table.putClientProperty( "JTable.autoStartsEdit", new Boolean( false ) );
//m_table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
m_table = new JTable () {
public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (e.getKeyChar()==KeyEvent.CHAR_UNDEFINED)
return false;
return super.processKeyBinding(ks,e,condition,pressed); }
m_table = new JTable () {
protected void processKeyEvent(KeyEvent e) {
if ( (e.getKeyCode() == KeyEvent.VK_ENTER ||
e.getKeyCode() == KeyEvent.VK_TAB) &&
e.getID() == KeyEvent.KEY_PRESSED ){
if(m_table.isEditing()) {
m_table.getCellEditor().stopCellEditing();
int row = m_table.getEditingRow();
int col = m_table.getEditingColumn();
col++; // actually check col > number of columns
m_table.editCellAt(row,col);
//m_table.transferFocus();
} else {
int col = m_table.getSelectedColumn() + 1;
int row = m_table.getSelectedRow();
m_table.clearSelection();
col++; // actually check col > number of columns
m_table.editCellAt(row,col);
//m_table.transferFocus();
//m_table.setRowSelectionInterval(row, row);
//m_table.setColumnSelectionInterval(column, column);
//m_table.scrollRectToVisible( m_table.getCellRect(row, column, true) );
} else {
super.processKeyEvent(e);
//m_table.setSurrendersFocusOnKeystroke(true);
//m_table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
m_table.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e){
public void focusLost(FocusEvent e){
if(m_table.isEditing()) {
m_table.getCellEditor().stopCellEditing();
m_table.setAutoCreateColumnsFromModel (false);
m_table.setModel (m_data);
m_table.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
for (int k = 0; k < m_data.getColumnCount (); k++)
TableCellRenderer renderer = null;
TableCellEditor editor = null;
renderer = new TextAreaCellRenderer (); // NEW
editor = new TextAreaCellEditor (m_table, m_data);
TableColumn column = new TableColumn (k,
TrunkReportData.m_columns[k].m_width,
renderer, editor);
column.setHeaderRenderer(createDefaultRenderer());
m_table.addColumn (column);
JTableHeader header = m_table.getTableHeader ();
header.setUpdateTableInRealTime (false);
header.addMouseListener(new ColumnListener());
header.setReorderingAllowed(true);
//JScrollPane ps = new JScrollPane ();
//ps.getViewport ().setBackground (m_table.getBackground ());
//ps.setSize (550, 150);
//ps.getViewport ().add (m_table);
//getContentPane ().add (ps, BorderLayout.CENTER);
//JToolBar tb = createToolbar ();
//getContentPane ().add (tb, BorderLayout.NORTH);
//JPanel p = new JPanel (new GridLayout (1, 2, 5, 5));
//getContentPane ().add (p, BorderLayout.SOUTH);
} //constructor trnk
protected TableCellRenderer createDefaultRenderer() {
DefaultTableCellRenderer label = new DefaultTableCellRenderer()
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (table != null) {
JTableHeader header = table.getTableHeader();
if (header != null) {
//setForeground(header.getForeground());
setForeground(Color.white);
Color bg=new Color(200,100,30);
//setBackground(header.getBackground());
setBackground(bg);
setFont(header.getFont());
setText((value == null) ? "" : value.toString()) ;
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return this;
label.setHorizontalAlignment(JLabel.CENTER);
return label;
} //table cell renderer
public JToolBar createToolbar ()
JToolBar tb = new JToolBar ();
tb.setFloatable (false);
Color bg=new Color(200,100,30);
//setBackground(header.getBackground());
tb.setBackground(bg);
JButton bt = new JButton (new ImageIcon (imginsert));
//JButton bt = new JButton ("Insert");
bt.setToolTipText ("Insert Row");
bt.setRequestFocusEnabled (false);
ActionListener lst = new ActionListener (){
public void actionPerformed (ActionEvent e) {
int nRow = m_table.getSelectedRow() + 1;
m_data.insert (nRow);
m_table.tableChanged (new TableModelEvent
(m_data, nRow, nRow, TableModelEvent.ALL_COLUMNS,
TableModelEvent.INSERT));
m_table.setRowSelectionInterval (nRow, nRow);
bt.addActionListener ((ActionListener)lst);
tb.add (bt);
bt = new JButton (new ImageIcon (imgdel));
//bt = new JButton ("Delete");
bt.setToolTipText("Delete Row");
bt.setRequestFocusEnabled(false);
lst = new ActionListener ()
public void
actionPerformed
(ActionEvent e)
int nRow = m_table.getSelectedRow();
if (nRow < 0)
JOptionPane.showMessageDialog( null, "Please select a row to delete", "Error", JOptionPane.ERROR_MESSAGE);
else
if (JOptionPane.showConfirmDialog(null, "Do you want to delete the selected row?", "Delete a Row", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
if (m_data.delete (nRow))
m_table.getCellEditor().stopCellEditing();
m_table.tableChanged
(new TableModelEvent
(m_data, nRow, nRow,
TableModelEvent.ALL_COLUMNS,
TableModelEvent.DELETE));
//m_table.clearSelection();
bt.addActionListener(lst);
tb.add (bt);
bt = new JButton (new ImageIcon (imgsav));
//bt = new JButton ("Save");
bt.setToolTipText("Save");
bt.setRequestFocusEnabled(false);
lst = new ActionListener ()
public void
actionPerformed
(ActionEvent e)
m_table.tableChanged (new TableModelEvent
(m_data));
//m_data.fireTableDataChanged();
//System.out.println("beginning to write data to" + jspURL.toString());
//code to save data to file
//final Component top=(trnk)this.getTopLevelAncestor();
//final Component top=(trnk)super.;
//final Cursor lOrigCursor =(Cursor) super.getCursor();
//final Cursor lOrigCursor = getCrsr();
//top.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
setWaitCursor();
Thread lSavThread= new Thread() {
public void run()
savefile(m_data, jspURL);
//top.setCursor( lOrigCursor );
setNormalCursor();
lSavThread.start();
bt.addActionListener(lst);
tb.add (bt);
return tb;
} //create tool bar
public void setWaitCursor()
applet.getGlassPane().setVisible(false);
applet.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
public void setNormalCursor()
applet.getGlassPane().setVisible(true);
applet.getGlassPane().setCursor(Cursor.getDefaultCursor());
public void savefile(TrunkReportData m_data, URL jspURL)
String txt="";
Enumeration enum=m_data.m_vector.elements();
while(enum.hasMoreElements())
TrunkData trnk = (TrunkData)enum.nextElement();
txt += trnk.m_sysname + " , "
+ trnk.m_clli + " , "
+ trnk.m_tg + " , "
+ trnk.m_member.intValue() + " , "
+ trnk.m_trunk_type + " , "
+ trnk.m_lata + " , "
+ trnk.m_lata_name + " , "
+ trnk.m_prospect_server + " , "
+ trnk.m_tgroupid + " , "
+ trnk.m_ctg + " , "
+ trnk.m_augmen.intValue() + " , "
+ trnk.m_vendor + "\n";
try {
URLConnection jspCon=jspURL.openConnection();
jspCon.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
jspCon.setUseCaches(false);
jspCon.setDoOutput(true);
PrintStream out = new PrintStream(jspCon.getOutputStream());
String postData= "Text=" + URLEncoder.encode(txt, "UTF-8");
out.println(postData);
out.flush();
out.close();
InputStreamReader in=new InputStreamReader(jspCon.getInputStream());
int chr;
while((chr=in.read()) != -1) {}
in.close();
} catch (Exception e2) {
System.out.println (" exception in writing data out "
+ e2.toString());
//System.out.println("done write data");
// NEW
class ColumnListener extends MouseAdapter {
public void mouseClicked(MouseEvent e) {
TableColumnModel colModel = m_table.getColumnModel();
int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
int modelIndex = colModel.getColumn(columnModelIndex).getModelIndex();
if (modelIndex < 0)
return;
if (m_data.m_sortCol == modelIndex)
m_data.m_sortAsc = !m_data.m_sortAsc;
else
m_data.m_sortCol = modelIndex;
for (int i=0; i < m_data.getColumnCount(); i++) {
TableColumn column = colModel.getColumn(i);
int index = column.getModelIndex();
JLabel renderer = (JLabel)column.getHeaderRenderer();
renderer.setIcon(m_data.getColumnIcon(index));
m_table.getTableHeader().repaint();
m_data.sortData();
m_table.tableChanged(new TableModelEvent(m_data));
m_table.repaint();
} //column listener
} //class trnk
class TextAreaCellRenderer extends JTextArea implements TableCellRenderer
protected static Border m_noFocusBorder = new
EmptyBorder (1, 1, 1, 1);
protected static Border m_focusBorder =
UIManager.getBorder("Table.focusCellHighlightBorder");
public
TextAreaCellRenderer
setEditable
(false);
setLineWrap
(true);
setWrapStyleWord
(true);
setBorder
(m_noFocusBorder);
public Component
getTableCellRendererComponent
(JTable table,
Object value,
boolean
isSelected,
boolean
hasFocus,
int nRow, int nCol)
Color fg=new Color(255,0,0);
//ColorData cvalue = new ColorData(value);
setForeground(fg);
if (value instanceof String)
setText ((String) value);
else if (value instanceof Integer)
setText((String)value.toString());
setBackground
(isSelected && !hasFocus ? table.getSelectionBackground() : table.getBackground ());
//setForeground (isSelected && !hasFocus ?
// table.getSelectionForeground() : table.getForeground ());
setFont (table.getFont ());
setBorder (hasFocus ? m_focusBorder : m_noFocusBorder);
causes looping and stops rendering the components surrounding
the cells
// Adjust row's
// height
//int width =
// table.getColumnModel().getColumn(nCol).getWidth ();
//setSize (width,
// 1000);
int rowHeight = getPreferredSize().height;
if (table.getRowHeight(nRow) < rowHeight)
table.setRowHeight (nRow, rowHeight);
//table.setRowHeight(nRow, 20);
return this;}
// To fix JDK bug
public String getToolTipText (MouseEvent event)
return null;
} //class text area cell renderer
// NEW
class TextAreaCellEditor extends AbstractCellEditor implements
TableCellEditor
public static int CLICK_COUNT_TO_EDIT = 1;
protected JTextArea m_textArea;
protected JScrollPane m_scroll;
public TextAreaCellEditor (JTable t_table, TrunkReportData t_tablemodel)
final JTable table=t_table;
final TrunkReportData tablemodel =t_tablemodel;
m_textArea = new JTextArea () {
protected void processKeyEvent(KeyEvent e) {
//if (e.getKeyChar()==KeyEvent.CHAR_UNDEFINED)
// return ;
if ( (e.getKeyCode() == KeyEvent.VK_ENTER ||
e.getKeyCode() == KeyEvent.VK_TAB)&&
e.getID() == KeyEvent.KEY_PRESSED ){
int row = table.getEditingRow();
int col = table.getEditingColumn();
col++; // actually check col > number of columns
if (col == tablemodel.getColumnCount())
row++;
if (row == tablemodel.getRowCount())
row=0;
col=0;
stopCellEditing();
table.editCellAt(row,col);
table.transferFocus();
} else if ( (e.getKeyCode() == KeyEvent.VK_DOWN ||
e.getKeyCode() == KeyEvent.VK_UP ) &&
e.getID() == KeyEvent.KEY_PRESSED ){
int row = table.getEditingRow();
int col = table.getEditingColumn();
if ( e.getKeyCode() == KeyEvent.VK_UP)
row--;
if ( e.getKeyCode() == KeyEvent.VK_DOWN)
row++;
if (col == tablemodel.getColumnCount())
row++;
if (row == tablemodel.getRowCount())
row=0;
col=0;
stopCellEditing();
table.editCellAt(row,col);
table.transferFocus();
} else
super.processKeyEvent(e);
m_textArea.setLineWrap (true);
m_textArea.setWrapStyleWord (true);
m_scroll = new JScrollPane (m_textArea,
//JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.VERTICAL_SCROLLBAR_NEVER,
//JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
public Component
getTableCellEditorComponent
(JTable table,
Object value,
boolean
isSelected,
int nRow, int nCol)
//m_textArea.setBackground(table.getBackground());
m_textArea.setBackground(Color.green);
//m_textArea.setForeground(table.getForeground());
m_textArea.setForeground(Color.black);
m_textArea.setFont (table.getFont());
m_textArea.setText (value == null ? "" : value.toString());
return m_scroll;
public Object getCellEditorValue ()
return m_textArea.getText ();
JTextArea getCellEditor ()
return m_textArea;
public boolean isCellEditable (EventObject anEvent)
if (anEvent instanceof MouseEvent)
int click = ((MouseEvent) anEvent).getClickCount();
return click >= CLICK_COUNT_TO_EDIT;
return true;
} //class text area cell editor
class TrunkData
public String m_sysname;
public String m_clli;
public String m_tg;
public Integer m_member;
public String m_trunk_type;
public String m_lata;
public String m_lata_name;
public String m_prospect_server;
public String m_tgroupid;
public String m_ctg;
public Integer m_augmen;
public String m_vendor;
public TrunkData ()
m_sysname = "";
m_clli = "";
m_tg = "";
m_member = new Integer (0);
m_trunk_type = "";
m_lata = "";
m_lata_name = "";
m_prospect_server = "";
m_tgroupid = "";
m_ctg = "";
m_augmen = new Integer(0);
m_vendor = "";
public
TrunkData
(String sys,
String clli,
String tg,
String member,
String ttyp,
String lata,
String latanm,
String pserver,
String tgrpid,
String ctg,
String aug,
String vend)
m_sysname = sys;
m_clli = clli;
m_tg = tg;
try {
if (member.trim().equals(""))
m_member=new Integer(0);
else
m_member = new Integer(member.trim());
} catch (Exception e) {
System.out.println("can't parse member " + e.toString());
m_trunk_type = ttyp;
m_lata = lata;
m_lata_name = latanm;
m_prospect_server = pserver;
m_tgroupid = tgrpid;
m_ctg = ctg;
if (aug.trim().equals(""))
m_augmen=new Integer(0);
else m_augmen=new Integer(aug.trim());
m_vendor = vend;
} //class trunkd data
class ColumnData
public String m_tolatLbl;
int m_width;
int m_alignment;
public ColumnData (String title, int width, int alignment)
m_tolatLbl = title;
m_width = width;
m_alignment = alignment;
} //class column data
class TrunkReportData extends AbstractTableModel
public static ImageIcon COLUMN_UP;
public static ImageIcon COLUMN_DOWN;
public int m_sortCol = 0;
public boolean m_sortAsc = true;
public static final ColumnData m_columns[] =
new ColumnData ("System", 200, JLabel.LEFT),
new ColumnData ("CLLI", 200, JLabel.LEFT),
new ColumnData ("Trunk Group", 200, JLabel.LEFT),
new ColumnData ("Members", 200, JLabel.LEFT),
new ColumnData ("Trunk Type", 200, JLabel.LEFT),
new ColumnData ("LATA ", 200, JLabel.LEFT),
new ColumnData ("LATA Name", 200, JLabel.LEFT),
new ColumnData ("Prospect Server", 200, JLabel.LEFT),
new ColumnData ("Trunk Group ID", 200, JLabel.LEFT),
new ColumnData ("CTG", 200, JLabel.LEFT),
new ColumnData ("Augments", 200, JLabel.LEFT),
new ColumnData ("Vendor", 200, JLabel.LEFT)
protected trnk m_parent;
protected Vector m_vector;
public TrunkReportData (trnk parent , Image imgup, Image imgdown)
this.COLUMN_UP=new ImageIcon(imgup);
this.COLUMN_DOWN=new ImageIcon(imgdown);
m_parent = parent;
m_vector = new Vector ();
setDefaultData (parent.is);
public void setDefaultData (InputStream is)
m_vector = new Vector ();
int numFields = 0;
try
BufferedReader
br =new BufferedReader(new InputStreamReader(is));
String inline ="";
while ((inline = br.readLine()) != null)
if (inline.indexOf('#') > -1)
continue;
StringTokenizer st = new StringTokenizer (inline, ",");
String nsys=st.nextToken ().trim(); //sys
String nclli= st.nextToken().trim() ; // clli
String ntg= st.nextToken ().trim(); // tg
String nmemb= st.nextToken().trim(); // members
String nttyp= st.nextToken ().trim(); // trunktype
String nlata= st.nextToken ().trim(); // lata
String nlataname= st.nextToken ().trim(); // lata name
String npros= st.nextToken ().trim(); // prospect server
String ntgrpid=st.nextToken().trim(); //tgroupid
String nctg=st.nextToken().trim(); //ctg
String naug=st.nextToken().trim(); //augments
String nvend=st.nextToken().trim(); //vendor
m_vector.addElement(new TrunkData(nsys,nclli, ntg,
nmemb, nttyp, nlata, nlataname, npros, ntgrpid, nctg,
naug,nvend));
br.close ();}
catch (Exception e)
System.out.println("Error in file reader 2 "+ e.toString ());
sortData();
public Icon getColumnIcon(int column) { // NEW
if (column==m_sortCol)
return m_sortAsc ? COLUMN_UP : COLUMN_DOWN;
return null;
// NEW
public void sortData() {
Collections.sort(m_vector, new
TrunkComparator(m_sortCol, m_sortAsc));
public int getRowCount ()
return m_vector == null ? 0 : m_vector.size ();
public int getColumnCount ()
return m_columns.length;
public String getColumnName(int nCol)
return m_columns[nCol]. m_tolatLbl;
public boolean isCellEditable
(int nRow, int nCol)
return true;
public Object getValueAt (int nRow, int nCol)
if (nRow < 0 || nRow >=getRowCount())
return "";
TrunkData row = (TrunkData) m_vector.elementAt(nRow);
switch (nCol)
case 0:
return row.m_sysname;
case 1:
return row.m_clli;
case 2:
return row.m_tg;
case 3:
return row.m_member;
case 4:
return row.m_trunk_type;
case 5:
return row.m_lata;
case 6:
return row.m_lata_name;
case 7:
return row.m_prospect_server;
case 8:
return row.m_tgroupid;
case 9:
return row.m_ctg;
case 10:
return row.m_augmen;
case 11:
return row.m_vendor;
return "";
public void setValueAt (Object value, int nRow, int nCol)
if (nRow < 0
|| nRow >=
getRowCount
|| value ==
null)
return;
System.out.println("setting nrow=" + nRow + " nCol=" + nCol + " to value=" + (String) value);
TrunkData row = (TrunkData) m_vector.elementAt (nRow);
String svalue = value.toString ();
switch (nCol)
case 0:
row.m_sysname = svalue; break;
case 1:
row.m_clli = svalue; break;
case 2:
row.m_tg = svalue; break;
case 3:
if (svalue.trim().equals(""))
row.m_member=new Integer(0);
else
try {
row.m_member = new Integer(svalue.trim());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog( null, "Please enter integer valuesonly.", "Error", JOptionPane.ERROR_MESSAGE);
break;
case 4:
row.m_trunk_type = svalue; break;
case 5:
row.m_lata = svalue; break;
case 6:
row.m_lata_name = svalue; break;
case 7:
row.m_prospect_server = svalue; break;
case 8:
row.m_tgroupid = svalue; break;
case 9:
row.m_ctg = svalue; break;
case 10:
if (svalue.trim().equals("")) {
row.m_augmen = new Integer(0);
} else {
try {
row.m_augmen = new Integer(svalue.trim());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog( null, "Error", "Please enter only integer values.", JOptionPane.ERROR_MESSAGE);
break;
case 11:
row.m_vendor = svalue; break;}
fireTableCellUpdated(nRow,nCol);
public void insert (int nRow)
if (nRow < 0)
nRow = 0;
if (nRow > m_vector.size ())
nRow =
m_vector. size ();
m_vector.insertElementAt
(new
TrunkData (),
nRow);
public boolean delete (int nRow)
if (nRow < 0
|| nRow >=
m_vector.size
())return
false;
m_vector.remove (nRow);
return true;
public String getTitle() {
return "Verizon Trunk Table";
} //class trunk report data
class TrunkComparator implements Comparator {
protected int m_sortCol;
protected boolean m_sortAsc;
public TrunkComparator(int sortCol, boolean sortAsc) {
m_sortCol = sortCol;
m_sortAsc = sortAsc;
public int compare(Object o1, Object o2)
if (!(o1 instanceof TrunkData) || !(o2 instanceof TrunkData))
return 0;
TrunkData s1=(TrunkData)o1;
TrunkData s2=(TrunkData)o2;
int result=0;
String str1="", str2="";
int i1=0, i2=0;
switch(m_sortCol) {
case 0: //sysname
str1=(String)s1.m_sysname;
str2=(String)s2.m_sysname;
result=str1.compareTo(str2);
break;
case 1: // clli
str1=(String)s1.m_clli;
str2=(String)s2.m_clli;
result=str1.compareTo(str2);
break;
case 2: //TG
str1=(String)s1.m_tg;
str2=(String)s2.m_tg;
result=str1.compareTo(str2);
break;
case 3: //member
i1 =s1.m_member.intValue();
i2 =s2.m_member.intValue();
result = i1 < i2 ? -1 : (i1 > i2 ? 1 : 0);
break;
case 4: //trunk type
str1=(String)s1.m_trunk_type;
str2=(String)s2.m_trunk_type;
result=str1.compareTo(str2);
break;
case 5: //lata
str1=(String)s1.m_lata;
str2=(String)s2.m_lata;
result=str1.compareTo(str2);
break;
case 6: //lata name
str1=(String)s1.m_lata_name;
str2=(String)s2.m_lata_name;
result=str1.compareTo(str2);
break;
case 7: //prospect server
str1=(String)s1.m_prospect_server;
str2=(String)s2.m_prospect_server;
result=str1.compareTo(str2);
break;
case 8: //tgroup id
str1=(String)s1.m_tgroupid;
str2=(String)s2.m_tgroupid;
result=str1.compareTo(str2);
break;
case 9: //ctg
str1=(String)s1.m_ctg;
str2=(String)s2.m_ctg;
result=str1.compareTo(str2);
break;
case 10: //augments
i1 =s1.m_augmen.intValue();
i2 =s2.m_augmen.intValue();
result = i1 < i2 ? -1 : (i1 > i2 ? 1 : 0);
break;
case 11: //vendor
str1=(String)s1.m_vendor;
str2=(String)s2.m_vendor;
result=str1.compareTo(str2);
break;
if (!m_sortAsc) result = -result;
return result;
public boolean equals(Object obj) {
if (obj instanceof TrunkComparator) {
TrunkComparator compObj=(TrunkComparator) obj;
return (compObj.m_sortCol == m_sortCol) &&
(compObj.m_sortAsc==m_sortAsc);
return false;
} //class trunk comparatorProblem resolved by modifying the code to this:
bt.setToolTipText("Delete Row");
bt.setRequestFocusEnabled(false);
lst = new ActionListener () {
public void actionPerformed (ActionEvent e) {
int nRow = m_table.getSelectedRow();
if (nRow < 0)
JOptionPane.showMessageDialog( null, "Please select a row to delete", "Error", JOptionPane.ERROR_MESSAGE);
else if (JOptionPane.showConfirmDialog(null, "Do you want to delete the selected row?", "Delete a Row", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
m_table.getCellEditor().stopCellEditing();
if (m_data.delete (nRow)) {
m_table.tableChanged (new TableModelEvent (m_data, nRow, nRow, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE)); //m_table.clearSelection();
}; -
How to get the Interface inserted rows fom ODI Reporsitory
hi,
I need select query that will select the Interface inserted rows
(Count) from ODI repository tables. because I want to maintain these records into another Oracle tables?????import datetime
import sys
import optparse
document = []
def docprint(string):
document.append('%s' % string)n
def docprintnocr(string):
document.append('%s' % string)
p = optparse.OptionParser()
p.add_option('-a','--server',dest='server',default='XXX',help='The server with the ODI_W catalog')
p.add_option('-b','--beginningday',dest='beginningday',type=int,default=1,help='The day to begin retrieval')
p.add_option('-e','--endingday',dest='endingday',type=int,default=0,help='The day to end retrieval')
p.add_option('-n','--session',dest='session',default='',help='Session to retrieve')
p.add_option('-s','--step',dest='step',action='store_true',help='Print the step data')
p.add_option('-t','--task',dest='task',action='store_true',help='Print the task data')
p.add_option('-x','--recipientlist',dest='recipientlist',default='XXX',help='report recipient(s)')
p.add_option('-y','--mailserver',dest='mailserver',default='XXX',help='mail server')
p.add_option('-z','--mailuser',dest='mailuser',default='XXX',help='mail user')
p.add_option('-p','--printonly',dest='printonly',action='store_true',help='Print, no e-mail')
options,args = p.parse_args()
docprint( '%s %s' \
'\n\tserver=%s' \
'\n\tbeginningday=%s' \
'\n\tendingday=%s' \
'\n\tsession=%s' \
'\n\tstep=%s' \
'\n\ttask=%s' \
'\n\tprintonly=%s'
sys.argv[0]
,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
,options.server
,options.beginningday
,options.endingday
,options.session
,options.step
,options.task
,options.printonly
if options.server.upper() in ('XXX','YYY'):
catalog = 'ODI_W'
elif options.server in ('WWW','ZZZ'):
catalog = 'SNP_W'
else:
print 'Unknown server %s' % options.server
sys.exit(1)
TimeEnd = datetime.datetime.now() - datetime.timedelta(options.endingday)
TimeBegin = datetime.datetime.now() - datetime.timedelta(options.beginningday)
TimeFormat = '%Y-%m-%d %H:%M:%S'
if options.task:
options.step = True
docprint( '\n%s between %s and %s' %(
options.server
,TimeBegin.strftime(TimeFormat)
,TimeEnd.strftime(TimeFormat)
OptionString = ''
if options.session:
OptionString = '\nPrinting session %s' % options.session
else:
OptionString = '\nPrinting all sessions'
if options.step:
OptionString = '%s %s' % (OptionString,'with step detail')
if options.task:
OptionString = '%s %s' % (OptionString, 'and task detail')
docprint(OptionString)
import pyodbc
ConnectString = 'DRIVER={SQL SERVER};SERVER=%s;DATABASE=%s;Trusted_Connection=yes' % (options.server.upper(),catalog)
try:
Connection = pyodbc.connect(ConnectString,autocommit=False)
Cursor = Connection.cursor()
except Exception, e:
raise RuntimeError, '%s %s connect failed\n%s' % (options.server,catalog,e)
SelectSession = """
select
S.SESS_NO
,S.SESS_NAME
,S.SESS_BEG
,S.SESS_END
,coalesce(S.SESS_DUR,0)
,S.SESS_STATUS
,S.CONTEXT_CODE
from SNP_SESSION as S
where S.SESS_BEG between ? and ?
and S.SESS_BEG = (
select max(SESS_BEG)
from SNP_SESSION
where SESS_NAME = S.SESS_NAME)
order by S.SESS_BEG ASC
SelectSessionHistory = """
select Top 3
SESS_NO
,SESS_NAME
,SESS_BEG
,SESS_END
,coalesce(SESS_DUR,0)
,SESS_STATUS
,CONTEXT_CODE
from SNP_SESSION
where SESS_NAME = ?
and SESS_NO <> ?
order by SESS_BEG DESC
SESS_NO = 0
SESS_NAME = 1
SESS_BEG = 2
SESS_END = 3
SESS_DUR = 4
SESS_STATUS = 5
CONTEXT_CODE = 6
SelectStep = """
select
LOG.STEP_BEG
,LOG.STEP_END
,coalesce(LOG.STEP_DUR,0)
,LOG.STEP_STATUS
,coalesce(LOG.NB_ROW,0)
,coalesce(LOG.NB_INS,0)
,coalesce(LOG.NB_UPD,0)
,coalesce(LOG.NB_DEL,0)
,coalesce(LOG.NB_ERR,0)
,STEP.STEP_NAME
,STEP.NNO
from SNP_STEP_LOG LOG
inner join SNP_SESS_STEP STEP
on STEP.SESS_NO = LOG.SESS_NO
and STEP.NNO = LOG.NNO
WHERE LOG.SESS_NO = ?
ORDER BY STEP.NNO
STEP_BEG = 0
STEP_END = 1
STEP_DUR = 2
STEP_STATUS = 3
NB_ROW = 4
NB_INS = 5
NB_UPD = 6
NB_DEL = 7
NB_ERR = 8
STEP_NAME = 9
STEP_NO = 10
SelectTask = """
select
LOG.TASK_BEG
,LOG.TASK_END
,coalesce(LOG.TASK_DUR,0)
,LOG.TASK_STATUS
,coalesce(LOG.NB_ROW,0)
,coalesce(LOG.NB_INS,0)
,coalesce(LOG.NB_UPD,0)
,coalesce(LOG.NB_DEL,0)
,coalesce(LOG.NB_ERR,0)
,TASK.TASK_NAME3
from SNP_SESS_TASK_LOG LOG
inner join SNP_SESS_TASK TASK
on TASK.SESS_NO = LOG.SESS_NO
and TASK.NNO = LOG.NNO
and TASK.SCEN_TASK_NO = LOG.SCEN_TASK_NO
WHERE LOG.SESS_NO = ?
AND LOG.NNO = ?
ORDER BY LOG.SCEN_TASK_NO
TASK_BEG = 0
TASK_END = 1
TASK_DUR = 2
TASK_STATUS = 3
TASK_ROW = 4
TASK_INS = 5
TASK_UPD = 6
TASK_DEL = 7
TASK_ERR = 8
TASK_NAME = 9
SessionStatuses = {'M':'Warning','E':'Err','D':'Done','R':'Run'}
StepStatuses = {'M':'Warn','E':'Err','D':'Done','W':'Wait','R':'Run'}
SessionRows =Cursor.execute(SelectSession,(TimeBegin,TimeEnd)).fetchall()
for SessionRow in SessionRows:
if options.session and options.session.upper() != SessionRow[SESS_NAME].upper():
# Not requested
continue
if SessionRow[SESS_NAME] in ('SOCKETSERVER','PROCESSHUB'):
# Skip these utilities
continue
if SessionRow[SESS_STATUS] == 'R':
# Still running, nothing to print(
docprint( '\n%s, status %s' % (
SessionRow[SESS_NAME]
,SessionStatuses[SessionRow[SESS_STATUS]]
continue
if SessionRow[SESS_END]:
SessionEnd = SessionRow[SESS_END].strftime(TimeFormat)
else:
SessionEnd = ' '
SessionHistories = Cursor.execute(SelectSessionHistory,(SessionRow[SESS_NAME],SessionRow[SESS_NO])).fetchall()
docprintnocr( '\n%-20s\n\t%s / %s %6i secs %s' % (
SessionRow[SESS_NAME][:20]
,SessionRow[SESS_BEG].strftime(TimeFormat)
,SessionEnd
,SessionRow[SESS_DUR]
,SessionStatuses[SessionRow[SESS_STATUS]]
for SessionHistory in SessionHistories:
if SessionHistory[SESS_END]:
SessionHistoryEnd = SessionHistory[SESS_END].strftime(TimeFormat)
else:
SessionHistoryEnd = ' '
docprintnocr( '\t%s / %s %6i secs %s' % (
SessionHistory[SESS_BEG].strftime(TimeFormat)
,SessionHistoryEnd
,SessionHistory[SESS_DUR]
,SessionStatuses[SessionHistory[SESS_STATUS]]
if not options.step:
# Step detail not requested
continue
docprint( '\n %-22s %5s %4s %8s %8s %8s %8s %8s' % (
,'Secs'
,'Stat'
,'Rows'
,'Inserts'
,'Updates'
,'Deletes'
,'Errors'
for StepRow in Cursor.execute(SelectStep,SessionRow[SESS_NO]).fetchall():
try:
docprint( ' %-22s %5i %-4s %8i %8i %8i %8i %8i' % (
StepRow[STEP_NAME][:22]
,StepRow[STEP_DUR]
,StepStatuses[StepRow[STEP_STATUS]]
,StepRow[NB_ROW]
,StepRow[NB_INS]
,StepRow[NB_UPD]
,StepRow[NB_DEL]
,StepRow[NB_ERR]))
except Exception, e:
docprint(e)
continue
if not options.task:
# Task detail not requested
continue
try:
for TaskRow in Cursor.execute(SelectTask,(SessionRow[SESS_NO],StepRow[STEP_NO])).fetchall():
docprint( ' %-21s %5i %-4s %8i %8i %8i %8i %8i' % (
TaskRow[TASK_NAME][:21]
,TaskRow[TASK_DUR]
,TaskRow[TASK_STATUS]
,TaskRow[TASK_ROW]
,TaskRow[TASK_INS]
,TaskRow[TASK_UPD]
,TaskRow[TASK_DEL]
,TaskRow[TASK_ERR]
except Exception, e:
docprint( e )
docprint( '\nEnd of report')
Connection.close()
if options.printonly:
for line in document:
print line
sys.exit(0)
import smtplib
Message = """From: %s
To: %s
MIME-Version: 1.0
Content-type: text/html
Subject: %s
<font face="courier" size="4"><b>%s</b></font>
options.mailuser
,options.recipientlist
,'Session Report'
,'<br>'.join(document).replace('\n','<br>').replace('\t',' ').replace(' ',' ')
server = smtplib.SMTP(options.mailserver)
server.sendmail(options.mailuser,options.recipientlist,Message)
server.quit() -
Multi Row Delete and then I get a unique contraint violation on my PK
I have a simple table with 2 columns, one a PK. I have a checkbox style, multi-row delete function setup on this (to be honest, APEX set this up automatically).
I removed the add/edit functionality to keep just the delete button and delete procedure.
When I select an item, and then click delete, I get a unique constraint violation that I'm violating my Primary Key.
How can I fix this, or see what it's doing when it tries to delete the row?Hi,
It sounds as though you haven't properly removed all of the add/edit functionality or that you still have some form of validation and/or computation in place or that you have a trigger that is trying to insert records into, for example, a history table (is the constraint on the table you are deleting from - the error message should tell you this?)
Check that the only process you have is ApplyMRD and that this is pointing to the correct table and has the correct primary key set. Ensure that this has Conditional Processing set for a Request of "MULTI_ROW_DELETE".
Check for any validations - there is no need to perform validations if your user can not insert or update data unless you want to check that they've ticked one or more checkboxes.
Check for processes that could run if the user clicks the Delete button. Validations and processes could be conditional on either the button click or on request = "MULTI_ROW_DELETE".
Review any triggers that you have on the table to ensure that deletions do not try to insert records into another table where the primary key on that table is not being populated.
Regards
Andy -
Database got halted while inserting rows
I have a 9i database running on solaris not restarted for 15 days.It just got halted or hanged while inserting rows in a table.When restarted everything is just fine and those rows have been inserted in no time!!What might be the reason?Dont tell me 'lock' because I have already checked for ora:60 error in alertlog.Would you please give some direction to drill it down .
Did you met the problem , only when you inserting the rows ? Or is there something else which leads this situation ? most of the occasion when
you found your database halt is because of your archivelogs . I would
still like to know if you running your db in archivelog mode ? It also be the
case that you set archive_log_start = true in the pfile and diden't fire
alter database archivelog at the sql prompt .
Hare Krishna
Alok
Maybe you are looking for
-
Dear all, we have to cover the following scenario: an order is sold to a customer belonging to a Sales Area from a plant that doesn't belong to the company of the sales area of the order. In this case the standard support the creation of the interco
-
Creating Gutter with Boris Title Crawl
Hello all! I'm doing the end credits for a DV project and as we all know Boris is better than Final Cut's text generators. Just wondering if there's a feature in Boris a la the * in FCP's Scrolling Text generator. You know, to line up those gaps. I'v
-
How can i unlock items in EP?
Hi there.. I have this problem, when i create a Role. After creating it, i cannot change the properties of the Role cant be modify ... And they will Lock my file and i cant do anything to it.. Does anyone have this probs and the solution to it ?? Th
-
N8 Video Player and Photo Viewer not working prop...
Hi I just got a N8 a few months ago and its been going great until a month ago. My video player is not displaying any the videos that I had on the phone or any of the videos I try putting on after. I then tried the photo viewer (it displays video as
-
I need to know if free account holders will be able to collaborate on forms that have been shared
I need to know if free account holders will be able to collaborate on forms that have been shared with them and if there will be an Enterprise version available for Adobe Formcentral.