title: How to get array index from Oracle JSON column?
body: <p>Having a JSON like this (I know that JSON doesn't support comments. Used in this case to illustrate the idea):</p>
  
  <pre><code>{
      "people": [
          {                       --//  &lt;-- index 0
              "id": 100,
              "name": "John Doe"
          },
          {                       --//  &lt;-- index 1
              "id": 101,
              "name": "Jane Roe"
          }
      ]
  }
  </code></pre>
  
  <p>We can select values from specific elements in the array doing something like this:</p>
  
  <pre><code>SELECT name
  FROM JSON_TABLE(
      '{
          "people": [
              {
                  "id": 100,
                  "name": "John Doe"
              },
              {
                  "id": 101,
                  "name": "Jane Roe"
              },
          ]
      }', '$.people[*]' 
      COLUMNS(
          ID      NUMBER      PATH '$.id',
          NAME    VARCHAR2    PATH '$.name'
      )
  ) info
  WHERE info.id = 101
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>NAME
  --------
  Jane Roe
  </code></pre>
  
  <p>Is there a way to get the element index in the array? Something like:</p>
  
  <pre><code>SELECT array_index    --//  &lt;-- how get the array index of the element found?
  FROM JSON_TABLE(
  --// ...
  ) info
  WHERE info.id = 101
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>ARRAY_INDEX
  -----------
  1
  </code></pre>
  
  <p>Is possible to do something like this using JSON support in Oracle 12c?</p>