Indicate a valid procedure call

我的未来我决定 提交于 2021-02-11 12:50:32

问题


I come with a question and hope to get an answer Well, my question is: Indicate the correct procedure call I wonder about the answers: b or d but I do not know if this is a good "way of thinking"

create procedure car2(out average float)
begin
select avg(cena) into average from car;
end //

a) call car2 (average);

b) call car2 (@total);

c) call car2 ();

d) Neither answer is correct

Thank you in advance for your answer and maybe explaining why this answer and not another one


回答1:


The answer a) call car2 (average); may be both correct and incorrect, depends on the place where this statement is written. For example, if it is a statement in another SP which has the variable average defined with correct datatype then this statement is correct.

The answer b) call car2 (@total); is correct always.

The answer c) call car2 (); is incorrect - MySQL does not allow to skip parameters, the error message that the parameters amount does not match the procedure definition will be generated.

So the answer d) Neither answer is correct is incorrect.




回答2:


The correct answer is (b) call car2 (@total);

Option (a) doesn't use an @ symbol to identify a variable, and option (c) doesn't provide a variable at all.



来源:https://stackoverflow.com/questions/66016254/indicate-a-valid-procedure-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!