Need to update corresponding columns in details table
Hi,
I have a header and lines table.
In header table we have a comments field, requirement is whenever someone is updating comments in header it should update lines comment column as well.
I tried using fire action on Comments field like as soon as user is entering something in Comments field I am capturing that event and firing and update statement for lines table
but the problem here is, if user enters the comments and doesn't save it at header level it stills fire an update statement in lines and updating the comment field of lines table.
I need to update header comments in lines level at Apply button.
Please someone suggest something.
Best Regards
Ragni Gupta
Hi Gurus/Expert,
Please suggest something, its really urgent!!
Thanks
Ragni Gupta
Similar Messages
-
Need to update multiple columns using another table
I have 2 tables. and i need to update rows of 1 table using another table
Table1
Serial_no. payment_date Payment_amt
101 22/11/2010 150
101 18/03/2011 355
102 15/04/2011 488
103 20/05/2011 178
102 14/06/2011 269
101 28/06/2011 505
Table2
Serial_no Charge_amt Last_paymt_dt Last_paymt_amt
101 255
102 648
103 475
I want to update Last_paymt_dt and Last_paymt_amt of table2 using Table1, I have written following update statement but it gives error that single row subquery return multiple row.
Update Table2
set (Last_paymt_dt,Last_paymt_amt) = (select max(payment_date, payment_amt) from table1
where table1.Serial_no = table2.Serial_no group by payment_amt)
kindly suggest how should i update.SQL> select * from table1
2 /
SERIAL_NO PAYMENT_DA PAYMENT_AMT
101 22/11/2010 150
101 18/03/2011 355
102 15/04/2011 488
103 20/05/2011 178
102 14/06/2011 269
101 28/06/2011 505
6 rows selected.
SQL> select * from table2
2 /
SERIAL_NO CHARGE_AMT LAST_PAYMT LAST_PAYMT_AMT
101 255
102 648
103 475
SQL> update table2
2 set (last_paymt_dt,last_paymt_amt) = (
3 select max(payment_date),
4 max(payment_amt) keep(dense_rank last order by payment_date)
5 from table1
6 where table1.serial_no = table2.serial_no
7 )
8 /
3 rows updated.
SQL> select * from table2
2 /
SERIAL_NO CHARGE_AMT LAST_PAYMT LAST_PAYMT_AMT
101 255 28/06/2011 505
102 648 14/06/2011 269
103 475 20/05/2011 178
SQL> SY. -
Need to update one column of all table in that particular schema
hi all,
i am using db10g.
my task is to update one particular column's value of all the table in that schema.
to acheive the above
do i have to write update statement for each table or is there any way to do it in bulk?
i hope my question make sense.
Thanks..Hi karthick,
I want to know something which is not related to this thread .
How to include formatted post while replying to thread .
I know using will be used format code before posting . But how can we do it for posted message .
I hope you understand my question .
Thanks in advance . -
How to update two columns in two tables?
hi friends
I have two tables linked to each other through SaleNo and SaleDT. their structure as below
Sales Table============
SaleNo int PK auto increment
SaleDT Datetime PK
Qnty decimal
Units decimal
Invoices table
=================InvoiceNo int PK Auto incremented
InvoiceDT Datetime
SaleNo int FK
SaleDT Datetime FK
Note that SaleDT column is NOT assigned with getDate() expression.
1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
thanks
I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!Why not below? May be you will not be able to change your design now, but just want to share.
Sales Table============
SALEID int PK autoincrement
SaleNo int
SaleDT Datetime
Qnty decimal
Units decimalUNIQUE (Saleno,SaleDT)
Invoices table
=================InvoiceNo int PK Auto incremented
InvoiceDT Datetime
SALEID int FK -
Navigation to update a column in the table jtf.jtf_rs_resource_extns
Hi All,
I'm using oracle 11.5.10
Can somebody tell me the frontend form which is related to the table jtf.jtf_rs_resource_extns
I need to update a column in the above table from the frontend.
Please explain me the navigation for doing the same
Regards,
MohanI can't tell you the answer to your query but what I can tell you is that you have logged the thread in a wrong forum. As far as my knowledge goes, this table does not delong to HRMS.
Just check the product in which you are working and then log the thread in the right forum.
Thanks, -
How to update multiple columns from different tables using cursor.
Hi,
i have two tables test1 and test2. i want to udpate the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.
I have a code written as follows :
DECLARE
v_mydept1 TEST1.DEPT_CD%TYPE;
v_mydept2 TEST2.DEPT_CD%TYPE;
CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO v_mydept1,v_mydept2;
EXIT WHEN C1%NOTFOUND;
UPDATE TEST2 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
END LOOP;
COMMIT;
END;
The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].
It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
I am not sure what is the exact problem when we want to update multiple columns of different tables.
Can anyone help me on this ?oops my mistake.....typo mistake...it should have been as follows --
UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
Now here is the upated PL/SQL code where we are trying to update columns of different tables --
DECLARE
v_mydept1 TEST1.DEPT_CD%TYPE;
v_mydept2 TEST2.DEPT_CD%TYPE;
CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO v_mydept1,v_mydept2;
EXIT WHEN C1%NOTFOUND;
UPDATE TEST1 SET DEPT_DSCR = 'PLSQL1' WHERE CURRENT OF C1;
UPDATE TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1;
END LOOP;
COMMIT;
END;
Please let us know why it is not updating by using using CURRENT OF -
Need logic to update Varchar column in a table
Hi,
Could you give me logic for below.
I have a table xx_dbc where one of the column Attribute1 is varchar2(240).
Attribute1 has values like
==================
(AIN,PUP,GRI,NINE)
(AIN,PUP)
(AIN)
(GRI,NINE)
I have to update this column for every record with values AIN=10 , PUP=20 , GRI=30 , NINE=40
Columns should be updated like below
(10,20,30,40)
(10,20)
(10)
(30,40)
Thanks.Hi,
Here's one way:
WITH replacements AS
SELECT 'AIN' AS old_str, '10' AS new_str FROM dual UNION ALL
SELECT 'PUP', '20' FROM dual UNION ALL
SELECT 'GRI', '30' FROM dual UNION ALL
SELECT 'NINE', '40' FROM dual
, normalized_data AS
SELECT p_key
, LEVEL AS sort_key
, REGEXP_SUBSTR ( attribute1
, '[^(,)]+'
, 1
, LEVEL
) AS str
FROM xx_dbc
-- WHERE ... -- If you need any filtering, put it here
CONNECT BY LEVEL <= 1 + REGEXP_COUNT (attribute1, ',')
AND PRIOR p_key = p_key
AND PRIOR SYS_GUID () IS NOT NULL
SELECT '(' || LISTAGG ( NVL (r.new_str, n.str)
) WITHIN GROUP (ORDER BY sort_key)
|| ')' AS new_attribute1
, n.p_key -- If wanted
FROM normalized_data n
LEFT OUTER JOIN replacements r ON r.old_str = n.str
GROUP BY n.p_key
ORDER BY n.p_key
Like everything else, it depends on your Oracle version.
In the query above, p_key can be any unique key from xx_dbc, including attribute1 or ROWID.
Relational databases, like Oracle, work best when each column of each row contains only 1 piece of information, not a delimited list of any number of pieces. This is so fundamental to table design that it's called First Normal Form. Most of the work in this problem involves converting your denormalized data into First Normal Form, and then converting it back again. This problem, like many others, would be much simpler and more efficient if your table was in First Normal Form.
The query above assumes the replacement strings (such as 'AIN' and '10') are not already in a table. If they are, or if they can be derived from a table, then you don't need the replacements sub-query; use your real table instead. -
Hi all
I have a problem in updating one column in the target table(say table A) from a column in the source table (say table B).
All the columns in table A has been populated. Just one column should be populated. My source is a SQL object that contains a complex sql query that returns three columns date_from, date_to and ID.
In the table A, I have the same date_from and date_to and need to get the ID from the SQL object and set it to the corresponding ID in the table A.
I tried many ways to update the table, but it I couldn't ;(
I should read from a table and update it based on a look-up function mapped to the column I need to update.
I want to map the ID colmn from table A to a look-up ext function that can get the column from the table B. However I don't know how to use the Data Services objects to just update 1 column. If you could give me a consequence of the DS objects to be update a table based on a look-up , I would be so grateful.
Thanks.Your dataflow should look like this :
1) Source = the SQL transform with date_from, date_to and ID as columns.
2) Next add a query (copy all columns from schema in to schema out) and set date_from and date_to as keys. Also make sure column names exactly match the column names in your target table, if not rename them in this query.
3) Add a Map_Operation transform that maps all "normal" operation codes to "update"
4) Finally add your target table and in the properties/options set "use input keys" to yes (or checked).
This will generate UPDATE statements for all columns used in the query with a WHERE clause based on the keys defined in the query (date_from, date_to).
Ben. -
Getting errors when updating a column on a table having a primary key
Hi,
I have an application on Oracle APEX that raises the following error after an attempt (through the application) to update a column with no specific constraint on it:
ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignoredUnable to fetch row.
The involved table has a primary key conatraint and the corresponding column can be populated by a sequence (but there is no trigger to manipulate the sequence).
The sequence is mentioned in the involved page definition for populating the primary key.
If I disable the primry key and set to null the corresponding value for the primary of the record to be updated, then it is possible to update that record (thus the above column) through the application.
Did someone encountered this situation before?
If yes, what was then your workaround/solution?
Kind Regards.Dear user8058501 ,
Firstly) Did you check
Auto Row Fetch (After upgrade to 4.0.1)
Automated Row Fetch on Table with Synonym causes ORA-00936: missing expr.
Secondly) If the problem is not resolved, Would you provide a sample on apex.oracle.com with workspace/developer account to be able to help you
Please, if this solves your question, mark it as Correct. Otherwise as helpful.
Best Regards
Mahmoud -
Update 1 column,1 single table based on where results of multiple tables
I would like the my_id column in 1 table updated to the static value of 247 for my_id stored in the 1 single table based on the where clause, which uses the my_id column in it.
The update statement updates all rows in table1, instead of just the rows where
the condition ( (b.my_id=a.my_id)
and ( b.my_name like 'OIS SrClerk%')
and (a.f_id=m.f_id)
and (trunc(m.cr_time) < '02-Apr-2008')) is true
What needs to be changed?
update table1 a
set a.my_id=247
from table1 a, table2 b, table3 m
where
(b.my_id=a.my_id)
and ( b.my_name like 'OIS SrClerk%')
and (a.f_id=m.f_id)
and (trunc(m.cr_time) < '02-Apr-2008')Are you looking for this?
UPDATE table1 A
SET A.my_id = 247
WHERE EXISTS (SELECT 'x'
FROM table2 b,
table3 M
WHERE b.my_id = A.my_id
AND b.my_name LIKE 'OIS SrClerk%'
AND A.f_id = M.f_id
AND TRUNC (M.cr_time) < to_date('02-apr-2008 00:00:00','dd-mon-yyyy HH:MI:SS') )changed date string to to_date
Message was edited by:
devmiral -
Question about creating and updating new columns in a table
Hi, I have a couple of questions that would love some answers to
Please bear in min that questions relate to datawarehouse / Just large tables with say about 50 million records
1) How do you create new columns in a big table
2) how do you update the new columns
3) would you create an index on a column in a table with 200m rows when the only two possible values are stored in the column (e.g.Y, N) - give your resason
my aswers to these would be
1) simple alter table ...
2) simple update statements
3) No need to create an index
I might be wrong on these in the context of datawarehouse
cheers
css_jay99If the number of Y vs. N is about 50/50, you only have to parse through 50% of the
overall amount of columns.Fnord. If the ratio of Y to N was 1:20 then the index would be useful for searching for values of Y only. Or if the column is nullable and the bulk of the entries were null then it might be useful. But a 50/50 split? FTS is much more effective.
So, it does depend on the data distribution, but in most cases such an index would never be used (or should never be used).
Cheers, APC -
Updating a customer infotype detail table (in PIQSTM) from an interface
We have a customer infotype that has a header table (HRP....) and a detail table (HRT.....) and we have this attached to transaction PIQSTM. This works fine. However, we now have a requirement to update the infotype via an interface and we have hit a problem using the standard function modules. We have tried, for example, using FM 'HRIQ_PNNNN_MAINTAIN' but have found that whilst it updates the header ok, if any detail record exists it is always overwritten. We need to keep the existing detail records attached to the same header.
I've debugged the way our tables are updated when saved in PIQSTM and can see that there is a lot going on with buffers. It seems that buffers are updated and then FM 'RH_BASE_UPDATE_DB_DIALOG' is called, ultimately resulting in an insert to our detail infotype table. In our interface program, obviously I would prefer not to update the table directly. I guess BDC is always an option but again, I'd prefer not to use it if possible.
Has anyone out there done this and can offer me any advice ?
thanks,
Malcolm.Malcom,
Try to feed old HRT record and New records(from interface) to Insert/update info-type function module.
Thanks,
Prabhat Singh -
Update records in Master Details table
Hi,
I have to update a Master Details table,
in this case after clicking the edit button user will be forwarded to the Edit page with one Header info & its corresponding Line info(e.g one header info and its 10 line info)
user can edit header & its line info in the edit page and after clicking save header & line info will be updated to the database header & line table.
more than one line info should be saved at a time-- is it possible??It is possible. Check the OAF dev guide, they have a sample.
--Shiv -
Updating a column from other table
Hi all,
I have a simple update query problem. I have four tables
activist(activist_id,first_name,last_name,c_state),
membership(activist_id,g_n_id),
group_network(g_n_id,g_n_type_id),
school_grop_det(g_n_id,state). For some records in activist table the c_state column is null, i want to update that column with state column of school_group_det table.
Here is the query for the states which are null
select distinct a.activist_id,a.first_name,a.last_name,
a.c_state,sd.state from activist a,membership m,
group_network g,school_group_det sd where
a.activist_id=m.activist_id and g.g_n_id=m.g_n_id and
g.g_n_id=sd.g_N_id and a.c_state is null and g.g_n_type_id='1001'
order by a.activist_id
I got the activist_id,first_name,last_name,c_state from activist and state from school_group_det. now i as i told you want to update the c_state with state column of school_group_Det table.
Pleae any one help me
Thanks
SrinivasFor ur query the reply whay u have got is correct one. For further quries similar to one u had u can download a tool named TOAD (Tools for Oracle Application Developer) from quest site (www.quest.com). Install it a proceed.
Do let me know how and what u feek about TOAD. -
BAPI_GOODSMVT_CREATE ---- need to update custom field in MSEG table
Greetings all,
I'm using 'BAPI_GOODSMVT_CREATE' to create goods movements. also I need to update one cutom field(z-field) in MSEG table. Could anyone please advice how can I update the custom field thru EXTENSIONIN.
thanks in advance.see the help
http://help.sap.com/saphelp_nw04/helpdata/en/c3/4099948b8911d396b70004ac96334b/frameset.htm
Regards
Kiran Sure
Maybe you are looking for
-
Chart history explanation?
Greetings, Perhaps I am thinking too much on this, or perhaps too little, but I am trying to figure out what chart history length is actually doing. For example. I'm developing an app right now where I am monitoring 32 channels on a system at 10 Hz.
-
Hi, My aggregate member function output/OUT parameter is a nested table or collection : table_out1 : table_out1 TABLE OF NTAB_TYPE Name Null? Type EMPNO NUMBER SALARY NUMBER TST CHAR(10) TE CHAR(10) And this table_out1 is not part/column of any datab
-
I sent a connection key to a client who has Contribute CS3 already installed and has been using it for at least a year. I sent a new connection key for her because she changed web host companies. When she clicks on the link in the email to set up the
-
How to see your pixels really close up
I was sitting out on my deck with my iPad yesterday when it began to rain very slightly. A tiny drop of rain fell on my iPad's screen, and soon I noticed that I could see tiny little twinkling colored lights in it. I put my eye right down close to
-
Final Cut shortening files on import
Hi, When I import my files into Final Cut, they are being shortened by about 10%. The file works and is full length outside of Final Cut. The shortened files also work in Final Cut. The files being imported were mp4s that have been converted to mov f