Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATINE ROWTYPES

Status
Not open for further replies.

SpiritOfLennon

IS-IT--Management
Oct 2, 2001
250
GB
Hi
I have the following within a procedure

TYPE type_part_need IS RECORD (
long list of field definitions );

v_part_need = type_part_need;

SELECT *
INTO v_part_need
FROM part_need;

update v_part_need set (
long list of fields to update );

And Oracle 7 doesn't like the use of v_part_need.
Basically what I am trying to do is create a record type using a row definition, setting a variable equal to the record type selecting the records into the variable and then updating certain fields before loading the variable back into the table and it does not like the update statement. Do I have to individually select each field into variables and then load each variable into it's field or is there a shortcut to do this? SOL
I'm only guessing but my guess work generally works for me.
 
Sorry - but you'll have to explicitly identify each column that you want changed.
While your record will hold the values, SQL syntax still requires

UPDATE my_table SET col1=val1, col3 = val3, ......,coln=valn
WHERE.........;
 
That's poo! Thanks for the advice though, I can stop looking for an easy answer now. SOL
I'm only guessing but my guess work generally works for me.
 
Shoot, if it was easy ANYBODY could do it!

However, you might be able to make your code a little shorter with the following:

create or replace procedure poo as
v_part_need part_need%ROWTYPE;
BEGIN
SELECT * INTO v_part_need
FROM part_need
WHERE .....;
.
.
.
END;

This will allow you to omit declaring a long record type.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top