Home » RDBMS Server » Server Administration » I Need help either selecting/user prompt and then update that record using PL/SQL.
I Need help either selecting/user prompt and then update that record using PL/SQL. [message #369882] Wed, 01 November 2000 21:57 Go to next message
Shane J. Fabianek
Messages: 3
Registered: November 2000
Junior Member
Hi All,
I have this so far but I am not sure if I need to select or have a prompt to get the record that needs to be updated in a PL/SQL procedure. Here is what I have:

CREATE OR REPLACE PROCEDURE SET_ORDER_STATUS

IS

ACCEPT getid PROMPT "Enter order Header ID: "
SELECT *
FROM emp
WHERE id = UPPER('&getid')

UPDATE order_header
SET status=4
WHERE id=getid;
commit;

UPDATE order_header
SET status=7
WHERE status = 4
and id=getid;
end;

Once I get the record, I then need to update a column in that record twice .

If anyone can help
I would greatley appreciatte it,
Shane
Re: I Need help either selecting/user prompt and then update that record using PL/SQL. [message #369902 is a reply to message #369882] Fri, 03 November 2000 13:40 Go to previous messageGo to next message
Amit Chauhan
Messages: 74
Registered: July 1999
Member
Hi,
I dont know why are you doing it this way !! Whatever you are doing here can be done simply by this script :

ACCEPT id PROMPT Enter the id :
UPDATE order_header
SET status = 7
WHERE id = &&id;

Store this in a file and then run this on the SQL prompt, like this :
SQL>@c:\script.sql
Enter the id : 12

And am not sure why you are selecting from emp table when you are not using any of its values. And second, why are you updating the table twice when eventually the status is going to be updated to 7 and NOT 4.

Hope it helps
Thanks
Amit
Reply to Amit [message #369906 is a reply to message #369902] Mon, 06 November 2000 10:25 Go to previous message
Shane J. Fabianek
Messages: 3
Registered: November 2000
Junior Member
Thanks for the reply; I was trying to create a procedure that would select a record in the order_header table according to it's ID and then update it once, then commit because of a trigger, then update it a second time for a status of being 7 which is shipped.
Previous Topic: Re: more than 2300 archive logs per day
Next Topic: V$SESSION
Goto Forum:
  


Current Time: Fri May 03 11:01:41 CDT 2024