Problem in UPDATE statement In Multiple Record Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count 0 THEN
LOOP
IF :SYSTEM.last_record 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advence
As you do a loop over all the records in the block, of course every record is updated.
Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not.
Similar Messages
-
Problem In Update Statement In Multiple Record Data Block
Hi Friends,
I have problem in update Statement for updating the record in multiple record data Block.
I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
I am inserting the fields like category,and post_no for partiular job in single data block
Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
then its updating all the record.
my code is Bellow,
IF v_count <> 0 THEN
LOOP
IF :SYSTEM.last_record <> 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
next_record;
ELSIF :SYSTEM.last_record = 'TRUE' THEN
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
IF SQL%NOTFOUND THEN
INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
:POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
END IF;
EXIT;
END IF;
END LOOP;
SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
v_button_no := SHOW_ALERT('user_alert');
FORMS_DDL('COMMIT');
CLEAR_FORM(no_validate);
Please Guide me
Thanks in advenceUPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;
UPDATE post_history
SET idcode = :POST_HISTORY_MULTIPLE.idcode,
joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
WHERE post_no = :POST_HISTORY_SINGLE.post_no
AND category = :POST_HISTORY_SINGLE.category
AND roster_no = :POST_HISTORY_SINGLE.roster_no;
AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
If it is specific to oracle forms then u may get better help at Forms section. -
Update statement for multiple records
i have table a and table b
common col in both the tables is emp_id
in table b i have district_id
which i want to update in table a.... column district_id for all the employees
how to write update statement for this
Edited by: user10873676 on Oct 17, 2011 8:00 AMBased on your current description, we have something like this...
SQL> create table a (emp_id number)
2 /
Table created.
SQL>
SQL> create table b (emp_id number, district_id number)
2 /
Table created.
SQL>
SQL> insert into a (emp_id)
2 select rownum from dual connect by rownum <= 10
3 /
10 rows created.
SQL>
SQL> insert into b (emp_id, district_id)
2 select rownum, 10-rownum from dual connect by rownum <= 10
3 /
10 rows created.
SQL>
SQL> update b
2 set district_id = 1
3 /
10 rows updated.
SQL>
SQL> select * from a;
EMP_ID
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> select * from b;
EMP_ID DISTRICT_ID
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
10 rows selected.Which I'm sure is NOT what you want as the update on table b has nothing to do with table a, and we have no idea what the district_id should be updated with. -
Hi,
i want to sort a multiple record block by pressing a key on a non updatable field in the block.
Example:
i have a list of adresses in the block. Now i want to jump to all Adresses which starts with B.
Does anybody know a solution ?
Thanks in advance. MMNo problem:
When your records are ordered by the name (using block's order-by-clause),
use a procedure like the following:
procedure find_name(p_letter in varchar2) is
begin
go_block('BLOCK');
loop
exit when :system.last_record = 'TRUE' or :block.name >= p_letter;
next_record;
end loop;
end; -
I got some problem in update statement.Can anybody discuss with me regarding my problem? Below is the occured problem.
//all the declaration like Connection, ResultSet are declared, setting the ODBC path and so on steps have been set up before this method. When compile it, no error, when I start to run my program, the program�s interface is shown, but the following error was appearred and data cannot be updated, can anybody tell me where is my mistake?
//ERROR:SQL Error in update statement:java.sql.SQLException [Microsoft][ODBC][ODBC Microsoft Access Driver] Syntax Error in UPDATE statement.
//emp_overview is the table name
// last_name, first_name, office_phone�.is the attributes of the table
//this method had declare in the interface class already
public String updateData (String idd, String ln, String fn, String op,
String oe, String hp, String ps, String ss)
throws java.rmi.RemoteException
{//begin of this method
String result ="";
try
Statement statement = connection.createStatement();
String sql = "UPDATE emp_overview SET" +
"last_name=' "+ln+
" ', first_name=' "+fn+
" ', office_phone=' "+op+
" ', office_ext=' "+oe+
" ', home_phone=' "+hp+
" ', primary_skill=' "+ps+
" ', secondary_skill=' "+ss+
" ' WHERE id="+idd;
statement.executeUpdate(sql);
statement.close();
catch (java.sql.SQLException e)
System.out.println("SQL Error in update statement: "+e);
//throw a RemoteException with the exception
//embedded for the client to receive
throw new java.rmi.RemoteException("Error in Updating exist row into DB", e);
return result;
}//end of this methodHi Kevin,
According to the code you have posted, it looks like you are missing a space between "SET" and "last_name". I suggest you add the following line of code:
System.out.println(sql);
before the invocation of "executeUpdate()".
I also suggest you add the following line of code:
e.printStackTrace();in your "catch" block.
Hope this helps.
Good Luck,
Avi. -
Problem in Update statement using Execute Immediate
Hi All,
I am facing problem in update statement.
I am creating dynamic sql and use "execute immediate" statement to execute a update statement.
But it is not updating any thing there in the table.
I have created a query like :
update_query='Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
Execute immediate update_query using V_Id;
commit;
But it is not updating the table.
I have a question , is execute immediate only does insert and delete?
Thanks
AshokSQL> select * from t;
TID P
101 N
SQL> declare
2 V_Id number := 101;
3 Table_Name varchar2(30) := 'T';
4 update_query varchar2(1000);
5 begin
6 update_query := 'Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
7 Execute immediate update_query using V_Id;
8 commit;
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> select * from t;
TID P
101 Y -
Update Statement Duplicates the record
Hi guys.
I have created a form to update some null fields in a table.
the update statement updates the fields and at the same time it duplicates the updated data in new record.
my update statement is
update
REQ_TRANSACTION set
PAYMENT_METHOD =:PAYMENT_METHOD,
PAID_THROUGH =:PAID_THROUGH,
REMARKS =:REMARKS,
CHEQUE_NO =:CHEQUE_NO,
TRAN_NO =:TRAN_NO,
PAID_AMOUNT =:PAID_AMOUNT,
PAY_DATE =:PAY_DATE
where
req_no = :req_no;
COMMIT_FORM;
plz help
Edited by: Mohammed on Nov 12, 2011 3:15 AMBe aware that what you do is nt the preferred way to work with forms. The best way would be to make your block a database block based on your table, put something in the WHERE-clause and populate the block using an EXECUTE_QUERY. then, do update changed data in the block, just issue an COMMIT_FORM, the update itself will be done by forms .
-
Need help to solve update querry for multiple records.
Could any of you please provide update querry for the following scenario.
Requiremnt:
1. Update the UNIQUE_ID of record ( same Identifier and Identifier_code
where END_Date is not null) with the UNIQUE_ID of the record (( same Identifier and Identifier_code
where END_Date is null).
2. If More than one NULL in END_date then update UNIQUE_ID with max(EFFective_Date) of UNIQUE_ID
Source data
UNIQUE_ID
Identifier
Identifier_code
EFFective_Date
END_Date
1
777
abc
2/14/2014 11:15
2/28/2014 9:00
1
777
abc
2/21/2014 9:00
3/7/2014 9:02
2
777
abc
2/28/2014 9:00
3/14/2014 9:02
2
777
abc
3/7/2014 9:02
3/14/2014 9:02
2
777
abc
3/14/2014 9:02
NULL
5
888
xyz
2/14/2014 11:15
2/28/2014 9:00
5
888
xyz
2/21/2014 9:00
3/7/2014 9:02
5
888
xyz
2/28/2014 9:00
3/14/2014 9:02
6
888
xyz
3/7/2014 9:02
NULL
7
888
xyz
3/14/2014 9:02
NULL
OutPUT .
UNIQUE_ID
Identifier
Identifier_code
EFFective_Date
END_Date
2
777
abc
2/14/2014 11:15
2/28/2014 9:00
2
777
abc
2/21/2014 9:00
3/7/2014 9:02
2
777
abc
2/28/2014 9:00
3/14/2014 9:02
2
777
abc
3/7/2014 9:02
3/14/2014 9:02
2
777
abc
3/14/2014 9:02
NULL
7
888
xyz
2/14/2014 11:15
2/28/2014 9:00
7
888
xyz
2/21/2014 9:00
3/7/2014 9:02
7
888
xyz
2/28/2014 9:00
3/14/2014 9:02
7
888
xyz
3/7/2014 9:02
NULL
7
888
xyz
3/14/2014 9:02
NULL
Thanks in advance.Hi Vikash,
This query will not produce results as per requirement:
Try it with following data
Insert into @TempTABLE values (1,777,'abc','2/14/2014 11:15','3/14/2014 9:02')
Insert into @TempTABLE values (1,777,'abc','2/21/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','2/28/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','3/7/2014 9:02','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','3/14/2014 9:02',NULL)
Insert into @TempTABLE values (5,888,'xyz','2/14/2014 11:15','3/14/2014 9:02')
Insert into @TempTABLE values (5,888,'xyz','2/21/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (5,888,'xyz','2/28/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (7,888,'xyz','3/7/2014 9:02',NULL)
Insert into @TempTABLE values (6,888,'xyz','3/14/2014 9:02',NULL)
as per the problem statement, all records having 888,'xyz' should be updated with 6 not 7 as max effective date is associated with 6 not 7.
Ashutosh
Nope.
can you check the original post first. It clearly states output as having 7 as id for all the records with 888,xyz
also your above posted sample data is different from original sample data as you've dates jumpled up for the records with ids 6 and 7
Please see the illustration for original sample data
--sample table for illustration
declare @t table
(UNIQUE_ID int,Identifier int,Identifier_code varchar(100),EFFective_Date datetime ,END_Date datetime)
--populate original sample data
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E70094DD60 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (6, 888, N'xyz', CAST(0x0000A2E70094DD60 AS DateTime), NULL)
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (7, 888, N'xyz', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
--do the update
UPDATE t
SET UNIQUE_ID = MaxID
FROM
SELECT MAX(CASE WHEN END_DATE IS NULL THEN UNIQUE_ID END) OVER (PARTITION BY Identifier,Identifier_code) AS MaxID,UNIQUE_ID
FROM @t
)t
WHERE UNIQUE_ID <> MaxID
AND MaxID IS NOT NULL
--now check the output
SELECT * FROM @t
The output is as below
UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
2 777 abc 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
2 777 abc 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
2 777 abc 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
2 777 abc 2014-03-07 09:02:00.000 2014-03-14 09:02:00.000
2 777 abc 2014-03-14 09:02:00.000 NULL
7 888 xyz 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
7 888 xyz 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
7 888 xyz 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
7 888 xyz 2014-03-07 09:02:00.000 NULL
7 888 xyz 2014-03-14 09:02:00.000 NULL
Now compare it with original output and you'll find they're the same
UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
2 777 abc 2/14/2014 11:15 2/28/2014 9:00
2 777 abc 2/21/2014 9:00 3/7/2014 9:02
2 777 abc 2/28/2014 9:00 3/14/2014 9:02
2 777 abc 3/7/2014 9:02 3/14/2014 9:02
2 777 abc 3/14/2014 9:02 NULL
7 888 xyz 2/14/2014 11:15 2/28/2014 9:00
7 888 xyz 2/21/2014 9:00 3/7/2014 9:02
7 888 xyz 2/28/2014 9:00 3/14/2014 9:02
7 888 xyz 3/7/2014 9:02 NULL
7 888 xyz 3/14/2014 9:02 NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Updating status of multiple records after saving the form
Hi all
I have a tabular form
It has a column status (new,good ,very good ,excellent are the list options)
The user goes and modifies a number of records on the detail block and saves the records
what i want to do is that when the user clicks the save button after updating any number of records
the status field should be updated with the value (new)
the status field of those records should be updated with the new value which the user has modified not all the records
Please let me know how to go about it
thanks
Edited by: bindok mulga on May 11, 2009 3:48 PM
Edited by: bindok mulga on May 11, 2009 3:50 PMHi
actually my earlier post was incorrect
i have edited my post
Actually
i want to update only those records that the user has modified
eg
col1 col2 status
1 ABC good
2 PQR good
3 xyz good
4 lmn excellent
5 abcz excellent
is the table before the user modifies
the user goes and modifies multiple records as following
col1 col2 status
1 aaa good
2 PQR good
3 xxx good
4 sss excellent
5 abcz excellent
and the user saves the form
now i want the following output
col1 col2 status
1 aaa new
2 PQR good
3 xxx new
4 sss new
5 abcz excellent
only the modified record's status should be updated
sorry for the earlier lapse -
Updation/insertion of multiple records simultaneously using check box
Hi,
I am using Jdev11.1.1.2.0 version. I have the following scenario.
There is a table in the view.At run time, I need to select multiple records and update those records in the database. So i took check Box as a column in the table.*(I did not associate check box to any of the attributes (columns) in the table.)* After running the application, I selected multiple records using checkbox and submitting them. The check box is returning value as 'false' even for the selected records also instead of 'true'. Because of this we are facing the issue in updating only the selected records. Please suggest your valuable inputs.
I have written the following code in the backing bean to get the selected rows.
BindingContainer bindings =BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcIter= (DCIteratorBinding) bindings.get("PttDeliverabvleTrackerEOView2Iterator");
RowSetIterator depRSIter = dcIter.getRowSetIterator();
depRSIter.setRangeSize(depRSIter.getRowCount());
Integer key = depRSIter.getRowCount();
System.out.println("No of rows is "+ key);
int rowIndex =0;
for(int i =0; i<key; i++){
PttDeliverabvleTrackerEOViewRowImpl row = (PttDeliverabvleTrackerEOViewRowImpl) depRSIter.getRowAtRangeIndex(i);
System.out.println("Check box value2 "+ this.getSbc1().isSelected());
if(this.getSbc1().isSelected()){
rowIndex = i;
System.out.println("Row Index: "+ rowIndex);
Please let me know if it is it possible to associate a checkbox to any of the attributes while dragging and dropping the table in the view and update the records?
I tried selecting the option 'Row Selection' while dragging and dropping the table and changed the property RowSelection->multiple. But it is not serving the purpose of updating multiple records.
Please suggest if there is any other solution to update multiple records.
Regards,
Sreelatha.Hi,
if you added checkboxes to a table, then at runtime the checkbox is stamped, which means that a call to this.getSbc1().isSelected() just returns the state of the last checkbox that is rendered. I don't want to go into the details of ADF Faces table rendering here, but point yu to a blog article that does what you are aiming for using ADF BC: http://sameh-nassar.blogspot.com/2009/12/use-checkbox-for-selecting-multiple.html
Frank -
How can I compare values in a multiple records block
I have a form with multiples records whit a date in each record. I need test if the date typed in record 2 is greather than the date on record 1, if the date typed in record 3 is greather than the date on record 1 and so on. How cai I do it???is grather than the date on record 1
Pedro,
Venelin's code works perfectly, but if you try to use it in a When-Validate-Item or When-Validate-Record trigger, it won't work since you can't invoke navigation routines (FIRST_RECORD, NEXT_RECORD) from these two triggers (among others).
First, we have to understand that Forms wasn't built to perform multi-row validations. It's a fact.
Second, the way I prefer to do this is: let the user enter the data as he wants.
When he commits, in a POST-FORMS-COMMIT trigger, you can check the values using SELECT statements, because they are already written to the data tables. If you don't like them, just issue a RAISE FORM_TRIGGER_FAILURE and the transaction gets rollbacked (and the inserts will be undone).
Hope this helps,
Pedro das Neves -
Hi, i have the following data
document_seq_num, Country, LE, SOB
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
i want an update statement for every change in the document sequnce with the other combination..
the seqence number should change.
i tried to write a rank over partion and and sequence but when i am trying to update, this is always updating
90000000 in first run, as it is in loop for all records it is updating the same. i want an
increment to the sequence for every change in document_seq_num
Can any one help me to correct this procedure
create or replace PROCEDURE test is
cursor cur_voc_ref
IS SELECT a.document_seq_num,
a.country, a.LE, a.SOB, 2009, Rank() over (partition by
a.country, a.LE, a.SOB
order by a.document_seq_num, a.country, a.LE, a.SOB)
from (select distinct document_seq_num,
country, LE, SOB,period_name
from temp_tab
where country= 'NL'
and LE= '000320'
and SOB=13
order by SOB,LE,document_seq_num) a
where
a.country= 'NL'
and a.LE= '000320'
and a.SOB=13
and substr(a.period_name,5,6) =substr(2009,3,4);
v_base number;
BEGIN
FOR c_rec IN cur_voc_ref
LOOP
BEGIN
select nvl(max(ggtsi.reference), substr(2009,3,2)*1000000) into v_base
from temp_tab ggtsi;
update temp_tab
set reference= v_base
where document_seq_num= c_rec.document_seq_num
and country=c_rec.country
and le=c_rec.le
and sob=c_rec.sob;
commit;
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'Exception in opening balance insert ' || SQLCODE || ' ' || SQLERRM );
END;user11289444 wrote:
Hi, i have the following data
document_seq_num, Country, LE, SOB
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
i want an update statement for every change in the document sequnce with the other combination..
the seqence number should change.
i tried to write a rank over partion and and sequence but when i am trying to update, this is always updating
90000000 in first run, as it is in loop for all records it is updating the same. i want an
increment to the sequence for every change in document_seq_num
Can any one help me to correct this procedure
create or replace PROCEDURE test is
cursor cur_voc_ref
IS SELECT a.document_seq_num,
a.country, a.LE, a.SOB, 2009, Rank() over (partition by
a.country, a.LE, a.SOB
order by a.document_seq_num, a.country, a.LE, a.SOB)
from (select distinct document_seq_num,
country, LE, SOB,period_name
from temp_tab
where country= 'NL'
and LE= '000320'
and SOB=13
order by SOB,LE,document_seq_num) a
where
a.country= 'NL'
and a.LE= '000320'
and a.SOB=13
and substr(a.period_name,5,6) =substr(2009,3,4);
v_base number;
BEGIN
FOR c_rec IN cur_voc_ref
LOOP
BEGIN
select nvl(max(ggtsi.reference), substr(2009,3,2)*1000000) into v_base
from temp_tab ggtsi;
update temp_tab
set reference= v_base
where document_seq_num= c_rec.document_seq_num
and country=c_rec.country
and le=c_rec.le
and sob=c_rec.sob;
commit;
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'Exception in opening balance insert ' || SQLCODE || ' ' || SQLERRM );
END;Hi,
I suggest you to add a column to preserve current RANK value for all rows, <preserve_rank> for example, and
when you add the new rows you will update your <preserve_rank> but you must pay attention to have the same value for
document_seq_num, with other words you may insert yours rows in a batch like this:
-- first update preserve_rank with RANK function
declare
v_doc_seq_num numeric;
begin
v_doc_seq_num:=33100040;
-- note !!!
-- put all into a valid sql command
-- and apply execute immediate
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
-- update preserve_rank
update temp_tab x set x.preserve_rank = (Select max(preserve_rank) from temp_tab y
where y.document_seq_num=v_doc_seq_num) old_rank + 1)
where (prserve_rank is null) and x.document_seq_num=v_doc_seq_num;
end; I know it's a lost a memory but the trigger is the last solution who can give us a nightmare.
Regards,
Ion
Edited by: user111444777 on Sep 25, 2009 11:12 AM
Edited by: user111444777 on Sep 25, 2009 11:35 AM -
Emergency: problem with update statement!
hello guys, i have a very serious problem with an update statement in pl/sql.
i had an application written in sybase, where i had the following update statement:
update mis_dik_adeia
set trexon_etos_days = days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between :aapo and :aews
and mis_dik_adeia.employee_id = :erg
and mis_dik_adeia.etos = :etos
and mis_plafon_adeivn.years_yphr = ( select max( a.years_yphr ) from mis_plafon_adeivn a where a.adeia_id = mis_plafon_adeivn.adeia_id and a.years_yphr <= :eth ) using sqlca;
This is working properly in sybase. When i copied this code in pl/sql it displayed me error and it's impossible to work. Then i thought to make a nested select statement like this:
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
but as you can understand, it is working, but it doesn't produce the same results as the update statement in Sybase!
It is very important for me to solve this problem , which is a very big trouble for me for a long time.
Please if anyone can help me i would appreciate it a lot!
Regards ,
Bill...Bill,
folowing the logic of your original query by Sybase
(it's embedded SQL in Power Builder, isn't it ?):
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
where
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and
exists (select 1
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
In 9i you can also try the following:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year
when not matched then
insert (mis_dik_adeia.adeia_id) values(0);
In 10G it can be easily:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year;
I have to notice I didn't check it carefully, so I can miss...
Rgds.
Corrected a mistake in the table name
Message was edited by:
dnikiforov -
Master data update bringing in multiple records for single entry
Hello,
I found that if I deleted and reloaded data in a master data object, it was showing me correct number of records. However, just a full update was not overwriting it with correct number of data records. there were always 1 or 2 extra blank records. I thought master data update should overwrite previous records and we need not delete and reload it.
Why would this happen?
Thanks!Hi there,
Are you refering to time dependent master data? From to values are present?
If so, that's the correct situation, since BW (OLAP) instead of R/3 (OLTP) allows you to mantain historical data, i.e., a material can be valid from a specific time period with several attributes and other attributes can be valid for the same material in another time space.
Diogo. -
Problem regarding Update-Statement on se11 table
Hello I tried to update a dataset in a se11 table using UPDATE Statement.
It doesn't work and I get a sy-subrc = 4.
That is my code:
TABLES ZTDM_SAPOUTPUT.
* Arbeitsbereich definieren
DATA:
wa_ZTDM_SAPOUTPUT LIKE ZTDM_SAPOUTPUT.
wa_ZTDM_SAPOUTPUT-PK = '1'.
wa_ZTDM_SAPOUTPUT-FNCODE = '3'.
wa_ZTDM_SAPOUTPUT-MATNR = '3'.
wa_ZTDM_SAPOUTPUT-MAKTX = '3'.
wa_ZTDM_SAPOUTPUT-ZEINR = '3'.
wa_ZTDM_SAPOUTPUT-MATKL = '3'.
wa_ZTDM_SAPOUTPUT-STATE = '1'.
UPDATE ZTDM_SAPOUTPUT FROM wa_ZTDM_SAPOUTPUT.
Write: 'UPDATE returned' , sy-subrc.
SKIP.
The given Dataset having PK=1 doesn't get updated.
Maybe my understanding is wrong:
Is it correct that the updated dataset ist defined by the primary key in this workingarea?
My Primary Key is PK.
Can you see the error?UPDATE dbtab FROM wa. or
UPDATE (dbtabname) FROM wa.
Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs.
If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab.
Example
Changing the telephone number of the customer with customer number '12400177' in the current client:
DATA wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '12400177'.
wa-telephone = '06201/44889'.
UPDATE scustom FROM wa.
When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
Examples
Update discount for the customer with the customer number '00017777' to 3 percent (in the current client):
DATA: wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '00017777'.
wa-discount = '003'.
UPDATE scustom FROM wa.
The Return Code is set as follows:
SY-SUBRC = 0:
The specified line has been updated.
SY-SUBRC = 4:
The system could not update any line in the table, since there is no line with the specified primary key.
rwrd if helpful
bhupal
Maybe you are looking for
-
My daughter has been using my iTunes account to buy music and apps. I now want to set up a separate iTunes account for her, with a different login. How can we transfer the music and apps she has already bought to her new iTunes account?
-
Using Examine Document Remove increases pdf file size !
Hi, I have Adobe Acrobat Pro v9.3.0 I've been editing a lot of scanned .pdfs - rotating and cropping pages. All this has previously worked fine with v8 but now I find that Acrobat 9 is increasing the .pdf file size after using Examine Document and cl
-
IWeb not publishing completely
I've been using iWeb for about a year and never had this problem. The publishing never quite finishes, though the progress circle completes. And I never get the 'Your site has been published' notification. Yet when you go to my site, everything is pu
-
Extended classic scenarion after approval of shopping cart no PO is created
Hi Experts, In extended classic scenario,SC approved and No po created in SRM 5.0 when I check in BBP_PD status is completed and RZ20 shopping cart basket link all green and purchase order link red - Error in local purchase order. No update of refere
-
Time Machine reconnect old sparsebundle
I encountered a problem with a corrupt sparsebundle (I use TimeMachine with my Synology NAS) and Time Machine creating a new sparsebundle, not using the my good old sparsebundle with all my previous backups. Maybe there are people with the same probl