Hi Team.
I hope you could please assist me with this one. I have 4 table as per below.
Users Table
column name
| type
|
|---|
| User_id (pk) | Number (generated by SQ) |
| Email_address (u) | Varchar2 |
| Password | Varchar2 |
| Created_by | Varchar2 |
| |
users_pk01(user_id)
users_un01(email_address)
Billing_Accounts table
column name
| type
|
|---|
| Billing_account_id (pk) | Number (generated by SQ) |
| Business_name | Varchar2 |
| created_by | varchar2 |
billing_accounts_pk01(billing_account_id)
Organizations table
Column name
| type
|
|---|
| Organization_id(pk) | number (generated by SQ) |
| billing_account_id (fk) (organization_fk01 (billing_account_id)) | number |
| Created_by | Varchar2 |
organization_users_pk01 (organization_user_id)
organization_users_un01 (organization_id, user_id)
organization_users_fk01 (organization_id)
organization_users_fk02 (user_id)
Organizations_users table
Column
| type
|
|---|
| Organization_user_id(pk) | number (generated by SQ) |
| Organization_id(uf) | number |
| user_id(uf) | number |
| created_by | varchar2 |
| |
organization_users_pk01 (organization_user_id)
organization_users_un01 (organization_id, user_id)
organization_users_fk01 (organization_id)
organization_users_fk02 (user_id)
So what happens is that when a user registers their details an insert occurs into the Users Table then the user has to create a billing account so when the insert into billing account happens i want the user_id (already in the users table) to be inserted into the Organizations_users table and the billing_account_id for this same user from the Billing_Accounts table to be inserted into Organizations table. for the same user