Home » SQL & PL/SQL » SQL & PL/SQL » PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: (Oracle 10g)
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610012] Sun, 16 March 2014 08:04 Go to next message
rvsri
Messages: 26
Registered: February 2014
Location: Chennai India
Junior Member
CREATE OR REPLACE procedure SV.test_update2(action_code1 IN char)
 

 IS

 str_SQL varchar2(300);
      action_code   char(10):=action_code1;
      
  
    
      
BEGIN

          
       
    IF  action_code = 'SPLIT' then
        
        str_SQL := 'create table test_update_insert as
                    select * from test_update where accno is null';
                    
        DBMS_OUTPUT.PUT_LINE(str_SQL);
        
        Execute immediate str_SQL;
        
        str_SQL := 'create table test_update_delete as
                    select * from test_update where accno is not null';
        
        DBMS_OUTPUT.PUT_LINE(str_SQL);
        
        Execute immediate str_SQL;
        
        Commit;
           
    END IF;
    
    
    IF action_code = 'TRUNCAT' then
    
       
           str_SQL := 'truncate table test_update';
        
        DBMS_OUTPUT.PUT_LINE(str_SQL);
        
        Execute immediate str_SQL;
        
        commit;
        
   END IF;
   
   
   IF  action_code = 'REFRESH' then
   
        
        str_SQL := 'select * from test_update_insert into test_update';
        
                
        DBMS_OUTPUT.PUT_LINE (str_SQL);
        
        Execute immediate str_SQL;---->Getting error here(PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:)
        
              
        
   END IF;

   END test_update2;
/




Quote:
Just for testing purpose i have created this procedure



An getting the below error whenever i run this procedure
,,,EXEC test_update2('XXXX');

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

begin case declare else elsif end exit for goto if loop mod
null pragma raise return select update while wit

..please advice me on the error..

[Updated on: Sun, 16 March 2014 08:05]

Report message to a moderator

Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610014 is a reply to message #610012] Sun, 16 March 2014 08:17 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
This is not valid SQL:
orclz>
orclz> select * from test_update_insert into test_update;
select * from test_update_insert into test_update
                                 *
ERROR at line 1:
ORA-00933: SQL command not properly ended


orclz>
Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610015 is a reply to message #610012] Sun, 16 March 2014 08:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Note that most likely your code is fundamentally wrong: you should not create tables on the fly as you don't create code on the fly. In Oracle tables are bascially part of the code.

Regards
Michel
Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610016 is a reply to message #610015] Sun, 16 March 2014 09:25 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>'create table test_update_insert as select * from test_update where accno is null';
line above results in whole procedure to error out on second & subsequent invocations when action_code = 'SPLIT', since table will already exists.

BTW, there is NOTHING dynamic in the DDL statements & therefore no need for EXECUTE IMMEDIATE
Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610018 is a reply to message #610016] Sun, 16 March 2014 09:41 Go to previous messageGo to next message
rvsri
Messages: 26
Registered: February 2014
Location: Chennai India
Junior Member
@John,
Thanks,i just modified it and its working
str_SQL := 'insert into test_update (select * from test_update_insert)';

@Blackswan,
i agree there is nothing dynamic query...Just for testing i wrote this pl/sql.. worked fine..

Thanks all.



Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: [message #610019 is a reply to message #610018] Sun, 16 March 2014 09:47 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Just for testing i wrote this pl/sql..
You should always code following Best Practice avoid amateur constructs which result in non-scalable procedure.

>worked fine..
until you test second time where action_code = 'SPLIT'.
Previous Topic: How to do parallel inserts without changing table parallel degree
Next Topic: File/Folder write permission in Oracle via Java Policy
Goto Forum:
  


Current Time: Thu Apr 25 18:18:19 CDT 2024