complation error in function [message #416050] |
Thu, 30 July 2009 05:03  |
rajasekhar857
Messages: 500 Registered: December 2008
|
Senior Member |
|
|
CREATE OR REPLACE FUNCTION GetAPPids (bill_no int,str varchar2)
RETURN appids TABLE(bill_number int, appointment_id int) AS
@appid int;
@delimeter int;
@beginid int;
@cnt int;
BEGIN
cnt:=1;
beginid=1;
delimeter:= INSTR(STR,CNT,',');
WHILE @delimeter>0 LOOP
BEGIN
appid := substr(str,beginid,delimeter-1);
INSERT INTO appids values(bill_no,appid);
delimeter := INSTR( str, beginid,',');
beginid := delimeter+1;
END;
END LOOP;
RETURN appids;
END;
/
getting error as
LINE/COL ERROR
-------- -----------------------------------------------------------------
2/15 PLS-00103: Encountered the symbol "(" when expecting one of the
following:
. @ % ; is authid as cluster order using external character
deterministic parallel_enable pipelined aggregate
|
|
|
|
|
|
Re: complation error in function [message #416062 is a reply to message #416055] |
Thu, 30 July 2009 05:34   |
Prajakta001
Messages: 52 Registered: June 2008 Location: Mumbai
|
Member |

|
|
MAy be u can try this generic function that returns table type
CREATE OR REPLACE TYPE myscalartype AS OBJECT (
POSITION NUMBER (12),
parameter_value VARCHAR2 (50)
);
CREATE OR REPLACE TYPE mytabletype AS TABLE OF myscalartype;
/
FUNCTION parse (p_text IN VARCHAR2, p_sep IN VARCHAR2)
RETURN mytabletype PIPELINED
IS
l_text LONG := p_text || p_sep;
n NUMBER;
l_rec myscalartype := myscalartype (NULL, NULL);
l_position INTEGER DEFAULT 0;
BEGIN
LOOP
n := INSTR (l_text, p_sep);
IF (NVL (n, 0) > 0)
THEN
l_position := l_position + 1;
l_rec.POSITION := l_position;
l_rec.parameter_value := SUBSTR (l_text, 1, n - 1);
l_text := SUBSTR (l_text, n + 1);
ELSE
l_rec.POSITION := NULL;
END IF;
EXIT WHEN l_rec.POSITION IS NULL;
PIPE ROW (l_rec);
END LOOP;
RETURN;
END parse;
[Updated on: Thu, 30 July 2009 05:35] Report message to a moderator
|
|
|
|
Re: complation error in function [message #416066 is a reply to message #416062] |
Thu, 30 July 2009 05:59   |
 |
Michel Cadot
Messages: 68749 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Michel Cadot wrote on Thu, 30 July 2009 09:20 | @Prajakta001
From your previous post:
Michel Cadot wrote on Wed, 29 July 2009 14:53 | Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
...
|
PLEASE DO IT.
...
Regards
Michel
|
[Updated on: Thu, 30 July 2009 05:59] Report message to a moderator
|
|
|
Re: complation error in function [message #416068 is a reply to message #416063] |
Thu, 30 July 2009 06:00   |
Prajakta001
Messages: 52 Registered: June 2008 Location: Mumbai
|
Member |

|
|
or u can try
SELECT *
FROM (SELECT Trim(Substr(txt,Instr(txt,',',1,LEVEL) + 1,Instr(txt,',',1,LEVEL + 1) - Instr(txt,',',1,LEVEL) - 1)) AS token
FROM (SELECT ','
||:in_string
||',' AS txt
FROM dual)
CONNECT BY LEVEL <= Length(txt) - Length(Replace(txt,',','')) - 1)
|
|
|
|
|