Home » SQL & PL/SQL » SQL & PL/SQL » Problem with compiling function (merged 3)
Problem with compiling function (merged 3) [message #419840] Tue, 25 August 2009 14:19 Go to next message
sunibom
Messages: 2
Registered: August 2009
Junior Member
Hi I have this function to join multiple rows with same id and this must be used in a view....

code;

create or replace
Function fun_comma
( project_id IN varchar2 )
RETURN varchar2
IS
total_val varchar2(999);


cursor c1 is
SELECT VALUE_1
FROM PROJECTS P_EXTPROJ3301
Left Outer Join PROJECT_EXT_ATTR_MULTI PEAM_EXTPROJ3301 ON
P_EXTPROJ3301.PROJECT_ID = PEAM_EXTPROJ3301.PROJECT_ID
Left Outer Join ENCODED_LIST_ITEMS ELI3301 ON
PEAM_EXTPROJ3301.ENCODED_LIST_ITEM_ID = ELI3301.ENCODED_LIST_ITEM_ID
Left Outer Join ENCODED_TITLES ET3301 ON
ELI3301.Encoded_Title_ID = ET3301.Encoded_Title_ID
WHERE (P_EXTPROJ3301.PROJECT_ID = project_id)
BEGIN

total_val:= '';



FOR employee_rec in c1
LOOP
total_val := total_val ||', '|| employee_rec.value_1;
END LOOP;


RETURN total_val;


END;


the following errors are hunting me..


Error(10,6): PL/SQL: SQL Statement ignored
Error(18,59): PL/SQL: ORA-00933: SQL command not properly ended
Error(25,1): PLS-00103: Encountered the symbol "FOR" when expecting one of the following:
begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form
current cursor The symbol "begin" was substituted for "FOR" to continue.


any one can help me in this?

[Updated on: Tue, 25 August 2009 14:34] by Moderator

Report message to a moderator

Re: Problem with compiling function (merged) [message #419848 is a reply to message #419840] Tue, 25 August 2009 14:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use SQL*Plus and copy and paste your session.

Before 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.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Re: Problem with compiling function (merged) [message #419849 is a reply to message #419840] Tue, 25 August 2009 14:31 Go to previous message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
All declarations need to be terminated with a ';'. Your cursor is not.
Previous Topic: How to replce fetch in Refcursor
Next Topic: Need Output in Singel Row
Goto Forum:
  


Current Time: Wed Dec 07 07:08:51 CST 2016

Total time taken to generate the page: 0.07455 seconds