How to update this data ... ?
Hi all,
I got the following query output :-
opn_____qty
1000____
1220____
1400____
1500____2100
1600____
1800____2300
2000____2600
2100____
2600____3000
now, I will write query to update those blank qty with the next opn with qty. which mean I will like the output of this :-
opn_____qty
1000____2100
1220____2100
1400____2100
1500____2100
1600____2300
1800____2300
2000____2600
2100____3000
2600____3000
How should I do this ?
Rgds
Lim
Agreed, as stated LAST_VALUE IGNORE NULLs plus optional INSERT and UPDATE WHERE clauses on MERGE are 10g features.
Nevertheless the fact remains that you are updating 9 rows when you should only be updating 5 which should be regarded as inefficient.
In 9i you could easily add a predicate to the USING clause to only return rows where original qty was NULL, e.g.
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
SQL> MERGE INTO t USING (
2 SELECT opn, new_qty
3 FROM (SELECT opn, qty, MAX (qty) OVER (
4 PARTITION BY grp) new_qty
5 FROM (SELECT t.*, SUM (qty / qty) OVER (
6 ORDER BY opn DESC) grp
7 FROM t))
8 WHERE qty IS NULL) s
9 ON (t.opn = s.opn)
10 WHEN MATCHED THEN
11 UPDATE
12 SET t.qty = s.new_qty
13 WHEN NOT MATCHED THEN
14 INSERT (opn) VALUES (0);
5 rows merged.
SQL> SELECT *
2 FROM t;
OPN QTY
1000 2100
1220 2100
1400 2100
1500 2100
1600 2300
1800 2300
2000 2600
2100 3000
2600 3000
9 rows selected.
SQL> Incidentally a relatively efficient straight SQL solution also exists for 8i by way of the semi-documented /*+ BYPASS_UJVC */ hint, e.g.
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
SQL> UPDATE /*+ BYPASS_UJVC */ (
2 SELECT t.qty, s.qty new_qty
3 FROM (SELECT opn, MAX (qty) OVER (
4 PARTITION BY grp) qty
5 FROM (SELECT t.*, SUM (qty / qty) OVER (
6 ORDER BY opn DESC) grp
7 FROM t)) s, t
8 WHERE s.opn = t.opn
9 AND t.qty IS NULL)
10 SET qty = new_qty;
5 rows updated.
SQL> SELECT *
2 FROM t;
OPN QTY
1000 2100
1220 2100
1400 2100
1500 2100
1600 2300
1800 2300
2000 2600
2100 3000
2600 3000
9 rows selected.
SQL>
Similar Messages
-
How to update the data in sqlserver table using procedure in biztalkserver
Hi,
Please can any one answer this below question
how to update the data in sqlserver table using procedure in biztalkserver
while am using executescalar,typedprocedure getting some warning
Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
Please send me asap....
Thanks...Hi Messip,
A detailed error would have helped us to answer you more appropriately but
You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
Maheshkumar
S Tiwari|User
Page|Blog|BizTalk
2013: Inserting RawXML (Whole Incoming XML Message) in SQL database -
How to update transaction data automatically into MySQL database using PI
Dear All,
With reference to subject matter I want a sincere advice regarding how to update transaction data automatically into MySQL database using PI. Is there any link available where I can get step-by-step process.
Ex: I have a MYSQL database in my organization. Whenever a delivery created in SAP some fields like DO Number, DO quantity, SO/STO number should get updated in MYSQL database automatically.
This scenario is related to updation of transactional data into MYSQL DB and I want your suggestions pertaining to same issue.
Thanks and Regards,
Chandra SekharHi .
Develop a sceanrio between SAP to Database system,When the data updates in SAP Tables read the data and update it in DATA Base using JDBC adapter,but there will be some delay in updating data in MySQL.
serach in sdn for IDOC-TOJDBC sceannario,many documents available for the same.
Regards,
Raja Sekhar -
How to update cgicmd.dat file during runtime?
I'd like to know how do update cgicmd.dat file during runtime. For example, I run a report one.jsp as
http://<machine>:<port>/reports/rwservlet?one.jsp&USERID=uid/pwd@db&DESTYPE=cache&mode=bitmap&desformat=htmlcss
within this report there is a hyperlink to open another report named two.jsp.
before creating this hyperlink, I'd like to update cgicmd.dat file with passed in userID, pwd, and connection, so two.jsp can use this key for userinfo
so I can create hyperlink as follows
srw.set_hyperlink('/reports/rwservlet?report=two.jsp'||
'&cmdkey=userinfo&DESTYPE=cache&mode=bitmap&desformat=htmlcss');
ThanksTo my knowledge the cgicmd.dat is only read when the OC4J starts, so you would have to come up with another solution. Using Single-Sign-On (SSO) is quite a good idea, and it's there for cases like this.
Regards,
Martin Malmstrom -
How to UPDATE MASTER DATA RECORD PA0377 using FM HR_INFOTYPE_OPERATION
How to UPDATE MASTER DATA RECORD IN INFOTYPE 0377 DIRECTLY using function module HR_INFOTYPE_OPERATION ? When i use operation = 'MOD' im getting an ERROR as NO DATA STORED FOR 0377 IN SELECTION PERIOD.
Can anyone please help me how to use HR_INFOTYPE_OPERATION to UPDATE MASTER DATA RECORD.
Thanks,
Karthi.Hi,
please check this code
it is very useful
infotypes: 0105.
parameters: p_pernr type p0105-pernr,
p_subty type p0105-subty,
p_begda type p0105-begda,
p_endda type p0105-endda,
p_opera type pspar-actio,
p_usrid type p0105-usrid,
p_commt as checkbox. "Useful only when NO_COMMIT is 'X'
data: w_return type bapireturn1, "Error handling data
w_key type bapipakey, "If record has been created or changed the created/ changed
"record's key (PSKEY) will be populated
v_message type string. "For printing returned messages
call function 'BAPI_EMPLOYEE_ENQUEUE'
exporting
number = p_pernr
importing
return = w_return.
if w_return is initial. "Employee is not locked
p0105-pernr = p_pernr.
p0105-subty =
p0105-usrty = p_subty.
p0105-begda = p_begda.
p0105-endda = p_endda.
p0105-usrid = p_usrid.
*Calls Internally HR_MAINTAIN_MASTERDATA
call function 'HR_INFOTYPE_OPERATION'
exporting
infty = '0105'
number = p_pernr
subtype = p_subty
validityend = p_endda
validitybegin = p_begda
record = p0105
operation = p_opera
dialog_mode = '0'
nocommit = 'X'
importing
return = w_return
key = w_key.
endif.
if w_return is not initial.
message id w_return-id type w_return-type number w_return-number
with w_return-message_v1 w_return-message_v2 w_return-message_v3
w_return-message_v4 into v_message.
case w_return-type.
when 'A' or 'E'.
format color col_negative. write:/ v_message.
when others.
format color col_heading. write:/ v_message.
endcase.
call function 'BAPI_EMPLOYEE_DEQUEUE'
exporting
number = p_pernr.
else.
format color col_positive. write:/ 'Record Updated Successfully.'.
if w_key is not initial.
write:/ 'Key contains',
/ 'Personnel Number:', w_key-employeeno,
/ 'Subtype (absence type):', w_key-subtype,
/ 'Start date of Absence:', w_key-validbegin,
/ 'End date of Absence:', w_key-validend.
endif.
commit work.
endif.
Thanks and regards
durga.K -
How to update additional data for a premise in ISU?
Hi Experts,
Does any1 have any ideas about how to update additional data (Such as number of premises, flat area) for a premise? I mean not use ISU_DB_EWA_VBS_UPDATE directly. I tried to use ISU_S_PREMISE_CHANGE to update the data, but I do not konw how to use the parameters, can any1 help?
Thx in advance, points will be rewarded.
Vincent.Hi Vincent,
Here is an example coded by me. Hope this is useful to you. If so, please reward points.
l_premise = '0000004454'.
CALL FUNCTION 'ISU_S_PREMISE_PROVIDE'
EXPORTING
x_vstelle = l_premise
x_wmode = '1'
X_TEILOBJ =
IMPORTING
Y_OBJ =
y_auto = x_auto
EXCEPTIONS
not_found = 1
foreign_lock = 2
general_fault = 3
not_authorized = 4
invalid_wmode = 5
OTHERS = 6.
IF sy-subrc <> 0.
ENDIF.
x_auto-evbsd-haus_num2 = '99999'.
CALL FUNCTION 'ISU_S_PREMISE_CHANGE'
EXPORTING
x_vstelle = l_premise
x_upd_online = 'X'
x_no_dialog = 'X'
x_auto = x_auto
X_OBJ =
X_NO_OTHER =
IMPORTING
Y_DB_UPDATE =
Y_EXIT_TYPE =
Y_NEW_EVBS =
EXCEPTIONS
not_found = 1
foreign_lock = 2
input_error = 3
general_fault = 4
not_authorized = 5
OTHERS = 6.
IF sy-subrc <> 0.
ELSE.
COMMIT WORK.
ENDIF.
Thanks,
Pranjal. -
How to update additional data for Premise in ISU?
Hi Experts,
Does any1 have any ideas about how to update additional data (Such as number of premises, flat area) for a premise? I mean not use ISU_DB_EWA_VBS_UPDATE directly. I tried to use ISU_S_PREMISE_CHANGE to update the data, but I do not konw how to use the parameters, can any1 help?
Thx in advance, points will be rewarded.
Vincent.Hi Vincent,
Here is an example coded by me. Hope this is useful to you. If so, please reward points.
l_premise = '0000004454'.
CALL FUNCTION 'ISU_S_PREMISE_PROVIDE'
EXPORTING
x_vstelle = l_premise
x_wmode = '1'
X_TEILOBJ =
IMPORTING
Y_OBJ =
y_auto = x_auto
EXCEPTIONS
not_found = 1
foreign_lock = 2
general_fault = 3
not_authorized = 4
invalid_wmode = 5
OTHERS = 6.
IF sy-subrc <> 0.
ENDIF.
x_auto-evbsd-haus_num2 = '99999'.
CALL FUNCTION 'ISU_S_PREMISE_CHANGE'
EXPORTING
x_vstelle = l_premise
x_upd_online = 'X'
x_no_dialog = 'X'
x_auto = x_auto
X_OBJ =
X_NO_OTHER =
IMPORTING
Y_DB_UPDATE =
Y_EXIT_TYPE =
Y_NEW_EVBS =
EXCEPTIONS
not_found = 1
foreign_lock = 2
input_error = 3
general_fault = 4
not_authorized = 5
OTHERS = 6.
IF sy-subrc <> 0.
ELSE.
COMMIT WORK.
ENDIF.
Thanks,
Pranjal. -
Can someone please just help me figure out how to update this stupid phone(iPhone 4)without losing anything? I somehow have more than one Apple ID on this,but I just want my music and my pictures to stay and I'm terrified of losing these things. I have a lot of music from old CDs on here,and for some reason I can't even transfer them manually onto my computer. I'm not tech savvy whatsoever. Someone please help,having my music is the the whole reason I still have this phone.
First read about back http://support.apple.com/kb/ht1766
Then read on how to transfer photos to your computer http://support.apple.com/kb/ts3195
Then
UPDATING iOS
Over the air updating of iOS needs iOS 5 or later so unless you have iOS 5 or later you will not see updating in setting
The following link explains how to update http://support.apple.com/kb/HT4972
This link explains how to update using wireless http://support.apple.com/kb/HT4623
This explains how to transfer purchases to your computer http://support.apple.com/kb/ht1848 -
How i take an old back form my old iphone to my new iphone?!when i acces icloud from my phone and go to manage storage i have 4 back up for diferent phone how can acces this data?!
Thanks very much!
Although I had to add everything again to the playlist, at least I can just copy it over in future! -
Can't seem to change the Document Properties > Advanced > Reading Options in a Form that was created in Adobe LiveCycle. This option has been "greyed" out - anyone know how to update this to English so I can pass Accessibility Testing?
LiveCycle forms use a very different approach to create a PDF form than Acrobat and that approach makes many features for processing PDFs non-functional.
You might want to ask this question in one of the LiveCycle product forums. -
HT1222 How to update this phone ?
How to update this phone ?
If your on IOS 5 you can update thru your phone via wifi and plugged into a wall charger.
If your not on IOS 5 then plug your phone to your computer open iTunes and then update that way, itunes should automatically see that an update is needed. Suggest you backup your phone first then update. -
How to set this DATS parameter
Hi Pros,
I am calling function 'HR_FORMS_TIM_GET_B2_RESULTS' in the program , its input parameter is BEGDA, I transfer a date variable to BEGDA, but does not work. can not get any data. but if I run this function in SE37, I input date '20140807', successfully get result. please tell me how to set this DATS parameter?Hi,
You might be passing the date in '12.12.2014' or '12/12/2014' format. Please
use the function module 'CONVERSION_EXIT_BEGDA_INPUT' to convert the date
to internal format and then pass it to the function module.
Thanks -
How to update the data the transparent table CKMLMV013 ?
How to update the data the transparent table CKMLMV013 ?
can you please replay asap.
thanks,
sambaHi,
if you do a "where used" search of the table CKMLMV013 you will see that it is updated in several places:
e.g. fm CKML_ORDER_CONNECTION_UPDATE
Have a look at those places where the table is updated.
Best regards. -
HT4623 i have download 6.1 update softwer now how i update this to my iphone 4
i have download 6.1 update softwer now how i update this to my iphone 4
Using itunes right? plug iphone 4 to your computer then pressing "Shift" and click restore iphone. Dialog would come out, just select your 6.1 file.
-
How to Update the data in R/3 From BW
Hi All ,
I Need some suggestion . i want to update the data of MARC table in R/3 from BW . Here data goes from BW to R/3 . so How to do this ? . There are no standard BAPI's in BW for this .
Thanks
Prithvi.Hi,
The scenario you are explaining is little opposite to what happens generally. Are you sure, you want to update R/3 from BW?
If you have to update MARC table that means you have to extend the material for different plants. Try using BAPI_MATERIAL_SAVE_DATA.
Regards,
Ravi
Note : Please mark all the helpful answers
Maybe you are looking for
-
Installing second instance of directory in common root.
Is it possible to install a second instance of a directory server in a common base directory? For example: /user/netscape/server4/slapd-first-server /user/netscape/server4/slapd-second-server I'm using the iAS 6.0 installer. I've installed the first
-
I recently updated my iPod 60 GB with version 1.2 and now the screen has lines, the iPod locks up, and I am having difficulty syncing. I am currently restoring and it seems to be progressing, but there are still lines on the screen; graphic garbage.
-
Does making more classes or incapsulation effect perfoemance?
I have a Frame with a TabbedPane on it. There are 8 tabs. Each tab contains a JTable with lots of fields & 4 buttons. When I design all this stuff in JBuilder all panels are put into one class (...Frame class). I want to put every tab's JPanel into a
-
Unable to execute HFMAudit Command line utility
Hi All, We are going to use HEMAudit extract utility for extracting data &task audit tables.Hope All of you aware of that we can use this utility in two ways.One is through Wizard another one is thorugh commandline...We tried to execute the utility t
-
hi I'm trying to download a file from some sites. The downloading window is open, i'm pressing on the "download" button but the the downloading always fails. Does anybody have an idea why this is happenning? thanks