Разбор JSON в ORACLE DB

Сразу пример

  1.  
  2.  
  3. CREATE TABLE json_documents (
  4. id RAW(#cc66cc;">16) NOT NULL,
  5. data CLOB,
  6. CONSTRAINT json_documents_pk PRIMARY KEY (id),
  7. CONSTRAINT json_documents_json_chk CHECK (data IS JSON)
  8. );
  9.  
  10. INSERT INTO json_documents (id, data)
  11. VALUES (SYS_GUID(),
  12. '{
  13. "FirstName" : "John",
  14. "LastName" : "Doe",
  15. "Job" : "Clerk",
  16. "Address" : {
  17. "Street" : "99 My Street",
  18. "City" : "My City",
  19. "Country" : "UK",
  20. "Postcode" : "A12 34B"
  21. },
  22. "ContactDetails" : {
  23. "Email" : "john.doe@example.com",
  24. "Phone" : "44 123 123456",
  25. "Twitter" : "@johndoe"
  26. },
  27. "DateOfBirth" : "01-JAN-1980",
  28. "Active" : true
  29. }');
  30.  
  31.  
  32.  
  33.  
  34. SELECT a.data.FirstName,
  35. a.data.LastName,
  36. a.data.Address.Postcode #b1b100;">AS Postcode,
  37. a.data.ContactDetails.Email #b1b100;">AS Email
  38. FROM json_documents a;
  39.  
  40.  
Источники
http://qaru.site/questions/1660935/how-can-i-parse-json-string-in-plsql http://qaru.site/questions/13241181/request-body-of-rest-call-using-utlhttp-through-oracle-12c-db-having-78000-chars
07:27
3.7K
Нет комментариев. Ваш будет первым!
Используя этот сайт, вы соглашаетесь с тем, что мы используем файлы cookie.