Haz
19
2015

JSON Verisinin Ayrıştırılması Jenerik Api ile Kullanılan Örnek Script

Merhaba,

Herhangi bir web kaynağından JSON (JavaScript Object Notation) standardında hazırlanmış özel bir desene sahip verinin PL/SQL ile ayrıştırılması amacıyla kullanılan jenerik bir api ve apinin script olarak uygulanmasının örneğini aşağıda bulabilirsiniz.

json_v1_0_5

Yukarıdaki linkten JSON verisi Yaratmak ve Ayrıştırmak için kullanılan objeler bulunmaktadır.Yükleme Adımları Takip edilerek install işlemi gerçekleştirilir içerisinde gerekli örneklerde mevcuttur.

Aynı zamanda aşağıdaki verilen özel bir desende hazırlanmış JSON verisinin ayrıştırılması ile ilgili scripti bulabilirsiniz.

Tşk.

 
{
  "shops": [
    {
      "approval_delay": NULL,
      "approval_rate": NULL,
      "banner": NULL,
      "billing_info": {
        "bank_city": "Istanbul",
        "bank_name": "Test Akbank",
        "bank_street": "Plaza",
        "bic": "DABAIE2D",
        "iban": "TR330006100519423257841326",
        "owner": "Mustafa Korkmaz",
        "zip_code": "34544"
      },
      "channels": [
        "INIT"
      ],
      "closed_from": NULL,
      "closed_to": NULL,
      "contact_informations": {
        "city": "Istanbul",
        "civility": "Mr",
        "country": "TUR",
        "email": "mustafakorkmz@gmail.com",
        "fax": NULL,
        "firstname": "Levent",
        "lastname": "Bali",
        "phone": NULL,
        "phone_secondary": NULL,
        "state": NULL,
        "street1": "Plaza Test",
        "street2": NULL,
        "web_site": NULL,
        "zip_code": "123456"
      },
      "date_created": "2015-04-28T07:57:27Z",
      "description": NULL,
      "evaluations_count": 0,
      "free_shipping": FALSE,
      "grade": NULL,
      "immunity_date": NULL,
      "is_professional": TRUE,
      "last_updated_date": "2015-04-28T09:10:13Z",
      "logo": NULL,
      "offers_count": 1,
      "operator_internal_id": NULL,
      "order_messages_response_delay": NULL,
      "orders_count": 0,
      "payment_details": {
        "paid_balance": 0,
        "pay_subscription": TRUE,
        "payable_balance": 0,
        "payment_blocked": FALSE,
        "pending_balance": 0,
        "subscription_free_from": NULL,
        "subscription_free_to": NULL
      },
      "payment_info": {
        "@type": "IBAN",
        "bank_city": "Istanbul",
        "bank_name": "Test Akbank",
        "bank_street": "Plaza",
        "bank_zip": "34544",
        "bic": "DABAIE2D",
        "iban": "TR330006100519423257841326",
        "owner": "Mustafa Korkmaz"
      },
      "premium": FALSE,
      "premium_state": "DEFAULT",
      "pro_details": {
        "VAT_number": NULL,
        "corporate_name": "Lila Kutu QA",
        "identification_number": "000000000101",
        "tax_identification_number": NULL
      },
      "return_policy": NULL,
      "shipping_country": NULL,
      "shipping_types": [
        "STD"
      ],
      "shipping_zones": [
        "TR"
      ],
      "shippings": [
        {
          "shipping_free_amount": NULL,
          "shipping_type_code": "STD",
          "shipping_type_label": "Standard (2-7 days)",
          "shipping_zone_code": "TR",
          "shipping_zone_label": "Turkey"
        }
      ],
      "shop_additional_fields": [
        {
          "code": "authorized-signatory-name-surname",
          "value": "Mustafa Korkmaz"
        },
        {
          "code": "authorized-signatory-phone",
          "value": "902123567654"
        },
        {
          "code": "authorized-signatory-secondary-phone",
          "value": "905347658844"
        }
      ],
      "shop_id": 2007,
      "shop_name": "Lila Kutu QA Test Shop",
      "shop_state": "OPEN"
    }
  ],
  "total_count": 1
}
 
DECLARE
   MESSAGE        CLOB
      := '{
  "shops": [
    {
      "approval_delay": null,
      "approval_rate": null,
      "banner": null,
      "billing_info": {
        "bank_city": "Istanbul",
        "bank_name": "Test BANK",
        "bank_street": "Plaza",
        "bic": "DABAIE2D",
        "iban": "TR330006100519423257841326",
        "owner": "Mustafa Korkmaz",
        "zip_code": "34544"
      },
      "channels": [
        "INIT"
      ],
      "closed_from": null,
      "closed_to": null,
      "contact_informations": {
        "city": "Istanbul",
        "civility": "Mr",
        "country": "TUR",
        "email": "mustafakorkmz@gmail.com",
        "fax": null,
        "firstname": "Levent",
        "lastname": "Bali",
        "phone": null,
        "phone_secondary": null,
        "state": null,
        "street1": "Plaza Test",
        "street2": null,
        "web_site": null,
        "zip_code": "123456"
      },
      "date_created": "2015-04-28T07:57:27Z",
      "description": null,
      "evaluations_count": 0,
      "free_shipping": false,
      "grade": null,
      "immunity_date": null,
      "is_professional": true,
      "last_updated_date": "2015-04-28T09:10:13Z",
      "logo": null,
      "offers_count": 1,
      "operator_internal_id": null,
      "order_messages_response_delay": null,
      "orders_count": 0,
      "payment_details": {
        "paid_balance": 0,
        "pay_subscription": true,
        "payable_balance": 0,
        "payment_blocked": false,
        "pending_balance": 0,
        "subscription_free_from": null,
        "subscription_free_to": null
      },
      "payment_info": {
        "@type": "IBAN",
        "bank_city": "Istanbul",
        "bank_name": "Test BANK",
        "bank_street": "Plaza",
        "bank_zip": "34544",
        "bic": "DABAIE2D",
        "iban": "TR330006100519423257841326",
        "owner": "Mustafa Korkmaz"
      },
      "premium": false,
      "premium_state": "DEFAULT",
      "pro_details": {
        "VAT_number": null,
        "corporate_name": "Lila Kutu QA",
        "identification_number": "000000000101",
        "tax_identification_number": null
      },
      "return_policy": null,
      "shipping_country": null,
      "shipping_types": [
        "STD"
      ],
      "shipping_zones": [
        "TR"
      ],
      "shippings": [
        {
          "shipping_free_amount": null,
          "shipping_type_code": "STD",
          "shipping_type_label": "Standard (2-7 days)",
          "shipping_zone_code": "TR",
          "shipping_zone_label": "Turkey"
        }
      ],
      "shop_additional_fields": [
        {
          "code": "authorized-signatory-name-surname",
          "value": "Mustafa Korkmaz"
        },
        {
          "code": "authorized-signatory-phone",
          "value": "902123567654"
        },
        {
          "code": "authorized-signatory-secondary-phone",
          "value": "905347658844"
        }
      ],
      "shop_id": 2007,
      "shop_name": "Lila Kutu QA Test Shop",
      "shop_state": "OPEN"
    }
  ],
  "total_count": 1
}';
   obj            json;
   tempobj        json;
   tempobjchild   json;
   obj_list       json_list;
   tempdata       json_value;
   temp_list      json_list;
 
   TYPE shops_header IS RECORD (
      approval_delay                  NUMBER,
      approval_rate                   NUMBER,
      banner                          VARCHAR2 (750),
      closed_from                     DATE,
      closed_to                       DATE,
      date_created                    DATE,
      description                     VARCHAR2 (1000),
      evaluations_count               NUMBER,
      free_shipping                   VARCHAR2 (10),
      --> orjinal value boolean
      grade                           NUMBER,
      immunity_date                   DATE,
      is_professional                 VARCHAR2 (10),
      --> orjinal value boolean
      last_updated_date               DATE,
      logo                            VARCHAR2 (1000),
      offers_count                    NUMBER,
      operator_internal_id            VARCHAR2 (750),
      order_messages_response_delay   NUMBER,
      orders_count                    NUMBER,
      premium                         VARCHAR2 (10),
      --> orjinal value boolean
      premium_state                   VARCHAR2 (100),
      return_policy                   VARCHAR2 (750),
      shipping_country                VARCHAR2 (750),
      shop_id                         NUMBER,
      shop_name                       VARCHAR2 (750),
      shop_state                      VARCHAR2 (750),
      hash_value                      VARCHAR2 (750),
      update_flag                     VARCHAR2 (1),
      last_update_date                DATE,
      last_updated_by                 NUMBER,
      creation_date                   DATE,
      created_by                      NUMBER,
      last_update_login               NUMBER
   );
 
   TYPE shops_billing_info IS RECORD (
      shop_id             NUMBER,
      bank_city           VARCHAR2 (750),
      bank_name           VARCHAR2 (750),
      bank_street         VARCHAR2 (750),
      bic                 VARCHAR2 (750),
      iban                VARCHAR2 (750),
      owner               VARCHAR2 (750),
      zip_code            VARCHAR2 (750),
      hash_value          VARCHAR2 (750),
      update_flag         VARCHAR2 (1),
      last_update_date    DATE,
      last_updated_by     NUMBER,
      creation_date       DATE,
      created_by          NUMBER,
      last_update_login   NUMBER
   );
 
   TYPE shops_channels IS RECORD (
      shop_id             NUMBER,
      channel_value       VARCHAR2 (750),
      last_update_date    DATE,
      last_updated_by     NUMBER,
      creation_date       DATE,
      created_by          NUMBER,
      last_update_login   NUMBER
   );
 
   TYPE channelstbl IS TABLE OF shops_channels
      INDEX BY PLS_INTEGER;
 
   TYPE shops_contact_informations IS RECORD (
      shop_id             NUMBER,
      city                VARCHAR2 (750),
      civility            VARCHAR2 (750),
      country             VARCHAR2 (750),
      email               VARCHAR2 (750),
      fax                 VARCHAR2 (750),
      firstname           VARCHAR2 (750),
      lastname            VARCHAR2 (750),
      phone               VARCHAR2 (750),
      phone_secondary     VARCHAR2 (750),
      state               VARCHAR2 (750),
      street1             VARCHAR2 (750),
      street2             VARCHAR2 (750),
      web_site            VARCHAR2 (750),
      zip_code            VARCHAR2 (750),
      hash_value          VARCHAR2 (750),
      update_flag         VARCHAR2 (1),
      last_update_date    DATE,
      last_updated_by     NUMBER,
      creation_date       DATE,
      created_by          NUMBER,
      last_update_login   NUMBER
   );
 
   TYPE shops_payment_details IS RECORD (
      shop_id                  NUMBER,
      paid_balance             NUMBER,
      pay_subscription         VARCHAR2 (10),       --> orjinal value boolean
      payable_balance          NUMBER,
      payment_blocked          VARCHAR2 (10),       --> orjinal value boolean
      pending_balance          NUMBER,
      subscription_free_from   DATE,
      subscription_free_to     DATE,
      hash_value               VARCHAR2 (750),
      update_flag              VARCHAR2 (1),
      last_update_date         DATE,
      last_updated_by          NUMBER,
      creation_date            DATE,
      created_by               NUMBER,
      last_update_login        NUMBER
   );
 
   TYPE shops_payment_info IS RECORD (
      shop_id             NUMBER,
      owner               VARCHAR2 (750),
      hash_value          VARCHAR2 (750),
      update_flag         VARCHAR2 (1),
      last_update_date    DATE,
      last_updated_by     NUMBER,
      creation_date       DATE,
      created_by          NUMBER,
      last_update_login   NUMBER
   );
 
   TYPE shops_pro_details IS RECORD (
      shop_id                     NUMBER,
      corporate_name              VARCHAR2 (750),
      identification_number       VARCHAR2 (750),
      tax_identification_number   VARCHAR2 (750),
      vat_number                  VARCHAR2 (750),
      hash_value                  VARCHAR2 (750),
      update_flag                 VARCHAR2 (1),
      last_update_date            DATE,
      last_updated_by             NUMBER,
      creation_date               DATE,
      created_by                  NUMBER,
      last_update_login           NUMBER
   );
 
   TYPE shops_shippings IS RECORD (
      shop_id                NUMBER,
      shipping_free_amount   NUMBER,
      shipping_type_code     VARCHAR2 (750),
      shipping_type_label    VARCHAR2 (750),
      shipping_zone_code     VARCHAR2 (750),
      shipping_zone_label    VARCHAR2 (750),
      hash_value             VARCHAR2 (750),
      update_flag            VARCHAR2 (1),
      last_update_date       DATE,
      last_updated_by        NUMBER,
      creation_date          DATE,
      created_by             NUMBER,
      last_update_login      NUMBER
   );
 
   TYPE shops_shippingstbl IS TABLE OF shops_shippings
      INDEX BY PLS_INTEGER;
 
   TYPE shops_shipping_types IS RECORD (
      shop_id               NUMBER,
      shipping_type_value   VARCHAR2 (750),
      last_update_date      DATE,
      last_updated_by       NUMBER,
      creation_date         DATE,
      created_by            NUMBER,
      last_update_login     NUMBER
   );
 
   TYPE shops_shipping_typestbl IS TABLE OF shops_shipping_types
      INDEX BY PLS_INTEGER;
 
   TYPE shops_shipping_zones IS RECORD (
      shop_id               NUMBER,
      shipping_zone_value   VARCHAR2 (750),
      last_update_date      DATE,
      last_updated_by       NUMBER,
      creation_date         DATE,
      created_by            NUMBER,
      last_update_login     NUMBER
   );
 
   TYPE shops_shipping_zonestbl IS TABLE OF shops_shipping_zones
      INDEX BY PLS_INTEGER;
 
   TYPE shop_additional_fields IS RECORD (
      shop_id             NUMBER,
      code                VARCHAR2 (750),
      VALUE               VARCHAR2 (750),
      last_update_date    DATE,
      last_updated_by     NUMBER,
      creation_date       DATE,
      created_by          NUMBER,
      last_update_login   NUMBER
   );
 
   TYPE shop_additional_fieldstbl IS TABLE OF shop_additional_fields
      INDEX BY PLS_INTEGER;
 
   TYPE shops_structure IS RECORD (
      header                 shops_header,
      billing_info           shops_billing_info,
      channels               channelstbl,
      contact_informations   shops_contact_informations,
      payment_details        shops_payment_details,
      payment_info           shops_payment_info,
      pro_details            shops_pro_details,
      shippings              shops_shippingstbl,
      shipping_types         shops_shipping_typestbl,
      shipping_zones         shops_shipping_zonestbl,
      additional_fields      shop_additional_fieldstbl
   );
 
   TYPE shops_tbl IS TABLE OF shops_structure
      INDEX BY PLS_INTEGER;
 
   p_param        shops_tbl;
BEGIN
   obj := json (MESSAGE);
   tempdata := obj.get ('shops');
   obj_list := json_list (tempdata);
   json_ext.format_string := 'RRRR-MM-DD"T"HH24:MI:SS"Z"';
 
   FOR i IN 1 .. obj_list.COUNT
   LOOP
      tempdata := obj_list.get (i);
      tempobj := json (tempdata);
      p_param (i).header.approval_delay :=
                              json_ext.get_number (tempobj, 'approval_delay');
      p_param (i).header.approval_rate :=
                               json_ext.get_number (tempobj, 'approval_rate');
      p_param (i).header.banner := json_ext.get_string (tempobj, 'banner');
      p_param (i).header.closed_from :=
                                   json_ext.get_date (tempobj, 'closed_from');
      p_param (i).header.closed_to :=
                                     json_ext.get_date (tempobj, 'closed_to');
      p_param (i).header.date_created :=
                                  json_ext.get_date (tempobj, 'date_created');
      p_param (i).header.description :=
                                 json_ext.get_string (tempobj, 'description');
      p_param (i).header.evaluations_count :=
                           json_ext.get_number (tempobj, 'evaluations_count');
      p_param (i).header.free_shipping :=
         CASE
            WHEN json_ext.get_bool (tempobj, 'free_shipping')
               THEN 'true'
            ELSE 'false'
         END;
      p_param (i).header.grade := json_ext.get_number (tempobj, 'grade');
      p_param (i).header.immunity_date :=
                                 json_ext.get_date (tempobj, 'immunity_date');
      p_param (i).header.is_professional :=
         CASE
            WHEN json_ext.get_bool (tempobj, 'is_professional')
               THEN 'true'
            ELSE 'false'
         END;
      p_param (i).header.last_updated_date :=
                             json_ext.get_date (tempobj, 'last_updated_date');
      p_param (i).header.logo := json_ext.get_string (tempobj, 'logo');
      p_param (i).header.offers_count :=
                                json_ext.get_number (tempobj, 'offers_count');
      p_param (i).header.operator_internal_id :=
                        json_ext.get_string (tempobj, 'operator_internal_id');
      p_param (i).header.order_messages_response_delay :=
               json_ext.get_number (tempobj, 'order_messages_response_delay');
      p_param (i).header.orders_count :=
                                json_ext.get_number (tempobj, 'orders_count');
      p_param (i).header.premium :=
          CASE
             WHEN json_ext.get_bool (tempobj, 'premium')
                THEN 'true'
             ELSE 'false'
          END;
      p_param (i).header.premium_state :=
                               json_ext.get_string (tempobj, 'premium_state');
      p_param (i).header.return_policy :=
                               json_ext.get_string (tempobj, 'return_policy');
      p_param (i).header.shipping_country :=
                            json_ext.get_string (tempobj, 'shipping_country');
      p_param (i).header.shop_id := json_ext.get_number (tempobj, 'shop_id');
      p_param (i).header.shop_name :=
                                   json_ext.get_string (tempobj, 'shop_name');
      p_param (i).header.shop_state :=
                                  json_ext.get_string (tempobj, 'shop_state');
      p_param (i).header.hash_value := '';
      p_param (i).header.update_flag := 'Y';
      p_param (i).header.last_update_date := SYSDATE;
      p_param (i).header.last_updated_by := fnd_global.user_id;
      p_param (i).header.creation_date := SYSDATE;
      p_param (i).header.created_by := fnd_global.user_id;
      p_param (i).header.last_update_login := fnd_global.login_id;
 
      IF tempobj.exist ('billing_info')
      THEN
         tempdata := tempobj.get ('billing_info');
         tempobjchild := json (tempdata);
         p_param (i).billing_info.shop_id := p_param (i).header.shop_id;
         p_param (i).billing_info.bank_city :=
                              json_ext.get_string (tempobjchild, 'bank_city');
         p_param (i).billing_info.bank_name :=
                              json_ext.get_string (tempobjchild, 'bank_name');
         p_param (i).billing_info.bank_street :=
                            json_ext.get_string (tempobjchild, 'bank_street');
         p_param (i).billing_info.bic :=
                                    json_ext.get_string (tempobjchild, 'bic');
         p_param (i).billing_info.iban :=
                                   json_ext.get_string (tempobjchild, 'iban');
         p_param (i).billing_info.owner :=
                                  json_ext.get_string (tempobjchild, 'owner');
         p_param (i).billing_info.zip_code :=
                               json_ext.get_string (tempobjchild, 'zip_code');
         p_param (i).billing_info.hash_value := '';
         p_param (i).billing_info.update_flag := 'Y';
         p_param (i).billing_info.last_update_date := SYSDATE;
         p_param (i).billing_info.last_updated_by := fnd_global.user_id;
         p_param (i).billing_info.creation_date := SYSDATE;
         p_param (i).billing_info.created_by := fnd_global.user_id;
         p_param (i).billing_info.last_update_login := fnd_global.login_id;
      END IF;
 
      IF tempobj.exist ('channels')
      THEN
         tempdata := tempobj.get ('channels');
         temp_list := json_list (tempdata);
 
         FOR j IN 1 .. temp_list.COUNT
         LOOP
            tempdata := temp_list.get (j);
            p_param (i).channels (j).shop_id := p_param (i).header.shop_id;
            p_param (i).channels (j).channel_value := tempdata.get_string;
            p_param (i).channels (j).last_update_date := SYSDATE;
            p_param (i).channels (j).last_updated_by := fnd_global.user_id;
            p_param (i).channels (j).creation_date := SYSDATE;
            p_param (i).channels (j).created_by := fnd_global.user_id;
            p_param (i).channels (j).last_update_login := fnd_global.login_id;
         END LOOP;
      END IF;
 
      IF tempobj.exist ('contact_informations')
      THEN
         tempdata := tempobj.get ('contact_informations');
         tempobjchild := json (tempdata);
         p_param (i).contact_informations.shop_id :=
                                                   p_param (i).header.shop_id;
         p_param (i).contact_informations.city :=
                                   json_ext.get_string (tempobjchild, 'city');
         p_param (i).contact_informations.civility :=
                               json_ext.get_string (tempobjchild, 'civility');
         p_param (i).contact_informations.country :=
                                json_ext.get_string (tempobjchild, 'country');
         p_param (i).contact_informations.email :=
                                  json_ext.get_string (tempobjchild, 'email');
         p_param (i).contact_informations.fax :=
                                    json_ext.get_string (tempobjchild, 'fax');
         p_param (i).contact_informations.firstname :=
                              json_ext.get_string (tempobjchild, 'firstname');
         p_param (i).contact_informations.lastname :=
                               json_ext.get_string (tempobjchild, 'lastname');
         p_param (i).contact_informations.phone :=
                                  json_ext.get_string (tempobjchild, 'phone');
         p_param (i).contact_informations.phone_secondary :=
                        json_ext.get_string (tempobjchild, 'phone_secondary');
         p_param (i).contact_informations.state :=
                                  json_ext.get_string (tempobjchild, 'state');
         p_param (i).contact_informations.street1 :=
                                json_ext.get_string (tempobjchild, 'street1');
         p_param (i).contact_informations.street2 :=
                                json_ext.get_string (tempobjchild, 'street2');
         p_param (i).contact_informations.web_site :=
                               json_ext.get_string (tempobjchild, 'web_site');
         p_param (i).contact_informations.zip_code :=
                               json_ext.get_string (tempobjchild, 'zip_code');
         p_param (i).contact_informations.hash_value := '';
         p_param (i).contact_informations.update_flag := 'Y';
         p_param (i).contact_informations.last_update_date := SYSDATE;
         p_param (i).contact_informations.last_updated_by :=
                                                           fnd_global.user_id;
         p_param (i).contact_informations.creation_date := SYSDATE;
         p_param (i).contact_informations.created_by := fnd_global.user_id;
         p_param (i).contact_informations.last_update_login :=
                                                          fnd_global.login_id;
      END IF;
 
      IF tempobj.exist ('payment_details')
      THEN
         tempdata := tempobj.get ('payment_details');
         tempobjchild := json (tempdata);
         p_param (i).payment_details.shop_id := p_param (i).header.shop_id;
         p_param (i).payment_details.paid_balance :=
                           json_ext.get_number (tempobjchild, 'paid_balance');
         p_param (i).payment_details.pay_subscription :=
            CASE
               WHEN json_ext.get_bool (tempobjchild, 'pay_subscription')
                  THEN 'true'
               ELSE 'false'
            END;
         p_param (i).payment_details.payable_balance :=
                        json_ext.get_number (tempobjchild, 'payable_balance');
         p_param (i).payment_details.payment_blocked :=
            CASE
               WHEN json_ext.get_bool (tempobjchild, 'payment_blocked')
                  THEN 'true'
               ELSE 'false'
            END;
         p_param (i).payment_details.pending_balance :=
                        json_ext.get_number (tempobjchild, 'pending_balance');
         p_param (i).payment_details.subscription_free_from :=
                   json_ext.get_date (tempobjchild, 'subscription_free_from');
         p_param (i).payment_details.subscription_free_to :=
                     json_ext.get_date (tempobjchild, 'subscription_free_to');
         p_param (i).payment_details.hash_value := '';
         p_param (i).payment_details.update_flag := 'Y';
         p_param (i).payment_details.last_update_date := SYSDATE;
         p_param (i).payment_details.last_updated_by := fnd_global.user_id;
         p_param (i).payment_details.creation_date := SYSDATE;
         p_param (i).payment_details.created_by := fnd_global.user_id;
         p_param (i).payment_details.last_update_login := fnd_global.login_id;
      END IF;
 
      IF tempobj.exist ('payment_info')
      THEN
         tempdata := tempobj.get ('payment_info');
         tempobjchild := json (tempdata);
         p_param (i).payment_info.shop_id := p_param (i).header.shop_id;
         p_param (i).payment_info.owner :=
                                  json_ext.get_string (tempobjchild, 'owner');
         p_param (i).payment_info.hash_value := '';
         p_param (i).payment_info.update_flag := 'Y';
         p_param (i).payment_info.last_update_date := SYSDATE;
         p_param (i).payment_info.last_updated_by := fnd_global.user_id;
         p_param (i).payment_info.creation_date := SYSDATE;
         p_param (i).payment_info.created_by := fnd_global.user_id;
         p_param (i).payment_info.last_update_login := fnd_global.login_id;
      END IF;
 
      IF tempobj.exist ('pro_details')
      THEN
         tempdata := tempobj.get ('pro_details');
         tempobjchild := json (tempdata);
         p_param (i).pro_details.shop_id := p_param (i).header.shop_id;
         p_param (i).pro_details.corporate_name :=
                         json_ext.get_string (tempobjchild, 'corporate_name');
         p_param (i).pro_details.identification_number :=
                  json_ext.get_string (tempobjchild, 'identification_number');
         p_param (i).pro_details.tax_identification_number :=
              json_ext.get_string (tempobjchild, 'tax_identification_number');
         p_param (i).pro_details.vat_number :=
                             json_ext.get_string (tempobjchild, 'VAT_number');
         p_param (i).pro_details.hash_value := '';
         p_param (i).pro_details.update_flag := 'Y';
         p_param (i).pro_details.last_update_date := SYSDATE;
         p_param (i).pro_details.last_updated_by := fnd_global.user_id;
         p_param (i).pro_details.creation_date := SYSDATE;
         p_param (i).pro_details.created_by := fnd_global.user_id;
         p_param (i).pro_details.last_update_login := fnd_global.login_id;
      END IF;
 
      IF tempobj.exist ('shippings')
      THEN
         tempdata := tempobj.get ('shippings');
         temp_list := json_list (tempdata);
 
         FOR j IN 1 .. temp_list.COUNT
         LOOP
            tempdata := temp_list.get (j);
            tempobjchild := json (tempdata);
            p_param (i).shippings (j).shop_id := p_param (i).header.shop_id;
            p_param (i).shippings (j).shipping_free_amount :=
                   json_ext.get_number (tempobjchild, 'shipping_free_amount');
            p_param (i).shippings (j).shipping_type_code :=
                     json_ext.get_string (tempobjchild, 'shipping_type_code');
            p_param (i).shippings (j).shipping_type_label :=
                    json_ext.get_string (tempobjchild, 'shipping_type_label');
            p_param (i).shippings (j).shipping_zone_code :=
                     json_ext.get_string (tempobjchild, 'shipping_zone_code');
            p_param (i).shippings (j).shipping_zone_label :=
                    json_ext.get_string (tempobjchild, 'shipping_zone_label');
            p_param (i).shippings (j).hash_value := '';
            p_param (i).shippings (j).update_flag := 'Y';
            p_param (i).shippings (j).last_update_date := SYSDATE;
            p_param (i).shippings (j).last_updated_by := fnd_global.user_id;
            p_param (i).shippings (j).creation_date := SYSDATE;
            p_param (i).shippings (j).created_by := fnd_global.user_id;
            p_param (i).shippings (j).last_update_login :=
                                                          fnd_global.login_id;
         END LOOP;
      END IF;
 
      IF tempobj.exist ('shipping_types')
      THEN
         tempdata := tempobj.get ('shipping_types');
         temp_list := json_list (tempdata);
 
         FOR j IN 1 .. temp_list.COUNT
         LOOP
            tempdata := temp_list.get (j);
            p_param (i).shipping_types (j).shop_id :=
                                                   p_param (i).header.shop_id;
            p_param (i).shipping_types (j).shipping_type_value :=
                                                          tempdata.get_string;
            p_param (i).shipping_types (j).last_update_date := SYSDATE;
            p_param (i).shipping_types (j).last_updated_by :=
                                                           fnd_global.user_id;
            p_param (i).shipping_types (j).creation_date := SYSDATE;
            p_param (i).shipping_types (j).created_by := fnd_global.user_id;
            p_param (i).shipping_types (j).last_update_login :=
                                                          fnd_global.login_id;
         END LOOP;
      END IF;
 
      IF tempobj.exist ('shipping_zones')
      THEN
         tempdata := tempobj.get ('shipping_zones');
         temp_list := json_list (tempdata);
 
         FOR j IN 1 .. temp_list.COUNT
         LOOP
            tempdata := temp_list.get (j);
            p_param (i).shipping_zones (j).shop_id :=
                                                   p_param (i).header.shop_id;
            p_param (i).shipping_zones (j).shipping_zone_value :=
                                                          tempdata.get_string;
            p_param (i).shipping_zones (j).last_update_date := SYSDATE;
            p_param (i).shipping_zones (j).last_updated_by :=
                                                           fnd_global.user_id;
            p_param (i).shipping_zones (j).creation_date := SYSDATE;
            p_param (i).shipping_zones (j).created_by := fnd_global.user_id;
            p_param (i).shipping_zones (j).last_update_login :=
                                                          fnd_global.login_id;
         END LOOP;
      END IF;
 
      IF tempobj.exist ('shop_additional_fields')
      THEN
         tempdata := tempobj.get ('shop_additional_fields');
         temp_list := json_list (tempdata);
 
         FOR j IN 1 .. temp_list.COUNT
         LOOP
            tempdata := temp_list.get (j);
            tempobjchild := json (tempdata);
            p_param (i).additional_fields (j).shop_id :=
                                                   p_param (i).header.shop_id;
            p_param (i).additional_fields (j).code :=
                                   json_ext.get_string (tempobjchild, 'code');
            p_param (i).additional_fields (j).VALUE :=
                                  json_ext.get_string (tempobjchild, 'value');
            p_param (i).additional_fields (j).last_update_date := SYSDATE;
            p_param (i).additional_fields (j).last_updated_by :=
                                                           fnd_global.user_id;
            p_param (i).additional_fields (j).creation_date := SYSDATE;
            p_param (i).additional_fields (j).created_by :=
                                                           fnd_global.user_id;
            p_param (i).additional_fields (j).last_update_login :=
                                                          fnd_global.login_id;
         END LOOP;
      END IF;
   END LOOP;
--> işin sonunda bu desendeki JSON verisini p_param isimli type yazılmış olur.
 
--> bu sşamdan sonra p_param isimli obje kullanılarak veriler tablolara yazılabilir veya herhangi bir
--> işlem için kullanılabilir !
END;

Mustafa Korkmaz

Oracle Applications Developer at Partnera
2005 yılında Dokuz Eylül Üniversitesi Endüstri Mühendisliğinden Mezun
Oldu, 2011 Yılında Ahmet Yesevi Üniversitesi Bilgisayar Mühendisliğinde
Yüksek Lisansını Tamamlandı,2012 Yılında Doğuş Üniversitesinde Bilgisayar
Mühendisliği Doktora Eğitimine Başladı.10 yılı aşkın bir zamandır Oracle
Ürünleri Uygulama Yazılım Uzmanı Olarak profesyonel kariyerine devam
etmektedir. İlgi alanları Middleware, CI/CD,
Oracle Database , PL/SQL , Java , Makine Öğrenmesi ve Veri Madenciliği alanlarındadır.
2 versiyon Oracle Database ' (10g, 11g) inde OCA(Oracle Certificate Associate) ve
PL/SQL Certificated Professional ünvanları bulunmaktadır.
Mail: mustafakorkmz@gmail.com
Mustafa Korkmaz


Yorum yapın

*