Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Function error

 
Shashi Iyy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am executing the following function :

CREATE OR REPLACE FUNCTION F_SPLITNTEXTDATA (
P_TEXT_I IN VARCHAR2(4000),
P_DELIMITER_I IN CHAR
)
RETURN TY_SPLITDATAWITHKEYTAB PIPELINED
AS
L_STRING LONG DEFAULT P_TEXT_I || P_DELIMITER_I;
N NUMBER;
I NUMBER;
OUT_REC TY_SPLITDATAWITHKEYOBJ := TY_SPLITDATAWITHKEYOBJ(NULL, NULL);
BEGIN
L_STRING := P_TEXT_I;
I := 1;
N := INSTR (L_STRING, P_DELIMITER_I);
LOOP
EXIT WHEN L_STRING IS NULL OR N=0;

OUT_REC.ROWUID := I;
OUT_REC.VALUE1 := LTRIM (RTRIM (SUBSTR (L_STRING, 1, N-1 )));
PIPE ROW(OUT_REC);
L_STRING := SUBSTR (L_STRING, N + 1);
N := N;
N := INSTR (L_STRING, P_DELIMITER_I);
I := I+1;
END LOOP;
OUT_REC.ROWUID := I;
OUT_REC.VALUE1 := LTRIM (RTRIM (SUBSTR (L_STRING, N+1 )));
PIPE ROW(OUT_REC);
END;
/
SHOW ERRORS;

But,I am getting a error as below :

PLS-00103: Encountered the symbol "(" when expecting
following:
:= . ) , @ % default character
The symbol ":=" was substituted for "(" to continue.

What could be the reason for getting the above error?Am I going wrong somewhere?Please let me know.Thanks in advance.
 
Agador Paloi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try replacing your first four lines with :
CREATE OR REPLACE FUNCTION F_SPLITNTEXTDATA (
P_TEXT_I IN VARCHAR2 ,
P_DELIMITER_I IN CHAR
)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic