Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Merging two %rowtype variables in plsql

ashish.kelMay 25 2015 — edited May 26 2015

Hi

CREATE TABLE ASH1

(

  NAME  VARCHAR2(5 BYTE),

  ID    NUMBER(2),

  LOC   VARCHAR2(5 BYTE)

);

two plsql variables

output1 ASH1%rowtype;

output2 ASH1%rowtype;

output1.Name := 'Ash';

output1.ID := 1;

output2.Location := 'Asia';

By doing my transformation from multiple incoming feeds, I would be preparing the final data for populating the record to this table ASH1.

The functions are all existing as a part of the legacy code, and no code change possible there.

1. Ie, I have one function which would populate the columns Name and ID and gives me a record type of ASH1  ( ie,. output1  ASH%ROWTYPE ; )

2. I have another one which will give me output2 ( ASH1%ROWTYPE ; ) but it would have only Location populated.,


To get the final output, I have to merge these two individual plsql recrod type variables into one into one and then, only then write to the table in one shot.

( For that there is a  legacy function which accepts the input as record of ASH1%ROWTYPE)

output1 would always have Location NULL.

output2 would always have Name and ID NULL;

NameIDLocation
Ash1
Asia

NameIDLocation
Ash1Asia


I checked all around, could not find anything to merge the output1 and output2 together.


I was so confident that this was a simple requirement when I took it up .


But now it is not. The structure shown here is a sample one. Actual ones are pretty big, Sizes vary from 60 , 70, and 100 , Things not looking so great now

Is there any functions/packages already, which I am missing to check ?

Or I have to really put the foot hard and write some repetitive code ?

Please advise

Thanks

Ashish/-

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2015
Added on May 25 2015
5 comments
1,618 views