首页 > 解决方案 > 如何使用 postgresql 为以下输入格式在存储过程中插入/更新多列

问题描述

{
        "customer_id": 1000,
        "customer_gst_no": "sfdsfds23232",
        "customer_name": "abi",
        "status": true,
        "created_by": 1008,
        "created_on": "1961-06-16",
        "modified_by": 1008,
        "modified_on": "1961-06-16",
        "tbl_address_info": [
            {
                "customer_id": 1000,
                "customer_address_id": 2000,
                "customer_address": 1000,
                "customer_city": "Tirunelveli",
                "customer_pincode": "628777",
                "customer_state": "Tamil Nadu",
                "state_id": 1,
                "status": true,
                "is_default": true,
                "created_by": 10000,
                "created_on": "1961-06-16",
                "modified_by": 20000,
                "modified_on": "1961-06-16",
                "customer_country": "India"
            }          
        ],
        "tbl_product_info": [
            {
                "customer_id": 1000,
                "customer_product_id": 3000,
                "product_code": 1,
                "product_name": "product1",
                "product_status": "1",
                "product_id": 1,
                "created_by": 10000,
                "created_on": "1961-06-16 00:00:00",
                "modified_by": 20000,
                "modified_on": "1961-06-16 00:00:00"
            },
            {
                "customer_id": 1000,
                "customer_product_id": 3001,
                "product_code": 2,
                "product_name": "product2",
                "product_status": "1",
                "product_id": 2,
                "created_by": 10000,
                "created_on": "1961-06-16 00:00:00",
                "modified_by": 20000,
                "modified_on": "1961-06-16 00:00:00"
            }
        ]
    }

这是我拥有的数据格式。如何传递这整个数据在多个表中插入值tbl_address_infotbl_product_info?另外,将整个数据读入过程的数据类型是什么?

标签: postgresqlstored-procedurespgadmin

解决方案


推荐阅读