select-json.sql 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. drop procedure if exists fnc_curr_reward_bal;
  2. create procedure fnc_curr_reward_bal()
  3. SQL SECURITY INVOKER
  4. BEGIN
  5. -- setup 변수들 --
  6. Declare _sgroup_id int;
  7. -- see manual int ---- https://dololak.tistory.com/257 Json Data extract
  8. SELECT json_extract(sorder_json, '$.OfcCode') from dbr_sorder where setup_code = 'office-info'
  9. END;
  10. SELECT json_extract(setup_json, '$.REyeLens.LongPd') from dbr_sorder where sorder_nosorder_no = '200928-152292'
  11. SET @json_k = '{
  12. "qqq": "aaa"
  13. }';
  14. SELECT json_extract(@json_k, '$.qqq');
  15. SELECT @json_k = JSON_replace(@json_k, "$.qqq", "kkk");
  16. SELECT @json_k;
  17. SELECT json_extract(@json_k, '$.qqq');
  18. select json_extract(json1, '$.REyeLens.Sph') from dbr_sorder where id =2 ;
  19. select json_replace(json1, '$.REyeLens.Sph', 'hhhh') from dbr_sorder where id =2 ;
  20. SET @json_k = '{
  21. "qqq": "aaa"
  22. }';
  23. update dbr_sorder set json1 = json_replace(@json_k, '$.REyeLens.Sph', 'qqeqrq')where id =2 ;
  24. SET @json_k = '{
  25. "qqq": "aaa"
  26. }';
  27. update dbr_sorder set json1 = json_replace(@json_k, '$.qqq', 'qqeqrq') where id =2 ;