[SQL] Best way to store Master-Detail Data
От | Alvin Díaz |
---|---|
Тема | [SQL] Best way to store Master-Detail Data |
Дата | |
Msg-id | BN6PR17MB13800E701DD70F7449956699E7020@BN6PR17MB1380.namprd17.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: [SQL] Best way to store Master-Detail Data
Re: [SQL] Best way to store Master-Detail Data |
Список | pgsql-sql |
Hi. I wan to to know if someone can recommend me the best way to store header and detail data in the same function. For example: I have a table for purchase orders headers and a table for the detail then i want to record the header and detail under the same function to make sure that both header and detail are committed or not. What i usually do is create a function with such as parameters as fields in the header table and after that, i add a same data type parameter for each field in the detail but as an array. In the function, i insert the header data, after that i use a loop on the first array parameter, how each array parameter has the same length, i use the ordinal position to insert the lines.
В списке pgsql-sql по дате отправления: