PLS-00103 ORA-06550: line 27, column 0

From: Lee Farrant <leefarrant_at_hotmail.com>
Date: 21 May 2002 03:28:24 -0700
Message-ID: <97ad5817.0205210228.23e86e8e_at_posting.google.com>


I am havng problems trying to cure this error, can anyone help?

Error is:

ORA-06550: line 27, column 0:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   begin declare end exception exit for goto if loop mod null    pragma raise return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
   close current delete fetch lock insert open rollback    savepoint set sql execute commit forall
<a single-quoted SQL string>


Code is:

declare

 l_stmt               varchar2(20000) := null;
 l_subid              pls_integer;
 l_id                 pls_integer;
 l_old                pls_integer;
 l_count pls_integer  := 0;

begin
 select subid ,custid into l_subid, l_id from ( select subid ,count(custid) idd from custin group by custid order by 2 desc) old_table where rownum < 2 order by 2;
for i in 1..l_id
loop
 l_stmt := l_stmt || 'subid' ||i ||' '||'varchar2(20) ,'; end loop;
l_Stmt := substr(l_stmt, 1, length(l_stmt) -1); -- remove additional comma
l_stmt := 'create table new_table ( '|| l_stmt ||' )'; execute immediate l_stmt;
 begin
   for c in (select * from old_table order by 2) loop     count := count + 1;
    if c.custid <> l_old then l_count := 1;       if count = 1 then l_stmt := 'insert into new_table(custid,subid' || l_count ||') values('||c.custid||','||c.subid||');commit;';

      else l_stmt := 'update new_table set subid'||l_count|| ' = ' || c.subid ||'where custid = '||c.custid ||';commit';

      end if;
    execute immediate l_stmt;
    l_old := c.custid;
end if;
end loop;


thanks in advance

Lee Received on Tue May 21 2002 - 12:28:24 CEST

Original text of this message