我刚开始学习 PL/SQL,但不确定如何创建过程.逻辑似乎是正确的,但我认为第一行中有一些语法错误.这是我的代码:-
I just started learning PL/SQL and I'm not sure how to create a procedure. The logic seems about right but I think there's some syntactical mistake in the first line. Here's my code:-
CREATE OR REPLACE PROCEDURE ReverseOf(input IN varchar2(50)) IS
DECLARE
reverse varchar2(50);
BEGIN
FOR i in reverse 1..length(input) LOOP
reverse := reverse||''||substr(input, i, 1);
END LOOP;
dbms_output.put_line(reverse);
END;
/
两件事 - 您不应该在过程/函数的参数列表中指定数据类型大小,并且您不需要 DECLARE
关键字.试试这个:
Two things - you shouldn't specify the datatype size in procedure's/function's parameter list and you do not need the DECLARE
keyword. Try this:
CREATE OR REPLACE PROCEDURE ReverseOf(input IN varchar2) IS
rev varchar2(50):='';
BEGIN
FOR i in reverse 1..length(input) LOOP
rev := rev||substr(input, i, 1);
END LOOP;
dbms_output.put_line(rev);
END;
这篇关于在 PL/SQL 中反转字符串的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!