Update hidden column using Apply MRU
I want to update username which is a hidden column with an value when I submit update using ApplyMRU. How can I do it?
Apex 4.1, Browser IE/FireFox, Using Form Tabular with ApplyMRU.
Can someone help on this?
Similar Messages
-
Update some columns using case....
Hi ,
Is it possible to update some columns using case statement...????
For example when col1 is null then update to a value 'x' else update it to the value '*' , when col2 is null then update to a value y else update it to compute the running total up to that time....
This update statement is contained in db packaged procedure and it receives the values...as parameters....
How can i write down this update statement...?????
Many thanks,
SimonHi ,
Cant' it be used for two or more columns that have to be updated....????
i mean
update table set col_a = case when col_a is null then col_a else '*',
col_b = case when col_b is null then col_b else col_b+col_b_var
end
where .....The above in bold is running total.... This update is defined in a procedure and it receives numbers as parameters, so the need is to add them for every record it receives...., that's why i set above col_b+col_b_var... where col_b_var is the parameter of the procedure....
SORRY...IT IS POSSIBLE.....
Thanks , a lot
Simon
Message was edited by:
sgalaxy -
How to update a column using hibernate
how to update a particular column using hibernate..
iam using oracle databaseI think you didn't get the point. This is a generic Java forum... not a Hibernate forum.
-
Hi everyone,
still playing around with newbie stuff here. Is it possible to update a column or a row using a cursor? I understand how to fetch a data using a cursor, but not sure if it can help to update a data.
If it can, what's the syntax?
Regards,
Valeriehi,
why you opted to update rows by using cursor.
why not you opt DML
or
just want to know
SQL> SET LINE 32323
SQL> /
Rollback complete.
SQL> SELECT *FROM EMP;
7499 KITTU SALESMAN 7698 20-FEB-81 15800 25050 30
7566 JONES MANAGER 7839 02-APR-81 3175 446.25 20
7654 RAVIKUMAR SALESMAN 7698 28-SEP-81 1450 1587.5 30 [email protected]
7698 BLAKE MANAGER 7839 01-MAY-81 3050 427.5 30
7782 CLARK MANAGER 7839 09-JUN-81 2650 367.5 10
7788 SCOTT ANALYST 7566 09-DEC-82 3200 450 20
7839 KING PRESIDENT 17-NOV-81 5200 8250 10
7844 TURNER SALESMAN 7698 08-SEP-81 1700 225 30
7876 ADAMS CLERK 7788 12-JAN-83 1300 165 20
7900 JAMES CLERK 7698 03-DEC-81 1150 85.5 30 [email protected]
7902 FORD ANALYST 7566 03-DEC-81 3200 450 20
7934 MILLER CLERK 7782 23-JAN-82 1500 195 10
8000 KINGBABA PRESIDENT 17-NOV-81 5200 8250 10
8001 TURNER RAV SALESMAN 8000 08-SEP-81 1700 450 30
14 rows selected.
SQL> DECLARE
2 CURSOR CUR_EMP IS SELECT *FROM EMP;
3 CUR_EMP1 CUR_EMP%ROWTYPE;
4 BEGIN
5 OPEN CUR_EMP;
6 LOOP
7 FETCH CUR_EMP INTO CUR_EMP1;
8 EXIT WHEN CUR_EMP%NOTFOUND;
9 UPDATE EMP SET ENAME='TEST'
10 WHERE ENAME=CUR_EMP1.ENAME;
11 END LOOP;
12 CLOSE CUR_EMP;
13 END;
14 /
PL/SQL procedure successfully completed.
SQL> SELECT *FROM EMP;
7499 TEST SALESMAN 7698 20-FEB-81 15800 25050 30
7566 TEST MANAGER 7839 02-APR-81 3175 446.25 20
7654 TEST SALESMAN 7698 28-SEP-81 1450 1587.5 30 [email protected]
7698 TEST MANAGER 7839 01-MAY-81 3050 427.5 30
7782 TEST MANAGER 7839 09-JUN-81 2650 367.5 10
7788 TEST ANALYST 7566 09-DEC-82 3200 450 20
7839 TEST PRESIDENT 17-NOV-81 5200 8250 10
7844 TEST SALESMAN 7698 08-SEP-81 1700 225 30
7876 TEST CLERK 7788 12-JAN-83 1300 165 20
7900 TEST CLERK 7698 03-DEC-81 1150 85.5 30 [email protected]
7902 TEST ANALYST 7566 03-DEC-81 3200 450 20
7934 TEST CLERK 7782 23-JAN-82 1500 195 10
8000 TEST PRESIDENT 17-NOV-81 5200 8250 10
8001 TEST SALESMAN 8000 08-SEP-81 1700 450 30
14 rows selected.Edited by: user291283 on Sep 1, 2009 10:42 PM -
Update a column using a connect by or other for hierachical relationships
I have a column which represents the 'order' of which a record loaded out of a table.
This 'order' is coming in wrong.
I know, because of a relatoinship between two of the columns what the correct order should be.
So for example if I do this:
select transid, laborcode, supervisorfrom enclabor_iface
connect by prior laborcode = supervisor
start with supervisor = 0;
I get all the records in the correct order... but of course I'd like to figure out how to use this in an update statement to update the transid columns, which is the order.
Can someone tell me if this is possible, and if so, how to do so?
I have tried a few things with no luck yet, as the attempt took over 15 minutes to run so I thought I had coded it badly.
thanks
JeffHi, Jeff,
Sure, that's possible.
The ROWNUM pseudo-column is assigned as the CONNECT BY clause (including ORDER SIBLINGS BY) is being applied, so you can use ROWNUM to capture the hierarchical order.
I don't have a copy of your table, so I'll use scott.emp to illustrate:
SELECT ename, empno, mgr
, ROWNUM AS r_num
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY mgr = PRIOR EMPNO
ORDER SIBLINGS BY ename
;Output:
ENAME EMPNO MGR R_NUM
KING 7839 1
BLAKE 7698 7839 2
ALLEN 7499 7698 3
JAMES 7900 7698 4
MARTIN 7654 7698 5
TURNER 7844 7698 6
WARD 7521 7698 7
CLARK 7782 7839 8
MILLER 7934 7782 9
JONES 7566 7839 10
FORD 7902 7566 11
SMITH 7369 7902 12
SCOTT 7788 7566 13
ADAMS 7876 7788 14The default CONNECT BY ordering guarantees that (for example) all of BLAKEs descendants will come after BLAKE and before anyone who is not a descendant of BLAKE. However, it says nothing about whether BLAKE will come before JONES, or vice-versa. If that's important, use ORDER SIBLINGS BY.
To store those numbers in your table, do the query above in a MERGE statement.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
If you're asking about a DML statement, such as MERGE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on Feb 7, 2012 11:46 AM -
SQL QUERY updateable report with APEX_ITEM fields to update hidden columns
Here is my SQL query:
select
"EMPLOYEE_ID",
"PUBLICATION_ID",
"TITLE",
'<NOBR>1. ' || APEX_ITEM.TEXT(101,CODE1,2,3) || ' ' ||
APEX_ITEM.TEXT(102,CODE1_PCT,2,3) || ' %</NOBR><BR>' ||
'<NOBR>2. ' || APEX_ITEM.TEXT(103,CODE2,2,3) || ' ' ||
APEX_ITEM.TEXT(104,CODE2_PCT,2,3) || ' %</NOBR><BR>' ||
'<NOBR>3. ' || APEX_ITEM.TEXT(105,CODE3,2,3) || ' ' ||
APEX_ITEM.TEXT(106,CODE3_PCT,2,3) || ' %</NOBR>' rfcd_codes,
APEX_ITEM.DISPLAY_AND_SAVE(100,CODE1) hidden_rfcd1,
mycomments
from "#OWNER#".mytable
I have 3 code fields with their percentages (_pct). I have concatinated them so I can format them nicely on the page.
I have create a process 'on-submit and before computations and validations' where I was hoping to assign my table columns (eg the code and pct columns) from the APEXITEMs in my select statement.
I can get the values from these (APEX_ITEM) fields by referencing APEX_APPLICATION.G_F10(i) etc.... so thats cool.
But my problem is how do I reference the table columns so I can assign them.
I am using a 'Multi Row Update' process to perform the update to the database.
P.S. mycomments column is working fine. It gets updated nicely but its just those other APEX_ITEM fields.I don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
It should be like
<input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
Replace that number in the code, for instance if it was f05 , the code would use
apex_application.g_f05
--i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record. -
How to update the columns using sql queries?
create table emp(eno number(5),ename varchar2(20),dno number(2),dname varchar2(20),loc_id number(3), location varchar2(10));
insert into emp(eno,ename,dno,loc_id) values(1,'tom1',10,1);
insert into emp(eno,ename,dno,loc_id) values(2,'tom2',20,2);
insert into emp(eno,ename,dno,loc_id) values(3,'tom3',30,3);
insert into emp(eno,ename,dno,loc_id) values(4,'tom4',40,4);
insert into emp(eno,ename,dno,loc_id) values(5,'tom5',50,5);
insert into emp(eno,ename,dno,loc_id) values(6,'tom6',60,6);
insert into emp(eno,ename,dno,loc_id) values(7,'tom7',70,7);
insert into emp(eno,ename,dno,loc_id) values(8,'tom8',80,8);
create table dept(dno number(3),dname varchar2(10));
insert into dept values(10,'RM');
insert into dept values(10,'DD');
insert into dept values(10,'TD');
create table location(loc_id number(3),location varchar2(20));
insert into location values(1,'palani');
insert into location values(1,'salem');
insert into location values(1,'kalpattu');
insert into location values(1,'thirukoyilur');
insert into location values(2,'thaeni');
insert into location values(2,'villupuram');
insert into location values(2,'yercaud');
insert into location values(3,'thiruvanamalai');
insert into location values(3,'trichy');
insert into location values(7,'tanjore');
insert into location values(4,'tirunelveli');
insert into location values(4,'namakal');
insert into location values(5,'bangalore');
insert into location values(6,'chennai');
insert into location values(6,'calcutta');
insert into location values(7,'tirupathy');
insert into location values(7,'bombay');
insert into location values(7,'kumbokonam');
My requirement is to update the department name and location of toms present in employee table without using cursors, loops.
The column department number and loc_id are used for joins.
I am in a situation to deliver my code on time.try this
update emp tt
set (dname,location ) = (
select res,res1 from (select a.eno,a.ename,a.dno,b.dname,a.loc_id,c.location
from emp a,
dept b,
location c
where a.dno = b.dno
and a.loc_id = c.loc_id
) t
where tt.eno = t.eno
model
return updated rows
partition by (eno)
dimension by (row_number() over (order by eno) as rn)
measures(cast (dname as varchar2(50)) as res,cast (location as varchar2(300)) as res1)
rules
upsert
iterate(1000)
until(presentv(res[iteration_number + 2],1,0) = 0)
res[0] = res[0] ||','|| res[iteration_number + 1],
res1[0] = res1[0] ||','|| res1[iteration_number + 1]))
;output
1 tom1 10 ,RM,RM,RM,RM,DD,TD,DD,DD,TD,TD,TD,DD 1 ,palani,salem,kalpattu,thirukoyilur,palani,thirukoyilur,kalpattu,thirukoyilur,palani,salem,kalpattu,salem
2 tom2 20 2
3 tom3 30 3
4 tom4 40 4
5 tom5 50 5
6 tom6 60 6
7 tom7 70 7
8 tom8 80 8 -
Updating a column using deleted/inserted during update statement execution
I need to capture the old value while update statement is executed. I can not insert into temp table (there are many samples online where you can use OUTPUT clause to insert data in same table or another temp table)
something like
declare @count table
id int,
changed varchar (50)
insert into @count (id,changed) values (2,'T')
insert into @count (id,changed) values (3,'T')
insert into @count (id,changed) values (4,'T')
select * from @count
UPDATE @count
SET id=5,
Changed = GETDATE() -- here instead of date, I want to get inserted.id and deleted.id
OUTPUT inserted.id,
deleted.id
where id = 2
SELECT *FROM @count
Any help on this will be very much appreciated....I am not sure to follow your question but you can get the old value just by doing:
UPDATE @count
SET id=5,
Changed = id
OUTPUT inserted.id,
deleted.id
WHERE id = 2;
since SQL Server uses all-at-once operations.
Microsoft SQL Server 2012 T-SQL Fundamentals
http://shop.oreilly.com/product/0790145321978.do
AMB
Some guidelines for posting questions... -
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. -
Custom table model, table sorter, and cell renderer to use hidden columns
Hello,
I'm having a hard time figuring out the best way to go about this. I currently have a JTable with an custom table model to make the cells immutable. Furthermore, I have a "hidden" column in the table model so that I can access the items selected from a database by their recid, and then another hidden column that keeps track of the appropriate color for a custom cell renderer.
Subject -- Sender -- Date hidden rec id color
Hello Pete Jan 15, 2003 2900 blue
Basically, when a row is selected, it grabs the record id from the hidden column. This essentially allows me to have a data[][] object independent of the one that is used to display the JTable. Instinctively, this does not seem right, but I don't know how else to do it. I know that the DefaultTableModel uses a Vector even when it's constructed with an array and I've read elsewhere that it's not a good idea to do what I'm trying to do.
The other complication is that I have a table sorter as well. So, when it sorts the objects in the table, I have it recreate the data array and then set the data array of the ImmutableTableModel when it has rearranged all of the items in the array.
On top of this, I have a custom cell renderer as well. This checks yet another hidden field and displays the row accordingly. So, not only does the table sort need to inform the table model of a change in the data structure, but also the cell renderer.
Is there a better way to keep the data in sync between all of these?To the OP, having hidden columns is just fine, I do that all the time.. Nothing says you have to display ALL the info you have..
Now, the column appears to be sorting properly
whenever a new row is added. However, when I attempt
to remove the selected row, it now removes a seemingly
random row and I am left with an unselectable blank
line in my JTable.I have a class that uses an int[] to index the data.. The table model displays rows in order of the index, not the actual order of the data (in my case a Vector of Object[]'s).. Saves a lotta work when sorting..
If you're using a similar indexing scheme: If you're deleting a row, you have to delete the data in the vector at the INDEX table.getSelectedRow(), not the actual data contained at
vector.elementAt(table.getSelectedRow()). This would account for a seemingly 'random' row getting deleted, instead of the row you intend.
Because the row is unselectable, it sounds like you have a null in your model where you should have a row of data.. When you do
vector.removeElementAt(int), the Vector class packs itself. An array does not. If you have an array, when you delete the row you must make sure you dont have that gap.. Make a new array of
(old array length-1), populate it, and give it back to your model.. Using Vectors makes this automatic.
Also, you must make sure your model knows the data changed:
model.fireTableDataChanged(); otherwise it has no idea anything happened..
IDK if that's how you're doing it, but it sounds remarkably similar to what I went thru when I put all this together.. -
All, I'm trying fix an issue with transactional replication where replication monitor is showing the push to the subscriber is failing because of the error, "Cannot update identity column." I've tried to use sp_browsereplcmds to pull up the
command that's failing based on the xact_seqno but when I try that I get the error:
Number: 102, State: 1, Procedure: , LineNumber: 0, Server: , Source: .Net SqlClient Data Provider
Message: Incorrect syntax near '┻'.
I'd like to fix the issue without having to rebuild replication during a maintenance window. I know you cannot publish tables with primary keys, but I'm wondering if dropping the identity column on this table might fix the issue. I'm considering
that but I would prefer to be able to pull the command that's trying to update the identity column, throw in SET IDENTITY_INSERT ON and remove the commands from the distribution database, but if that doesn't work I'm open to ideas of just dropping the primary
key on the replicated table. I think that should be fine.
Does anyone have any recommendations on how to view the command that's failing?
Or if dropping the primary key on the subscriber table would create issues with the publisher (since it is also the primary key)?
Or, know of any other ways in which to address this issue? Thanks.Unfortunately, no. The error was a bit of a red herring. In the end the subscriber was missing all of the stored procedures needed to update data in the published tables (i.e., the procedures for performing inserts/updates/deletes were missing
for every table in the subscriber database). Additionally, I could not recreate these stored procedures using sp_scriptpublicationcustomprocs
because another procedure which was required for that proc to work was also missing. In short, there were hundreds of missing stored procedures in the subscriber database on which transactional replication is dependent in order to replicate DML changes and
function normally and this includes system sprocs which would've been used to recreate the missing DML procs. In short, the subscriber was badly damaged and deemed to be unrecoverable within a reasonable time frame.
The solution was to tear down and start over, which we did successfully later in the evening. -
Revision: 9493
Author: [email protected]
Date: 2009-08-23 16:09:56 -0700 (Sun, 23 Aug 2009)
Log Message:
Applying patch (SDK-22435) submitted by Aaron Boushley which updates ObjectUtil to use toXMLString rather than toString for XML objects.
QE notes: None
Doc notes: None
Bugs: SDK-13919
Reviewer: N/A
Tests run: Checkin
Is noteworthy for integration: No
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-22435
http://bugs.adobe.com/jira/browse/SDK-13919
Modified Paths:
flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/utils/ObjectUtil.as -
How to identify the hidden columns in table by using af:panelCollection
Hi,
We are using af:panelCollection tag for a table to show personalization features. i.e. to hide or disaply colums in the table.
We also have a print button to print data in the table. the issue is when we hide any column in teble using the personalization feature given by af:panelCollection , we can see the hidden columns also on the page to be printed.which should not happen.
For printing table we cant use showPrintablePageBehavior coz it prints data on current page only where as we also have Print all data button which should print all data on table which is not visible on scrren due to pagination.
Using ADF 11.1.1.5.0 and JSF 2.0 . Please help how to capture whci colums are made hidden.
The code used for printing data is
<div class="print_data">Print Current Data</div>
<ahref="printCurrentData.jsp" target="_blank" class="left">
<img src="print.png" alt="abc"
width="24" height="22" border="0"/></a>
<div class="print_data">Print All Data</div>
<ahref="printAllData.jsp" target="_blank" class="left">
<img src="print.png" alt="abc"/></a>
Edited by: 924834 on Aug 27, 2012 4:27 AM
Edited by: 924834 on Aug 27, 2012 4:28 AMThere are some things which don't add up here.
You are using jdev 11.1.1.5.0 which only comes with jsf 1.2, but you are using jsf 2.0?
Then you are using jsp instead of jsf which are the normal way to go for jsf.
Can you please clarify on this?
How is the printCurrentData.jsp setup? Do you have a table on it based on the same iterator as on the visible page with the hidden column?
Timo -
Hi,
I have used the sequence of BAPI calls as provided below.
BAPI_PS_INITIALIZATION
BAPI_BUS2054_CHANGE_MULTI
BAPI_PS_PRECOMMIT
BAPI_TRANSACTION_COMMIT
I would like to update some columns of PRPS table for specified WBS element, uploading data from an excel sheet.
I get the data from excel sheet to an internal table and pass to BAPI_BUS2054_CHANGE_MULTI row by row.
It's strange ! .it updates every column for all the row of data w.r.t WBS element But location field for first row data element get updated and rest ignored.
can you please suggest me why it happens so?
Thanks in advance.
Regards,
Sourya Prakash.Thanks for other responses I got .
-
Update a table using same variable name as the column
I am not able to update a table column using a local variable which is having same name as the table column. Example of the function is as follows:
create or replace function trial return integer as
column1 integer:=99;
BEGIN
update firsttable set column1=column1 where column2='john';
return 0;
END;
Existing data in firsttable:
COLUMN1 COLUMN2
123 xyz
123 abcd
101 johnUnfortunately table aliasing won't help... Although specifying the procedure will. Somewhat academic I know, since if you can prefix the procedure name on the variable you can just as easily rename it, unless you happen to have a bunch of other code calling it using named notation possibly.
SQL> select ename, comm from emp where empno = 7934;
ENAME COMM
MILLER
SQL> create or replace procedure new_comm
2 (empno in number, comm in number)
3 is
4 begin
5 update emp e
6 set e.comm = new_comm.comm
7 where e.empno = new_comm.empno;
8 dbms_output.put_line('updated '||sql%rowcount||' rows!');
9 end;
10 /
Procedure created.
SQL> exec new_comm (7934, 100)
updated 1 rows!
PL/SQL procedure successfully completed.
SQL> select ename, comm from emp where empno = 7934;
ENAME COMM
MILLER 100Message was edited by:
3360
Colin beat me to it
Maybe you are looking for
-
Looking for a more universal scripting language than AppleScript or Automator
I want to learn a cross-platform/web scripting language to automate tasks, write scripts and with the potential to create programs and web apps. I am looking for something that: - is not a program with a GUI like Automator, iKey, Quickeys, Maestro...
-
Email Channel Issue in SAP CC aka BCM
Hi Team, I have configured SAP CC Email Channel in BCM with Integration with CRM IC. When i send mails to the configured Email Queue , i can see the mails coming in SAP CRM IC and the customer gets identified . But after the interaction is over , i
-
Images on webpages do not load/cache properly
Using the new Firefox 5.0, I find that many websites don't load properly in that background images and some regular images will seem to load one time, but upon page reload they are gone, and if you reload again, they're back. It's happened on Google
-
How to connect LG Ally to home wifi?
I hit the icon to turn on wifi and it says it cannot turn on. I don't know how to fix this. Can anyone help?
-
Purchased songs lost when syncing from my iphone to itunes, how do I get them back?
I have not had my iphone to my labtop for a month, Connected it just now, and when itunes was done syncing only the two newest purchases, of about 20 over the last month, was synced. None of the others are left on either the iphone, nor are their any