1

can somebody tell me why the below function should fail compilation?

CREATE or replace FUNCTION CONCAT_LIST
      (cur IN SYS_REFCURSOR, sep IN VARCHAR2) 
    RETURN  VARCHAR2
IS 
  ret VARCHAR2(32000); 
  tmp VARCHAR2(4000); 
BEGIN 
    --open cur;
    loop 
      fetch cur into tmp; 
      exit when cur%NOTFOUND;
      if ret is null then
       ret := tmp; 
      else 
        ret := ret || sep || tmp; 
      end if;
    end loop; 
    RETURN ret;
  END;

The error message I get is

 PLS-00103: Encountered the symbol " " when expecting one of the following:
 <an identifier> <a double-quoted delimited-identifier> SELF_
 LONG_ double ref char time timestamp interval date binary
 national character nchar
APC
  • 144,005
  • 19
  • 170
  • 281
sammy
  • 553
  • 1
  • 4
  • 5
  • 3
    That SQL works fine on my 10gR2 environment - what Oracle version are you on? – Adam Musch Mar 30 '11 at 20:18
  • 3
    I'd suspect some dodgy character that looks like a space but isn't. – Gary Myers Mar 30 '11 at 22:49
  • 1
    The error message should give you a line number. What is it? It's a vital clue. – APC Mar 30 '11 at 23:13
  • 1
    Thank you for all your replies guys. I copied the script from here and recompiled a few minutes ago, it compiled just fine. So Gary Myers could be right, the issue perhaps is due to some character looking like a space character. – sammy Mar 31 '11 at 04:44

0 Answers0