sql - PLSQL - ORA-01008 - 并非所有变量都绑定
问题描述
我正在尝试调用一个非常简单的 PLSQL 函数,但我猜不出我做错了什么:
CREATE OR REPLACE PACKAGE BODY KYC_OWN.KYCK_TEMP IS
FUNCTION PrintHelloWorld RETURN VARCHAR2 IS
BEGIN
RETURN 'Hello World';
END printHelloWorld;
END KYCK_TEMP;
然后我这样调用函数:
call KYC_OWN.KYCK_TEMP.PrintHelloWorld() INTO :x;
我想我需要在某处声明 x 变量,但是如何?
提前致谢
解决方案
你可以试试这个:
CREATE OR REPLACE PACKAGE BODY KYC_OWN.KYCK_TEMP IS
FUNCTION PrintHelloWorld RETURN VARCHAR2 IS
BEGIN
RETURN ('Hello World');
END printHelloWorld;
END KYCK_TEMP;
或创建一个如下所示的变量并返回 g_helloworld
create or replace package constants as
g_helloworld constant varchar2(11) := 'Hello World';
function get_helloworld return varchar2;
end constants;
/
create or replace package body constants as
function get_helloworld return varchar2
is
begin
return g_helloworld;
end get_helloworld;
end constants;
/
推荐阅读
- java - 找不到eclipse项目帮帮我
- php - 使用 EVO-Snap 的 EVO Snap 支付网关 - PHP HostedPayments 库
- c# - 在 Entity Framework Core 中建立关系
- optimization - 每个维度具有不同步长的 scipy L-BFGS-B 优化器
- visual-c++ - 如何对 UWP 组件中的非导出类进行单元测试 (C++/WinRT)
- spring-integration - Spring Integration Java DSL:如何在 JUnit 中运行集成流程?
- android - 后台执行限制和前台服务被杀死
- c++ - 为什么我的编译器无法识别“Bond() = default;”?
- c# - Leafllet 与 ASP .NET MVC 的集成
- git - 如何在不知道“确切”名称的情况下恢复 Azure DevOps git 中已删除的分支