Generate data with attributes related

alvimbh

Member
I need to populate a table using the data generator, but this table have two attributes that are related by a business rule. These two attributes are foreign key to the same table.

Table A
Fields:
- ID_A
- Type

Table B
Fields:
- ID_A_base
- ID_A_reference
- Relationship

Table C (table where I need to generate the data)
Fields:
- ID_C
- ID_A_base
- ID_A_reference (this depends on the value that was generated in ID_A_base)

This would be possible in the data generator?
 
Last edited:
To populate ID_A_Base you can use this list expression:

List(select id_a from table_a)

To populate ID_A_Reference you can use this list expression:

List(select id_a_reference from table_b where id_a_base = :id_a_base)

See chapter 21.9 in the User's Guide for more details.
 
Hi Marco, i try it but receive ORA-01008 error.
This error occurs when not all parameters are informed.
I use PL/SQL version 7.0.3.1123.
This is a feature of newer version?

i cant locate this in my User Guide.
 
:(
This feature is implemented on version 9.
Thanks for help Marco. I will verify if we have license for upgrade.

Data Generator enhancements
The following enhancements have been made to the Data Generator:

SQL() expression now accepts bind variables for other field values.
For example: SQL('Department ' || :deptno)
LIST(select) expression now accepts bind variables for other field values.
For example: LIST(select empno from emp where deptno = :deptno)
SQL() expression now accepts a select statement with a single column/row result.
For example: SQL(select count(*) from order_lines where order_id = :order_id)
 
Back
Top