Reputation: 57
I tried to run the following code via apex online
DECLARE
t1 VARCHAR(44);
t2 VARCHAR(11);
c VARCHAR(3);
BEGIN
t1:='061,065,059,067,064,066,071,111,110,121,077.';
t2:=NULL;
FOR I IN LENGTH(t1)/4
loop
c:=SUBSTR(t1,((LENGTH(t1)/4),3);
t2:=t2||CHR(TO_NUMBER(c));
end loop;
DBMS_OUTPUT.PUT_LINE(t2);
END;
But got the following error
ORA-06550: line 9, column 2:
PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
* & - + / at mod remainder rem .. <an exponent (**)> ||
Thanks guys, i solved the second error, actually
c:=SUBSTR(s1,1+((LENGTH(s1)/4)-I)*4,3);
Upvotes: 0
Views: 111
Reputation: 3777
Try this one:
DECLARE
t1 VARCHAR(50);
t2 VARCHAR(100);
c VARCHAR(50);
BEGIN
t1:='061,065,059,607,064,066,071,111,110,121,077.';
t2:=NULL;
FOR I IN 1..LENGTH(t1)/4 loop
c:=SUBSTR(t1,(LENGTH(t1)/4),3);
-- t2:=t2||CHR(TO_NUMBER(c));
t2:=t2||(c);
end loop;
DBMS_OUTPUT.PUT_LINE(t2);
END;
Upvotes: 0