将布尔值插入 Oracle Apex 中的 JSON 负载中

问题描述 投票:0回答:1

我使用的是oracle apex 22.2.0。我必须将包含字符串、数组和布尔值的 JSON 有效负载放在一起。我似乎找不到一种方法将我的页面项转换为布尔值,同时将其与其余有效负载连接起来。如果我将其转换为 boolean 类型的变量,则在 apex UI 中验证代码时会收到错误:

PLS-00306: wrong number or types of arguments in call to '||'
。如果我尝试将变量作为“True”或“False”字符串发送,则会收到错误
is_diligence_attested must be a boolean
。如何成功地将这些变量作为布尔值发送而不损害我的 json 正文的其余部分?

  • 在示例中,
    v_is_diligence_attested
    v_is_bank_addendum_completed
    已转换为布尔型pl/sql变量。
v_json_data := '{
           "client_id":"' || :P290_CLIENT_ID || 
           '","secret":"' || :P290_SECRET || 
           '","company_name":"' || :P290_COMPANY_NAME || 
           '","address":{"city":"' || :P290_CITY || '","street":"' || :P290_STREET || '","region":"' || :P290_REGION || '","postal_code":"' || :P290_POSTAL_CODE || '","country_code":"' || :P290_COUNTRY_CODE || '"},
           "application_name":"' || :P290_APPLICATION_NAME || 
           '","legal_entity_name":"' || :P290_LEGAL_ENTITIY_NAME || 
           '","website":"' || :P290_WEBSITE ||
           '","is_diligence_attested":' || v_is_diligence_attested ||
           ',"is_bank_addendum_completed":' || v_is_bank_addendum_completed ||
           ',"products":["auth","transactions"],
           "technical_contact":{"given_name":"Snoop Dog","family_name":"The OG","email":"[email protected]"},
           "billing_contact":{"given_name":"Martha","family_name":"Stewart","email":"[email protected]"},
           "customer_support_info":{"email":"[email protected]","phone_number":"111-111-1111","contact_url":"thisaurl.com","link_update_url":"updateurl.com"},
           "assets_under_management":{"amount":100,"iso_currency_code":"USD"},
           "registration_number":"100"
       }';

json boolean oracle-apex
1个回答
0
投票
 '","is_diligence_attested":' || case when v_is_diligence_attested then 'true' else 'false' end; ||
© www.soinside.com 2019 - 2024. All rights reserved.