How to assign values of object type attributes to different object type with same attribute properties in plsql?

Boreddo

I have two different types with same attributes. I need to assign the values of the first type's attributes to other one. They are exactly the same apart from the schemas and object names.

CREATE OR REPLACE TYPE SCHEMA_A.type_A AS OBJECT(XCOL VARCHAR2(80), YCOL VARCHAR2(80), ZCOL CHAR(2));

CREATE OR REPLACE TYPE SCHEMA_B.type_B AS OBJECT(XCOL VARCHAR2(80), YCOL VARCHAR2(80), ZCOL CHAR(2));

I can assign values one by one by hand like below but reality there are over 80 attributes. Is there a more elegant way to achive the same effect?

SCHEMA_A.type_A.XCOL := SCHEMA_B.type_B.XCOL;
SCHEMA_A.type_A.YCOL := SCHEMA_B.type_B.YCOL;
...
Belayer

AFAIK You are pretty much stuck with with attribute-by-attribute assignment. That is a by-product of creating 2 type the same - that is your major error. But there a 2 possible solutions:

  1. Create a common schema with just 1 type then update the references to the common schema.
  2. Write a function that takes the 2 types as parameters, source and destination, and does the attribute-by-attribute copy. Your code then just calls the function.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Naming an object that is an attribute of another object with the same getter/setter as Object Type

From Dev

Naming an object that is an attribute of another object with the same getter/setter as Object Type

From Dev

Copying attribute between different models' object but with the same attributes name

From Dev

Trying to assign an object to an object of different type in C++

From Dev

Trying to assign an object to an object of different type in C++

From Dev

How can I give multiple input values in PLSQL using record type, object and constructor?

From Dev

How to parametrize object by the same type as the given object?

From Dev

How to create an object using same type of object

From Dev

Different property list for a type and an instant of the same object?

From Dev

Assign Values to object properties by Id

From Dev

assign values to object properties dynamically

From Dev

Assign Values to object properties by Id

From Dev

How to iterate over object with css properties and assign to style attribute?

From Dev

Automapper How to devide properties from one object to properties of two objects same type

From Dev

How to generate same object with different values into an ArrayList?

From Dev

Different type object passing

From Dev

Mapping same object type properties in a class invokes Equals and GetHashCode

From Dev

Assign custom object into Object type variable in SSIS

From Java

Turn an object of Object into an object of different type?

From Dev

Loop through an object's properties and get the values for those of type DateTime

From Dev

How to update values in collection type object

From Dev

How to correctly type a function that maps object values?

From Dev

Comparing Class Properties of type Object

From Dev

Comparing Class Properties of type Object

From Dev

How to configure pay load type router for type of list of different object?

From Dev

How to add object at the beginning of the list in ArrayAdapter if the object is different data type?

From Dev

How to add object at the beginning of the list in ArrayAdapter if the object is different data type?

From Dev

NoSuchMethod: Parameter comparisson differs. Same type, different object

From Dev

Access different tables using the same type of object (NHibernate, C#)

Related Related

  1. 1

    Naming an object that is an attribute of another object with the same getter/setter as Object Type

  2. 2

    Naming an object that is an attribute of another object with the same getter/setter as Object Type

  3. 3

    Copying attribute between different models' object but with the same attributes name

  4. 4

    Trying to assign an object to an object of different type in C++

  5. 5

    Trying to assign an object to an object of different type in C++

  6. 6

    How can I give multiple input values in PLSQL using record type, object and constructor?

  7. 7

    How to parametrize object by the same type as the given object?

  8. 8

    How to create an object using same type of object

  9. 9

    Different property list for a type and an instant of the same object?

  10. 10

    Assign Values to object properties by Id

  11. 11

    assign values to object properties dynamically

  12. 12

    Assign Values to object properties by Id

  13. 13

    How to iterate over object with css properties and assign to style attribute?

  14. 14

    Automapper How to devide properties from one object to properties of two objects same type

  15. 15

    How to generate same object with different values into an ArrayList?

  16. 16

    Different type object passing

  17. 17

    Mapping same object type properties in a class invokes Equals and GetHashCode

  18. 18

    Assign custom object into Object type variable in SSIS

  19. 19

    Turn an object of Object into an object of different type?

  20. 20

    Loop through an object's properties and get the values for those of type DateTime

  21. 21

    How to update values in collection type object

  22. 22

    How to correctly type a function that maps object values?

  23. 23

    Comparing Class Properties of type Object

  24. 24

    Comparing Class Properties of type Object

  25. 25

    How to configure pay load type router for type of list of different object?

  26. 26

    How to add object at the beginning of the list in ArrayAdapter if the object is different data type?

  27. 27

    How to add object at the beginning of the list in ArrayAdapter if the object is different data type?

  28. 28

    NoSuchMethod: Parameter comparisson differs. Same type, different object

  29. 29

    Access different tables using the same type of object (NHibernate, C#)

HotTag

Archive