Query Needs to Update Date
hi,
In my table i hav userid,user associationdate,user expirydate
now i want to extend(update not select) all the user's expirydate to another one year and this should be done in SINGLE QUERY. how can i do this ?
SQL> desc t_user_license
Name Null? Type
USERID NOT NULL VARCHAR2(25)
LICENSEID NOT NULL NUMBER(38)
ASSOCIATIONDATE NOT NULL DATE
EXPIRYDATE NOT NULL DATE
select userid,add_months(expirydate,12) from t_user_license;
this query extends expirydate to another one year.but not make changes permanent.
but i want to update expiry date to another one year that too in single query and make the changes permanent. how can i do this .............
can anyone plz help me
With Regards
Boo
Hi,
update t_user_license
set EXPIRYDATE = add_months(EXPIRYDATE,12);Check the results via
select * from t_user_license;and finally commit;Regards,
Yoann.
Similar Messages
-
Hello,
There is Selection Screen where it allows to enter KUNNR, LAND1 and VBELN.
I want to display below fields from table specified.
VBELN, FKART, FKDAT WAERK, KUNRG, KUNWE from VBRK Table, BSTNK, VBELN, AUART from VBAK Table, POSNR, MATNR, FKIMG, WAVWR from VBRP Table, KBETR from KOMV and MWSBP from KOMP.
So i need to find out query to display above fields data as output as per input in selection screen. default values if nothing entered in Selection screen are all data.
Please help me with Program or Query to retrieve above data.
Thanks,Well... you seem to be new to ABAP.. hope this helps.....
select VBELN, FKART, FKDAT WAERK, KUNRG, KUNWE
from vbrk
into table t_vbrk
where vbeln = s_vbeln. " given in selection screen
if sy-subrc = 0.
endif.
select BSTNK, VBELN, AUART
from vbak
into table t_vbak
where vbeln = s_vbeln.
if sy-subrc = 0.
endif.
Similarly write the other select queries as well.
Its very useful if you pass the key fields while selecting from the database. Helps in faster processing.
Regards. -
How to Query for last updated data in planning Cube?
Hi,
i want to see the last updated data with specific timestamp on one of our planning application Cube, IS it possible ?
I have gone through application log and essbase server log but didn't get much information
Can any one please let me know.
ThxHow was the data updated, if it was through planning then you can enabling data auditing and you should be able to then query the information.
If it is was a data load then in EAS go the database, edit properties, modications, it should display data load information.
Cheers
John
http://john-goodwin.blogspot.com/ -
DW best practices when needing to update data
Hi all,
I have a few general questions about data warehousing...
We often need to update/process the data after that we imported it into the DW (with ETS tools). Since data in a DW is not supposed to be updated I wonder what the corrct way to do this is.
The scenario is data coming from a few systems, we import it and transform it, then, when we want to run reports etc. we sometime need to apply some changes to the data, like for example add a column with some result. Is the correct way to do that adding tables in the DW? Other systems use separate tables (inside or outside the DW) in order to transform the data... when is it worth to create separate tables outside the DW and when to create/add columns in the DW? What is allowed/best practice in DW?
Thanks,
A.It is a view. That is what the error message is saying.
Why not deal with facts instead of speculating? Look at the Oracle Data Dictionary and see what the object DPIT.DEDUCTIONS is.
Use TOAD. Use SQL*Plus and select on ALL_OBJECTS. Use OEM. Etc. -
Query needed for Cumulative data
HI Friends,
I need output like this.
Frequency Percent (%) Cumulative
Frequency Cumulative Percent
4468 0.91 4468 0.91
21092 4.31 25560 5.23
57818 11.82 83378 17.05
6274 1.28 89652 18.33
I am using Oracle 9i.
My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
What should be the analytic function and how to write the query.
Thanks,
LonyHi Friends,
I need output like this.
Frequency Percent (%) Cumulative Frequency Cumulative Percent
4468 0.91 4468 0.91
21092 4.31 25560 5.23
57818 11.82 83378 17.05
6274 1.28 89652 18.33
I am using Oracle 9i.
My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
1:The formula for Frequency column data is sum of (dd+cc+mc_cc_mc).
1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
What should be the analytic function and how to write the query.Please find the sample data and table script.
CREATE TABLE all_lony (
campno varchar2(20),
dd INTEGER,
cc INTEGER,
mc INTEGER,
cc_mc INTEGER
insert into all_lony (campno,dd,cc,mc,cc_mc)
values(36,156,1320,445,2547);
insert into all_lony (campno,dd,cc,mc,cc_mc)
values(40,233,19711,263,885);
=============
Please find my query below
SELECT campno
|| ','
|| dm
|| ','
|| cc
|| ','
|| mc
|| ','
|| cc_mc
|| ','
|| frequency
|| ','
|| per
||','
||cumulative_fr
||','
|| SUM (per) OVER (ORDER BY per ROWS UNBOUNDED PRECEDING)
FROM (SELECT q3.campno campno, q3.dm, q3.cc, q3.mc, q3.cc_mc,
q3.frequency, q3.cumulative_fr,
(q3.Frequency / SUM (q3.cumulative_fr)) * 100 per
FROM (SELECT q2.campno campno, SUM (q2.dm) dm, SUM (q2.cc) cc,
SUM (q2.mc) mc, SUM (q2.cc_mc) cc_mc,
(SUM ( NVL (q2.dm, 0)
+ NVL (q2.cc, 0)
+ NVL (q2.mc, 0)
+ NVL (q2.cc_mc, 0)
) frequency,
SUM (SUM ( NVL (q2.dm, 0)
+ NVL (q2.cc, 0)
+ NVL (q2.mc, 0)
+ NVL (q2.cc_mc, 0)
) OVER (ORDER BY SUM ( NVL (q2.dm, 0)
+ NVL (q2.cc, 0)
+ NVL (q2.mc, 0)
+ NVL (q2.cc_mc,0)
) ROWS UNBOUNDED PRECEDING)
cumulative_fr
from all_lony
q1 )q2
GROUP BY q3.campno) q3
GROUP BY campno, dm, cc, mc,cc_mc, frequency,cumulative_fr)
Can anybody just verify the query and let me know. -
Query need (Today's date - schedule date) --- Important
Hi
I have BEx report. One of the fields in this query is a date field i.e. schedule date (characteristic). I want to add up one more field in my query which will show me (today's date - schedule date). I dont know how to implement it.
Pls let me know
Thanks...What about "Query date" to be used as today's date. Or do it in user exit variable in ABAP via sy-datum variable.
Check out following:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a?quicklink=index&overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d?quicklink=index&overridelayout=true -
Query need for transpose data output
Dear All,
I have a query regarding transpose output.
for ex. I created one table employee in database
create table emp(emp_no number,dept_id number(10));
it is having data like....
emp_no dept_id
101 10
102 20
103 10
104 10
105 20
so I want the output in transpose format like
dept_id emp_no1 emp_no2 emp_no3
10 101 103 104
20 102 105
can anybody suggest me any query for the above output.
Thanks...
Prashant....select dept_id
, max (decode (emp_no, 101, emp_no))
, max (decode (emp_no, 102, emp_no))
, max (decode (emp_no, 103, emp_no))
, max (decode (emp_no, 104, emp_no))
, max (decode (emp_no, 105, emp_no))
from test
group by dept_idas in
SQL> with test as
2 (
3 select 101 emp_no, 10 dept_id from dual union all
4 select 102 emp_no, 20 dept_id from dual union all
5 select 103 emp_no, 10 dept_id from dual union all
6 select 104 emp_no, 10 dept_id from dual union all
7 select 105 emp_no, 20 dept_id from dual
8 )
9 select dept_id
10 , max (decode (emp_no, 101, emp_no)) emp1
11 , max (decode (emp_no, 102, emp_no)) emp2
12 , max (decode (emp_no, 103, emp_no)) emp3
13 , max (decode (emp_no, 104, emp_no)) emp4
14 , max (decode (emp_no, 105, emp_no)) emp5
15 from test
16 group by dept_id
17 ;
DEPT_ID EMP1 EMP2 EMP3 EMP4 EMP5
20 102 105
10 101 103 104 -
Query not displaying updated data for planning
Hi Experts!
I've created a revaluation function in IP and tested it in the modeler, it's working fine. I have an issue when running the sequence in WAD, as it is not displaying the modified data. The message says that the records were modified, but those changes aren't being displayed in the query. The query being used isn't input ready, it just takes data from the cube and revaluates them.
I have already tried adding a refresh command in WAD, but I've found out it doesn't fit this purpose. Am I missing a configuration so it can read the delta buffer? or must I necessarily save the plan data for it to be displayed? Any ideas?
Thanks in advance for your help,
AlHi,
you are on the save side if you use an input-ready query and a button representing the revaluation function in the Web Application Designer (WAD) . Of course the function has to change data via an aggregation level A on a real-time cube C that is also contained in the InfoProvider P used to create the input-ready query. In the most straightforward case A = P.
Input-ready queries always know about the most-recent data, i.e. data in all green + yellow requests and the data in the deltabuffers.
But even a 'reporting' query e.g. on a real-time InfoCube C and the revaluation planning function on an aggregation level A on C should know about the most-recent data as defined above.
You can check the 'Requeststatus' used in the 'reporting' query. It should be 'Real-time InfoCubes up to current version'. This setting can be found - depending on the release - in transaction RSRT or the Query Designer.
You should not forget to do some simple checks: Maybe the function has changed data that are not contained in the filter of the query.
Regards,
Gregor -
How to trigger pop-up window in report and update data base from report
Hi All,
I have a requirement, in a report output list to trigger a pop up window with some rejection codes corresponding to each sales order when i select from the output list. Also i need to update data base by selecting one of the rejection code in the pop-up window list for that sales order. Can any one please let me know how to achive this.
Also, i have check boxes for each record in the output list. Also, i have added one more check box as "Select All'. When select 'Sleect All' check box , all check boxes need to be checked, how to achieve this. PLease let me know.
Thanks in advance.
Regards,
RajeshHi check this code of editable ALV report... I updated the data base with the changes made..in the editable ALV
*& Report ZJAY_EDIT_ALV
REPORT zjay_edit_alv.
* TYPE-POOLS *
TYPE-POOLS: slis.
* INTERNAL TABLES/WORK AREAS/VARIABLES
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
* FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
* SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
lines(5) TYPE n DEFAULT 7.
* START-OF-SELECTION *
START-OF-SELECTION.
* Storing table name
p_table = tabname.
* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>.
SORT i_fieldcat BY col_pos.
* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS.
REFRESH <dyn_tab_temp>.
* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form SET_PF_STATUS
* Setting custom PF-Status
* -->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard
ENDFORM. "SET_PF_STATUS
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>.
CASE r_ucomm.
* When a record is selected
WHEN '&IC1'.
* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* Make all the fields input enabled except key fields
w_field-input = 'X'.
MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
ENDIF.
* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
* If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
ENDIF.
* When save button is pressed
WHEN 'SAVE'.
* Sort the index table
SORT i_index.
* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
LOOP AT i_index.
* Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF.
ENDLOOP.
* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command -
How can i update data of DSO and Cube using ABAP??
Hello Experts
I have a requrement in which i need to update/ delete data from DSO and cube based on certain keys using ABAP.
Please let me know how can i modify contets of cube or active table of DSO.
Thanks
SudeepHi
I have requirement such that i need to update certain key figures in DSO after certain time.
for eg. say record with key a is loaded to DSO and currospoding key figure was loaded with value 10
after few days because of certain parameters changing in system i need to modify key figure value.
currently i am doing same using 1 self transformation i.e. by loading same data again in same DSO.
Amount of data is very huge and causing performance issues in system.
now A is not key but i need to modify record for few combinations which apperar multiple times in DSO.
Same DSO data is loaded into Cube regularly.
I may need to update data after gap of few weeks as well.
This design will be used as template and needto keep whole logic generic.
So wring Function module can make it generic.
Thanks
Sudeep -
How to update data according to row_number in sql
hi,
after deleting an item I need to update data according to row_number.
in oracle database I have a code like this... working perfectly..
update regitem set line_sn= LPAD(ROWNUM,2,'0') where doc_no='" & mydocno & "'
how it will work in sql server...
thanks..........There is an example at the below link which uses the Transact SQL ROW_NUMBER():
http://stackoverflow.com/questions/6729616/sql-server-how-to-update-a-column-for-a-desired-row-number
Paul ~~~~ Microsoft MVP (Visual Basic) -
Need to update Ztable from final internal table
Hi,
ITAB = Final internal table has 9 fields : 1 2 3 4 5 6 7 8 9
Ztable = Ztable has 6 fields ex : 1 3 4 6 7 8
Structure of both Itab and Ztable are different.
I have data in the Final Internal table and needs to update data into a ztable.
If condition is true...
Modify ztable from itab
endif.
Any suggestions how I can update Ztable from the INternal table
Regards,
KittuHello,
First keep the loop to the final internal table then move all the records to the work area after moving to workarea then create another workarea for the Ztable then move only the field values which are there in Ztable then use modify keyword.
example
move:
y_wa_final_itab-kdauf to y_wa_zhr_item-vbeln,
y_wa_final_itab-kdpos to y_wa_zhr_item-posnr,
y_wa_final_itab-receiptno to y_wa_zhr_item-receiptno
modify zhr_item from y_wa_zhr_item -
Need help in UPDATE data in SQL Query
Hi all,
I am trying to update data in the sql table as per below screenshot but couldn't able to do it. Can anyone help to update the data as I mention in screenshot.Appreciate you help.Thanks.
Yellow highlighted columns are source
Green highlighted columns are target
Colored data should be update as per source data in sql table.Data is not static as it might have more rows to update and query should be bit dynamic.
Maruthi...You have already asked this question once. You did not get any good answers, because you the information you gave was insufficient. And I'm afraid that the information is still in sufficient.
Or more exactly, from the example you have given, the answer is: can't be done. And the reason it can't be done, is as I explained in response to you first thread: there is no information in the data to from which we can deduce that Clorox Company
should be under "Week 1-1,K.B,F". The fact that rows are listed in a certain order in the screenshoot is of no importance, because a table is an unordered object.
But you said in another post that you have a timestamp column. Maybe that column is usable - maybe it is not. But at least it is a key that you have more columns that the ones you show.
The best way to get help with this type of problems is to post:
1) CREATE TABLE statement for your table(s).
2) INSERT statements with sample data.
3) The desired result given the sample.
4) A short description of the actual buisness problem you are trying to solve.
5) Which version of SQL Server you are using.
This makes it easy to copy and paste into a query window to develop a tested solution. Screenshots with an insufficient amount of data is not going to help you very much.
Erland Sommarskog, SQL Server MVP, [email protected] -
Query to showed all level of BOM details, sort by create/update date
Hi expert,
I need a query to display all the level of BOM and can be sort by create / update date.
The display of query should be as below:
A (1st level) Parent BOM
B (2nd level) Child BOM 1
B (2nd level) Child BOM 2
C (3rd level) Child BOM 2 - 1
C (3rd level) Child BOM 2 - 2
B (2nd level) Child BOM 3
B (2nd level) Child BOM 4
Below is the BOM query that can only display up to 2nd level and cannot sort by date.
Can someone please help to modify or there is a better query?
Thanks
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem NVARCHAR(Max),CName NVARCHAR(MAX),[Quantity] Numeric(18,2),[UoM] NVARCHAR(MAX),[WareHouse] NVARCHAR(MAX),[IssuMethod] NVARCHAR(MAX),[PriceList] NVARCHAR(MAX))
INSERT Into @BOMDetails
SELECT T1.TreeType ,T0.Father AS [Parent Code], T2.ItemName AS [Parent Description], T0.Code AS [Child Code],
T1.ItemName AS [Child Description], T0.Quantity ,T0.Uom ,T0.Warehouse ,T0.IssueMthd,T0.PriceList
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], ' ', ' ', 0, ' ',' ',' ' , 0 FROM ITT1 T0 INNER JOIN OITM T1
ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Group By T0.Father,T2.ItemName
ORDER BY T0.Father,t0.Code
update @BOMDetails set PItem='' ,PName='' where TreeType='N' or TreeType='P'
Select PItem as[Parent Code] ,PName as [Parent Description],CItem as [Child Code],CName as [Child Description],Quantity,UoM,IssuMethod ,PriceList from @BOMDetailsHi,
Try this query and modify as per your requirement:
SELECT
T0.[Father] as
'Assembly',T0.[code] as 'Component1', t10.[ItemName]
'Description1',T1.[Code] as 'Component2', t11.[ItemName]
'Description2', T2.[Code] as 'Component3', t12.[ItemName]
'Description3', T3.[Code] as 'Component4', t13.[ItemName]
'Description4',T4.[Code] as 'Component5', t14.[ItemName]
'Description5', T5.[Code] as 'Component6', t15.[ItemName]
'Description6'
FROM
ITT1 T0 LEFT OUTER
JOIN ITT1 T1 on T0.Code = T1.Father LEFT OUTER JOIN ITT1 T2 on
T1.Code = T2.Father LEFT OUTER JOIN ITT1 T3 on T2.Code = T3.Father
LEFT OUTER JOIN ITT1 T4 on T3.Code = T4.Father LEFT OUTER JOIN ITT1
T5 on T4.Code = T5.Father LEFT OUTER JOIN ITT1 T6 on T5.Code =
T6.Father left outer join oitm t20 on t0.father = t20.itemcode left
outer join oitm t10 on t0.code = t10.itemcode left outer join oitm
t11 on t1.code = t11.itemcode left outer join oitm t12 on t2.code =
t12.itemcode left outer join oitm t13 on t3.code = t13.itemcode left
outer join oitm t14 on t4.code = t14.itemcode left outer join oitm
t15 on t5.code = t15.itemcode
Thanks & Regards,
Nagarajan -
Update query - updating data from another table.
I have the following tables and data
CREATE TABLE UPD_TEST1
T1_COL1 NUMBER(10),
T1_COL2 VARCHAR2(10 BYTE),
T1_COL3 VARCHAR2(10 BYTE)
INSERT INTO UPD_TEST1 ( T1_COL1, T1_COL2, T1_COL3 ) VALUES (
1, 'raji', 'sis');
INSERT INTO UPD_TEST1 ( T1_COL1, T1_COL2, T1_COL3 ) VALUES (
2, 'manju', 'sis');
INSERT INTO UPD_TEST1 ( T1_COL1, T1_COL2, T1_COL3 ) VALUES (
3, 'chinnu', 'sis');
COMMIT;
CREATE TABLE UPD_TEST2
T2_COL1 NUMBER(10),
T2_COL2 VARCHAR2(10 BYTE),
T2_COL3 VARCHAR2(10 BYTE)
INSERT INTO UPD_TEST2 ( T2_COL1, T2_COL2, T2_COL3 ) VALUES (
1, 'muralee', 'bro');
INSERT INTO UPD_TEST2 ( T2_COL1, T2_COL2, T2_COL3 ) VALUES (
2, 'manoj', 'bro');
INSERT INTO UPD_TEST2 ( T2_COL1, T2_COL2, T2_COL3 ) VALUES (
3, 'manoop', 'bro');
COMMIT;
I need to update the columns of UPD_TEST1 with some values from UPD_TEST2 based on some conditions.
i wanted to update multiple rows at a time.Can it be done using one query..
Anyone please help me.
I have dome some search and got the following query but it can update only one record at a time
UPDATE upd_test1
SET ( t1_col2,t1_col3) =(SELECT t2_col2,t2_col3 FROM upd_test2 WHERE t2_col1 =2)
the following query won't work
UPDATE upd_test1
SET ( t1_col2,t1_col3) =(SELECT t2_col2,t2_col3 FROM upd_test2 WHERE t2_col1 IN (2,3))
ORA-01427: single-row subquery returns more than one row
I wanted to update multiple records at a timebit weird approach though, but you could try merge
SQL> Select * From Upd_Test1;
T1_COL1 T1_COL2 T1_COL3
1 raji sis
2 manju sis
3 chinnu sis
SQL> Merge Into Upd_Test1 A Using Upd_Test2 B
2 On (a.T1_Col1 = b.T2_Col1 and b.t2_col1 in (2,3))
3 When Matched Then
4 Update Set
5 A.T1_Col2 = B.T2_Col2
6 ,a.T1_Col3 = b.T2_Col3;
2 rows merged.
SQL> Select * From Upd_Test1;
T1_COL1 T1_COL2 T1_COL3
1 raji sis
2 manoj bro
3 manoop broVivek L
Maybe you are looking for
-
I went to app store to download battle bears royale then I began playing Plants vs Zombies like a boss, but my ipod touch's screen went black (it stills on). What can I do?
-
I have created a smart playlist, and I have given a bunch of songs ratings of 5 stars, and I want to have the playlist do that. So i pull down the list and hit My Rating, and the next one and hit "is" but I can't edit the amount of stars that the son
-
LMS 4.2 Config Editor bulk config change
I have about 1400 devices in LMS for this one customer. They have 1200+ IOS devices 200 + catos devices my problem is we use 2 differnt change scripts in Config Editor for IOS and CATOS. I have a list of all of the IOS and CATOS devises in txt format
-
When trying to open some PDF's with CS2 I get an error "Could not complete your request because of a program error". I can, however open sokme PDF's but not others and I can open multi page PDF's with no problems. I cannot pin point when it happens.
-
Difference/Dependency of RZ21 and DSW
Please let me know whats the diffrence in configuring CCMS alerts in RZ21 (CEN- SOL) and configuring CCMS in(CEN- SOL) Solution Manager -> DSWP -> Solution Monitoring ?? is Solman-> Solution Monitoring a shortcu way or a WIZARD way to RZ21 (creating