[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  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [SQL] Best way to store Master-Detail Data  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список 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 по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: [SQL] CTEs and re-use
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [SQL] Best way to store Master-Detail Data