You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Robot Framework调用Oracle存储过程报字符转数字错误排查

问题:Robot Framework调用Oracle存储过程报ORA-06502错误

存储过程直接调用正常

有一个Oracle PL/SQL存储过程,直接执行以下代码可正常运行:

BEGIN 
    example_package_name.example_procedure(p_item_no => 123456, p_send_now => true); 
END;

说明:p_item_no参数预期为NUMBER类型,p_send_now预期为BOOLEAN类型

Robot Framework中的实现

基于robotframework-databaselibrary封装了一个辅助关键字:

Execute SQL stored procedure
  [Arguments]
  ...  ${target_database}
  ...  ${target_stored_procedure}
  ...  ${stored_procedure_arguments}
  ...  ${timeout}=5 minutes
  [Documentation]  Small wrapper around DatabaseLibrary for the: Call stored procedure keyword.
  [Timeout]  ${timeout}

  __Open connection to target database  ${target_database}
  DatabaseLibrary.Set Auto Commit  autoCommit=${True}
  DatabaseLibrary.Call Stored Procedure  ${target_stored_procedure}  ${stored_procedure_arguments}

  Close connection from the current database

测试代码执行逻辑如下:

${item_no_int}=  Convert To Integer  ${test_item_dictionary.item_no}
${example_procedure_argument_list}=  Create List  p_item_no => ${item_no_int}  p_send_now => ${True}
Execute SQL Stored Procedure  target_database=test_db_name  target_stored_procedure=example_package_name.example_procedure  stored_procedure_arguments=${example_procedure_argument_list}

报错信息

执行后出现以下错误:

[info (+0.10s)] Executing : Call Stored Procedure | example_package_name.example_procedure | ['p_item_no => 123456', 'p_send_now => True']

[FAIL] DatabaseError:ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at line 1

疑问与环境版本

已确认数据类型正确,查看DatabaseLibrary.Call Stored Procedure关键字文档,其参数spParams为List[str]类型,怀疑该关键字未保留预期数据类型,或存在其他配置问题?

当前使用版本:

  • robotframework>=7.0.0
  • robotframework-databaselibrary>=1.4.3
  • oracledb>=2.1.0

内容的提问来源于stack exchange,提问作者BernardV

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 03:12:44