Update in procedure
This update statement works fine on its own but when it is in the procedure nothing gets updated. I was wondering why this occurs.
update table
set end_date = to_date(End_Date, 'dd-mon-rrrr'),
action_num = 51
where id = valid id
the procedure is as follows:
for cur1 in Child_Cur loop
for Cur2 in Parent_Cur(child_id) loop
end_date = cur2.end_date
update statement from above
commit
end loop
end loop
cur1 selects all the child information
cur2 selects the parent_id and end date of the parent.
Assuming that end_date = cur2.end_date is a typo in posting (it should be := for assignment), there may be confusion between the variable end_date and the two different columns named end_date.
Further, you are updating the parent cursor and committing inside the loop which should raise a fetch out of sequence error. I would guess that in your procedure, you have:
EXCEPTION WHEN OTHERS THEN
NULL;or something similar that traps and mask the error. This is probalby the slowest way to do it. The updaet can (and should) be done in a single sql statement. Something like:
UPDATE parent_table p
SET end_date = (SELECT end_date
FROM child_table c
WHERE p.id = c.id)
WHERE p.action_num = 51 and
EXISTS (SELECT end_date
FROM child_table c
WHERE p.id = c.id)TTFN
John
Similar Messages
-
i lost my adobe flash player on my powerbook g4. what update or procedure do i use to get back video usage.
re-download it. If you don't know how, googe "dowlnoad adobe flashplayer". Also, this is the MacBook Pro forum and you have a Powerbook.
-
Fuba or report to update calculate procedure in crm
hello experts,
please I need Your help.
Tell me please the Fuba or the report to update new configurations in the used calculate procedure.
I use the transaction sm53 to delete the cache, but no help.
Two messages give me the system
the obligatory condition type is missing
or
the condition type MWST is not in the calculate procedure
The messages are nuts because the condition type is in the calculate procedure
and the condition type is not obligatory.
thank You for Your answers.
Bye and have a good time
ThorstenAre you sure that is the FM used ? I have checked and in the export parameter i haven't found ANSAL anywhere, which is strange validating and not passing it.
Try tracing the RFC's called (transaction ST01) and see if there is another FM being called to return ANSAL.
I am more incline towards these :
HRWPC_RFC_EP_READ_SALARY
HRWPC_RFC_EP_READ_SALARY2
As for the question itself, the ANSAL field is only calculated through customizing, and if there isn't any is a regular input field that won't be taken into account during Payment calculation, so i don't think there is any problem in updating it. -
Update stored procedure syntax
Can someone post an example of a stored procedure that is used to update a row in a table with a primary key.... thought it would be easy enough to find an eg on google but no luck so far.
CheersHey if you dont have the Primay Key or Any other key
then for updating the table records, always use the
Rowid "ABC" in you select statements ie in the Cursor
and then alsways use that RowId in your update
statements.
It will work fast & 100% correct also.!!!!I would have thought the statement:
Can someone post an example of a stored procedure that is used to update a row in a table with a primary key
would be good indication that it has a primary key.
And if you're talking about updating rows from a cursor then surely it would be easier to use a CURSOR ... FOR UPDATE statment and then UPDATE ... WHERE CURRENT ... to update the current row. Why the need for using ROWID's? -
Update pricing procedure in PO
Hi,
I am having a problem in updating the pricing procedure in PO.
Earlier in inforecord, we had a couple of condition types which has been removed now. For the current validity period of the inforecords only the basic price condition is there. But there are certain POs which were created at that time are still having the condition types.
When I redetermine the pricing procdure by clicking on the UPDATE button in conditions tab, it is giving me the pop up where I chose the B- Carry out new pricing. But nothing is happening in the PO. It is not giving me any message rather the pricing procedure is not getting redetermined.
Note: In development and quality systems, I am able to update the current pricing procedure without any issue.
Please help me to find out the possible reasons.
Version we are using ECC 5.0Hi,
First go in OMHJ, here maintain Condition type (For which you want to carry out new pricing), Condition origin (1 - Customizing / 2 - Pricing), Condition Table
Then Run Transaction MEI4 in SA38 which is creation of worklist for automatic document adjustment
Then Execute Transaction MEI1 - Automatic Document Adjustment of Individual Documents
OR MEI2 - Mass Processing of Automatic Document Adjustment -
How to Edit and update a Procedure belonging to other owner
1) How do i edit a stored procedure
2) After editing it how can i update it in other users logYou need resource privilege to recreate a procedure in another user's schema, CREATE ANY PROCEDURE.
Then you need access to the source code. Offline access is best. The data dictionary won't let you see package bodies belonging to other users from the ALL_SOURCE view, but should from DBA_SOURCE. GUI tools like TOAD and SQL Developer may let you see other users source but this will depend on the editor. Likewise the GUI tools may/may not let you edit others users code when you have privileges.
Generally, you don't "edit" stored procedures. You get the source, use an editor to modify the source, and replace it with the new code. Its best to keep offline backups of source while you are working on it, especially if you are using a GUI tool where a botched editing session will corrupt the online copy.
If using SQL*PLUS to recreate another user's stored procedure you need to prefix the create command with the username, something like
create or replace package scott.my_package ...which may not be necessary if you're using a GUI tool.
Message was edited by (content):
riedelme -
SQL Server Service Broker Updating Stored procedure
how can you update the service broker stored procedure. when i update the stored procedure the changes dont come into affect. i have tried to alter the queue, waited for all jobs to finish, but some how still the old stored procedure is running. is there any
way i can force changes to the stored procedure.
i have tried sql profiler tracing but that didnt show any changes.
I cannot alter the service broker stored procedure, when I update the stored procedure it does not show any error and successfully gets updated but the changes does not come into affect.
Is it because I need to stop the queue of the service broker on both databases before the changes could come into affect?
Note: the service broker stored procedures produce and read xmls.Presumably, this is because the procedure is executing when you alter the procedure. And if the procedure never exits, the old code will keep on running. One way to address this is to have the procedure to return if a new message has not been picked up in,
say, 1000 milliseconds.
Here is a repro to shows what I'm talking about.
------------------------------- Service Broker Objects ------------------------------------------
CREATE MESSAGE TYPE OrderRequest VALIDATION = NONE
CREATE MESSAGE TYPE OrderResponse VALIDATION = NONE
go
CREATE CONTRACT OrderContract
(OrderRequest SENT BY INITIATOR,
OrderResponse SENT BY TARGET)
go
CREATE QUEUE OrderRequests WITH STATUS = OFF
CREATE QUEUE OrderResponses WITH STATUS = ON
go
CREATE SERVICE OrderRequests ON QUEUE OrderRequests (OrderContract)
CREATE SERVICE OrderResponses ON QUEUE OrderResponses (OrderContract)
go
-- Procedure to send a message and receive a response.
CREATE PROCEDURE send_and_get_answer AS
DECLARE @handle uniqueidentifier,
@binary varbinary(MAX)
SELECT @binary = CAST (N'Kilroy was here' AS varbinary(MAX))
BEGIN DIALOG CONVERSATION @handle
FROM SERVICE OrderResponses
TO SERVICE 'OrderRequests'
ON CONTRACT OrderContract
WITH ENCRYPTION = OFF
;SEND ON CONVERSATION @handle
MESSAGE TYPE OrderRequest (@binary)
WAITFOR (RECEIVE TOP (1)
@handle = conversation_handle,
@binary = message_body
FROM OrderResponses)
SELECT cast(@binary AS nvarchar(MAX)) AS response
END CONVERSATION @handle
go
-- Procedure to process a message
CREATE PROCEDURE ProcessOrders AS
SET NOCOUNT, XACT_ABORT ON
DECLARE @DialogHandle uniqueidentifier,
@MessageType sysname,
@binarydata varbinary(MAX)
-- Get next message of the queue.
WAITFOR (
RECEIVE TOP (1) @DialogHandle = conversation_handle,
@MessageType = message_type_name,
@binarydata = message_body
FROM OrderRequests
SELECT @binarydata = CAST( reverse( CAST( @binarydata AS nvarchar(MAX) )) AS varbinary(MAX))
; SEND ON CONVERSATION @DialogHandle
MESSAGE TYPE OrderResponse (@binarydata)
END CONVERSATION @DialogHandle
go
-- Make this an activaton procedure.
ALTER QUEUE OrderRequests WITH
STATUS = ON,
ACTIVATION (STATUS = ON,
PROCEDURE_NAME = ProcessOrders,
MAX_QUEUE_READERS = 1,
EXECUTE AS OWNER)
go
-------------------------------- Send a message -------------------------------------------
EXEC send_and_get_answer
go
------------------------ Change the procedure --------------------------------
ALTER PROCEDURE ProcessOrders AS
SET NOCOUNT, XACT_ABORT ON
DECLARE @DialogHandle uniqueidentifier,
@MessageType sysname,
@binarydata varbinary(MAX)
-- Get next message of the queue.
WAITFOR (
RECEIVE TOP (1) @DialogHandle = conversation_handle,
@MessageType = message_type_name,
@binarydata = message_body
FROM OrderRequests
SELECT @binarydata = CAST( upper( CAST( @binarydata AS nvarchar(MAX) )) AS varbinary(MAX))
; SEND ON CONVERSATION @DialogHandle
MESSAGE TYPE OrderResponse (@binarydata)
END CONVERSATION @DialogHandle
go
-------------------------------- Send new message -------------------------------------------
EXEC send_and_get_answer -- Still produces a message in reverse.
EXEC send_and_get_answer -- Now we get the expected result.
go
DROP SERVICE OrderRequests
DROP SERVICE OrderResponses
DROP QUEUE OrderRequests
DROP QUEUE OrderResponses
DROP PROCEDURE ProcessOrders
DROP PROCEDURE send_and_get_answer
DROP CONTRACT OrderContract
DROP MESSAGE TYPE OrderRequest
DROP MESSAGE TYPE OrderResponse
go
Erland Sommarskog, SQL Server MVP, [email protected] -
Hi
I have a situation here where some of the contracts picked up wrong pricing procedure as the CMD was not set up correctly. Now the CMD is updated with the right pricing procedure, so is there any way that we can update the pricing procedure of the contracts or we need to end date the old contracts and create new ones?
Thanks
SyedLike Shiva was saying you might need to recreate the contracts (copy them in new ones), so they pick up the right procedure.
You can ask you abaper for BAPI or try LSMW.
Regards
Sidi -
hello all
my question is that i some queries like 7,8 some are updates and some are delete and it needs to b run every day .
can i put them in a procedure and then schedule the procedure .
if yes please tell how should i use execute immediate or what , because some updates r having sub queries as well
waiting for response
yahyayahya wrote:
hello all
my question is that i some queries like 7,8 some are updates and some are delete and it needs to b run every day .
can i put them in a procedure and then schedule the procedure .
if yes please tell how should i use execute immediate or what , because some updates r having sub queries as well
waiting for response
yahya
some queries like 7,8 what do you mean by that?
You do not have to use execute immediate in a procedure unless You want to use DDL Command . just put all DMl in a procedure n schedule it . For scheduling you could use dbms scheduler. You can directly schedule a plsql block as well
Edited by: LoganDBA on Oct 10, 2011 12:33 PM -
HELP! Update Blob procedure
I have some ascii files being stored in our DB as blobs.
These files have been extracted and modified. I need to now write a procedure to have these "old" blobs updated and a status column set to 'NEW' for these.
Anyone have some guidance on this?>
Is this more clear?
>
Not quite.
Did you use sqlloader initially to load the files?
YES ----> do you have an ID column that you use to compare against the data to match the records..?
YES ----> load the data into a new temp table and merge results based on the id column
for records which have "bad files" .. and update the column_name to "good file"
NO ----->You'll have to truncate the table and do a fresh load and have all "good files"A little test case would help... and if the solution does not work for your case, you need to say why? -
K8N Neo4 Platinum Bios Update - Best Procedure?
I have built a new system:
K8N Neo4 Platinum Award Bios Version 1.3
ATHLON XP64 X2 4200+ E4 Stepping
2GB Transcend RAM (2x1GB)
EVGA 6600GT 128MB PCI-E
Samsung Spinpoint 200GB SATA on Sata1
Samsung TS-H522U DVD-RW
Floppy
Seventeam ST-550EAG 3.3V= 30A, 5.0V=30A, 12V1= 18A, 12V2= 18A
Windows XP Pro SP2
I'm not overclocking and DOT is disabled. Optimized parameters are loaded.
System is running but my BIOS version does not support dual core. I have installed all NForce 6.66 drivers and VGA drivers, and all Windows updates. What is the best procedure to flash bios, Winflash or MSI floppy method? What version of BIOS should i try, 1.6 or 1.8?
Thanks.Quote from: hansh on 27-September-05, 16:34:38
Hi, when you ask 10 people about the best method to flash BIOS, you will probably get 10 different answers
Some observations:
1. Flashing under Windows has become "normal procedure" for boards of most other manufacturers; (I will not use this method for my MSI boards, though, because of the negative opinion on it in this forum. If the comments are correct, then the only conclusion can be that MSI software engineers are at present not able to deliver a Window-based flashing program with which MSI-BIOSes can be flashed into MSI boards in a safe way. I'd rather not find out the exact reason for this . I have used Windows-based flashing programs numerous times with boards from other manufacturers - Abit, Asus, Soltek, ECS, etc. without any problem).
2. If the procedure as described by Syar really has significant advantages over "plain flashing", then it means that either the BIOSes are flaky, or the boards are instable. Such precautions have never been necessary and should not be necessary! I can only recommend - just to be on the safe side - that, while flashing, you dance around the computer, carrying two carrots, an onion and chanting "Flash! Flash! Flash!
3. There is something to say for not flashing from a floppy. Floppies are the oldest part of nowadays computers and the medium is probably the least failsafe part ... Therefore I have reserved a small (100 MB) FAT32 partition on a HDD, BIOS files and most recent flashing program will be copied to that partition. I will start the PC with a W98SE bootflop, go to that partition and flash from there. I have used this method a great number of times over the years, I will never add any switch when running the program.
Additional Info
Regards
Hans
Hi hansh,
thanks for that. I'll boot with a Win98 bootCD (NTFS support included) and thinking about flashing with an Iomega USB pen drive (FAT32). Any comments here?
And, blazing storm, thanks again for your valuable reply. -
Hello,
i have 2 tables called EMWP and DPT EMWP holds distinct data, and the other holds all those distinct values a 1 row in DPT table.
I wrote a procedure to get all the data from emwp to dpt table. when i add new row
here is EMWP TABLE
EMWP data
code rlevel tid ind emp_rule upd_logon timestamp
GU00 1 1 S 100 501 sysdate
GU00 1 1 S 101 501 sysdate
GU00 1 1 S 102 501 sysdate
GU00 1 1 S 105 608 sysdate
DR00 2 3 R 100 701 sysdate
DR00 2 3 R 101 701 sysdate
DR00 2 3 R 102 701 sysdate
DR00 2 3 R 104 701 sysdate
DPT data
ccode rlevel tid ind DPTRULENUM upd logon timestamp
GU00 1 1 S 100,101,102 501 sysdate
DR00 2 3 R 151,152,153,154 701 sysdate
WHEN I add a new emp rule row into EMWP table as for example:
GU00 1 1 S 155 608 sysdate
when i run the following procedure it basically replaces the data wholesale from EMWP to DPT table.
when execute this procedure this new emp rule should be added to DPT table as
GU00 1 1 S 100,101,102,105 608 sysdate
basically it should replace the row in DPT which has updlogon 501 data and add this new emprule as 100, 101, 102 and 105 as shown in the above example.
how can interpret in procedure please.
here i am sending the code that i wrote.
CREATE OR REPLACE PROCEDURE GET_dpt
IS
BEGIN
DELETE get_dpt;
FOR c IN (select a.cCODE ,
a.RLEVEL,
a.TID,
a.IND,
rtrim (xmlagg (xmlelement (e, a.emp_rule || ',' )order by a.emp_rule).extract ('//text()'), ',') RULENUM,
a.UPDLOGON,
b.CCODE coc ,
b.RLEVEL level,
b.TID typeid,
b.IND indic
from EMWP a full outer join DPT b on
a.ccode = b.ccode
AND a.rlevel = b.level
AND a.tid = b.tid
AND a.ind = b.ind
Group by a.ccode, a.rlevel, a.tid, a.ind, a.UPDLOGON, b.CCODE,b.RLEVEL, b.TID, b.INDic
order by a.ccode, a.rlevel)
LOOP
BEGIN
IF (c.CCODE = c.COC
AND C.RLEVEL = C.RLEVEL
AND C.tid = C.TID
AND C.IND = C.IND) THEN
insert into dpt (CCODE, RLEVEL, TID, IND, dptrulenum, UPDLOGON, TIMESTAMP)
values (C.CCODE, C.RLEVEL, C.TID, C.IND, C.RULENUM, C.UPDLOGON, SYSDATE);
ELSE
END IF;
EXCEPTION
WHEN OTHERS THEN
END;
end loop;
commit;
END;
/here is the sample data that need to be replaced with new updlogon...
code rlevel tid ind emp_rule upd_logon timestamp
GU00 1 1 S 100 501 sysdate
GU00 1 2 S 101 501 sysdate
GU00 1 3 S 102 501 sysdate
GU00 1 0 S 105 608 sysdate
say for example i add this new to EMWP table
GU00 1 0 S 105 608 sysdate
i have to keep the above sample rows where updlogon = 501 plus 608 in EMWP table, but when inserting or updatingto DPT table i have to make sure to replace the above 3 rows with 501 and 608 rows as one string value with new updlogon in DPT table..
GU00 1 1 S 100,101,102,105 608 sysdate
CREATE OR REPLACE PROCEDURE GET_dpt
IS
BEGIN
DELETE get_dpt;
FOR c IN (select a.cCODE ,
a.RLEVEL,
a.TID,
a.IND,
rtrim (xmlagg (xmlelement (e, a.emp_rule || ',' )order by a.emp_rule).extract ('//text()'), ',') RULENUM,
a.UPDLOGON,
b.CCODE coc ,
b.RLEVEL level,
b.TID typeid,
b.IND indic
from EMWP a full outer join DPT b on
a.ccode = b.ccode
AND a.rlevel = b.level
AND a.tid = b.tid
AND a.ind = b.ind
Group by a.ccode, a.rlevel, a.tid, a.ind, a.UPDLOGON, b.CCODE,b.RLEVEL, b.TID, b.INDic
order by a.ccode, a.rlevel)
LOOP
BEGIN
IF (c.CCODE = c.COC
AND C.RLEVEL = C.RLEVEL
AND C.tid = C.TID
AND C.IND = C.IND) THEN
insert into dpt (CCODE, RLEVEL, TID, IND, dptrulenum, UPDLOGON, TIMESTAMP)
values (C.CCODE, C.RLEVEL, C.TID, C.IND, C.RULENUM, C.UPDLOGON, SYSDATE);
ELSE
END IF;
EXCEPTION
WHEN OTHERS THEN
END;
end loop;
commit;
END;
thank you. -
Update pricing procedure in sales order
hi gurus!
in sales order item, the tax condition type MWST is determined as 17% by the indicator 1 in both customer and material master data. but after i change the material master data to 2, which should lead to 13% in MWST, i update the pricing in sales order item, no matter what options i choose, the 17% won't change!
can i ask that why this is not changing?
how the system control it?
and what for?
thank you so much guys!
BR,Dear Michael,
While Updating your Line-Item in Sales Order, What Pricing Type you are selecting?
Is it Pricing Type: G - Copy pricing elements unchanged and redetermine taxes
Alternatively, You may check with:
Select your Line-Item in Sales Order and Double-Click.
Go to, Tab: Conditions; and Click Tab: Analysis (at bottom of the screen).
Now, on to next screen, Select your Condition Type: MWST (from Left-hand of the screen) and Double Click.
Read the "Overview" (from Right-hand of the screen).
This will tell your the exact reason. Based up on, take corrective actions; else post the same for our understanding/ working.
Best Regards,
Amit -
How can we update procedure in Database Directly
Hi Experts
how can we create a stored procedure in a database directly. for example I made a crystal report with a demo databse, then I want to run that report on production database. for that I have to create stored procedure manually. I want that When I run the report It automatically create stored procedure . or other simple way to create stored procedure
Regards
Gorge
Edited by: Gorge Ance on May 13, 2009 8:09 AMHi
If your field match what you have in demo and production ,all you need to do is run that stored procedure pointing to correct database .So you probable have to change alter to create .
When you go to sql server , you have a choice to run a query of stored procedure against the particular dtabase while you use query analyser .
In crystal report , you have to manually change the datasource and update store procedure.
Your report will now point to production database and point to correct stored procedure .
Hope this helps
Bishal -
Incorrect Update Count by executing a stored procedure from Java
Hi Guys,
I am calling a stored procedure from the java program which is modifying the rows of a table. Now I want to know how many rows have been modified by executing the stored procedure. I am writing the following code for the purpose:
OracleCallableStatement stmt =
(oracle.jdbc.driver.OracleCallableStatement)con.prepareCall("{callsp_um_setForumID(?,?)}");
stmt.setInt(1,101);
stmt.setInt(2,666);
n = stmt.executeUpdate();
System.out.println(n + " row(s) updated");
This procedure is actually modifying the table(When I query the databse it has modified 1 row). But it is returning a value 0 and is printing "0 row(s) updated".
Is there a way by which I can find out the number of rows updated by executing the stored procedure?
Thanks
Sachin
[email protected]I'm no expert on this, but I have a similar call where I fetch
an Oracle REF CURSOR from a call to a stored function. If you
fetch the cursor as an Object from your CallableStatement, you
can then cast it to a ResultSet e.g.
mystatement.executeUpdate();
ResultSet rs = (ResultSet) mystatement.getObject(1);
Then you should be able to loop through your ResultSet as usual.
Good luck!
Chris
Maybe you are looking for
-
My iphone 4s i get this every best to connect to my pc trust this computer for?
my iphone 4s i get this every best to connect to my pc trust this computer for?
-
Archive all the active online redo logs
Hi, in 9.2.0 and in archivelog mode, how can I archive all the active online redo logs ? Thank you.
-
Where are the machines on my network gone?
Hi. I cant for the life of me understand what I've done wrong or am not doing correctly...if that at all. I have created a network with internet sharing from my MacBook Pro's airport connection. Previously all connected computers displayed in my netw
-
Hi! Please help me with this! I upgraded to Yosemite yesterday and also updated the whole iWork set. When I tried to open Pages 5.5, I try to make a new document but as I click "Choose" in the document template selection screen, the app crashes sayin
-
Pics in iphoto are there but open as a grey exclamation point, help!
I impoted pictures from my other computer and it worked for a few months, then it would not open some pics. I can see them when i scroll over all thumbnails or when one picture is open and thumbnails are at the bottom, but when i click to open, the G