简体   繁体   English

对过程的调用中参数的数量或类型错误(PLS00306)

[英]wrong number or types of arguments in call to procedure (PLS00306)

create or replace procedure flight_search(
v_source in flights.origin_ap%type,
v_destination in flights.destination_ap%type,
v_date in flights.depart_date%type,
v_flightid out flights.flightid%type,
v_fare out flights.fare%type)
 is
cursor search_flight is SELECT flightid FROM flights
where v_source = origin_ap and v_destination = destination_ap and v_date = 
depart_date;
begin

open search_flight;
loop
fetch search_flight into v_flightid;
exit when search_flight%NOTFOUND;
dbms_output.put_line('Leaves from - ' || v_source || '. Arrives at - ' || 
v_destination || '. Fare - ' || v_fare);
end loop;
close search_flight;
end;

executing by 执行者

execute flight_search('JFK', 'LHR', '11/25/18');

Getting wrong number or types of arguments in call to flight_search. 调用flight_search时得到错误的数量或参数类型。 I am assuming it has something to do with the flightid and fare variables. 我假设它与flightid和fare变量有关。

Your procedure has 5 formal arguments, and your call only has 3. You need to supply somewhere for the out variables to go. 您的过程有5个形式参数,而调用只有3个。您需要在某个地方提供out变量。 As you seem to be using SQL*Plus or SQL Developer, judging by the execute , you can use bind variables and then print those out after the call: 好像您正在使用SQL * Plus或SQL Developer一样,通过execute判断,可以使用绑定变量,然后在调用之后将其打印出来:

variable l_flightid number;
variable l_fare number;

execute flight_search('JFK', 'LHR', date '2018-11-25', l_flightid, l_fare);

print l_flightid

I've also changed the third argument to an actual date, rather than a string which has to be implicitly converted to a date using your current session NLS settings. 我还将第三个参数更改为实际日期,而不是必须使用当前会话NLS设置将其隐式转换为日期的字符串。 I've used a date literal , but you could also use to_date() with a string literal and a suitable format mask. 我使用了日期文字 ,但是您也可以将to_date()与字符串文字和适当的格式掩码一起使用。

Incidentally, you aren't currently populating v_fare . 顺便说一句,您当前未填充v_fare so I haven't bothered printing that variable after the call; 这样我就不必在调用后打印该变量了; and it isn't obvious where it would come from. 而且它的来源并不明显。 And you might want to consider using an implicit cursor loop instead of an explicit one. 您可能要考虑使用隐式游标循环而不是显式游标循环。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Oracle过程调用导致“ PLS-00306:调用中参数的数量或类型错误” - Oracle procedure call results in “PLS-00306: wrong number or types of arguments in call” PLS-00306:调用现有存储过程时参数的数量或类型错误 - PLS-00306: wrong number or types of arguments in call to existing stored procedure 如何更正 '' PLS-00306:在调用 '' 时 arguments 的错误编号或类型 - How to correct '' PLS-00306: wrong number or types of arguments in call to '' 错误 PLS-00306:在调用“P_CHECKAVGRATE”PL/SQL 时 arguments 的数量或类型错误:语句被忽略 - Error PLS-00306: wrong number or types of arguments in call to 'P_CHECKAVGRATE' PL/SQL: Statement ignored PL / SQL-连接时始终收到此错误:PLS-00306:调用'||'时参数或参数类型错误 - PL/SQL - I keep getting this error when concatenating: PLS-00306: wrong number or types of arguments in call to '||' 功能:PLS-00306:调用'WORK_DAYS'时参数的数量或类型错误 - Function : PLS-00306: wrong number or types of arguments in call to 'WORK_DAYS' PLS-00306:错误的参数数量或类型提示具有“可变”参数数量的函数的提示 - PLS-00306: wrong number or types of arguments tips on function with “variable” number of arguments 将PHP数组传递给Oracle存储过程(PLS-00306:错误数量或参数类型) - passing PHP array to Oracle Stored Proc (PLS-00306: wrong number or types of arguments) 当我调用该过程时,它给了我错误:ORA-06553:PLS-306:调用phone_info的参数数目或类型错误 - While I call the procedure, it gives me error: ORA-06553: PLS-306: wrong number or types of arguments in call to phone_info 调用中的参数数量或类型错误(调用过程/函数时) - wrong number or types of arguments in call (while calling a procedure/function)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM