oracle-apex - 使用 APEX 发出 GET 请求
问题描述
这个问题很简单。
¿ 为什么我不能使用下一个代码?
select apex_web_service.make_rest_request(
--p_url => 'https://api.exchangeratesapi.io/history?start_at=2018-01-01\&\end_at=2018-09-01',
p_url => 'https://api.exchangeratesapi.io/history?',
p_http_method => 'GET',
p_parm_name => APEX_UTIL.string_to_table('start_at:end_at'),
--p_parm_value => APEX_UTIL.string_to_table('"2018-01-01":"2018-09-01"')
--p_parm_value => APEX_UTIL.string_to_table('"2018-01-01"' || ':' || '"2018-09-01"')
--p_parm_value => APEX_UTIL.string_to_table('2018-01-01:2018-09-01', ':')
p_parm_value => APEX_UTIL.string_to_table('2018-01-01:2018-09-01')
) as test
from dual;
这是错误:
ORA-00902: tipo de dato no válido
00902. 00000 - "invalid datatype"
*Cause:
*Action:
Error en la línea: 20, columna: 22
我也尝试使用这种形式:
declare
l_clob clob;
begin
l_clob := APEX_WEB_SERVICE.make_rest_request(
p_url => 'https://api.exchangeratesapi.io/history',
p_http_method => 'GET',
--p_parm_name => APEX_UTIL.string_to_table('"start_at"' || ':' ||'"end_at"'),
p_parm_name => APEX_UTIL.string_to_table('start_at:end_at'),
--p_parm_value => APEX_UTIL.string_to_table('"2018-01-01"' || ':' || '"2018-09-01"')
p_parm_value => APEX_UTIL.string_to_table('2018-01-01' || ':' || '2018-09-01')
--p_parm_value => APEX_UTIL.string_to_table(2018-01-01 || ':' || 2018-09-01)
--p_parm_value => APEX_UTIL.string_to_table('2018-01-01:2018-09-01')
) ;
dbms_output.put_line(l_clob);
end;
/
这是错误:
Informe de error -
ORA-06502: PL/SQL: error numérico o de valor
ORA-06512: en línea 14
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause: An arithmetic, numeric, string, conversion, or constraint error
occurred. For example, this error occurs if an attempt is made to
assign the value NULL to a variable declared NOT NULL, or if an
attempt is made to assign an integer larger than 99 to a variable
declared NUMBER(2).
*Action: Change the data, how it is manipulated, or how it is declared so
that values do not violate constraints.
我想得到这个json: https ://api.exchangeratesapi.io/history?start_at=2018-01-01&end_at=2018-09-01
我尝试使用邮递员,并且可以工作
有几条评论,是测试的,但不起作用。
真的有效p_parm_name和p_parm_value吗?
有人可以帮助我吗?
问候
解决方案
问题在于您的 dbms_output.put_line。 dbms_output.put_line限制为 VARCHAR2,即 32,767 字节。如果你使用下面的代码,你会看到你得到了一个结果。我得到的尺寸是 74,037。
declare
l_clob clob;
begin
l_clob := APEX_WEB_SERVICE.make_rest_request(
p_url => 'https://api.exchangeratesapi.io/history',
p_http_method => 'GET',
p_parm_name => APEX_UTIL.string_to_table('start_at:end_at'),
p_parm_value => APEX_UTIL.string_to_table('2018-01-01' || ':' || '2018-09-01')
) ;
dbms_output.put_line(dbms_lob.getlength(l_clob));
end;
/
推荐阅读
- ios - 如何自动缩放mapView以显示覆盖
- sql - 在一个表中创建依赖于另一个表中的数据的条目
- javascript - DOM API 是 JavaScript 语言的一部分吗?
- python - 多处理机器学习代码永无止境
- cordova - 'Ionic cordova build android' 给出错误
- wpf - 如何在此 WPF 应用程序中立即中止后台执行?
- c++ - 如何在编译时专门化大模板函数中的一小部分
- xslt - 具有条件的先前同级的 XSLT 位置
- .net-core - OAuth 2.0 身份验证代码授权流程与客户端凭据授权流程
- animation - 如何将flare文件转换为mp4文件?