roymustang86
roymustang86

Reputation: 8553

pl/sql script having problems running a simple procedure

I have a stored procedure called logger(message), where message is of type varchar2.

When I execute just

 exec logger('hello'); 

it says anonymous block completed, and what this procedure does is just insert a record in another table.

However, when I use it as a part of script say:

  Begin

    select count(*) into countCol from USER_TAB_COLUMNS where TABLE_NAME = 'EVAPP_INTERFACE_APPENTITY' and COLUMN_NAME = 'ORIGPTI_NUM' and DATA_SCALE is null; 
  IF    (countCol <> 0) then   

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY add ORIGPTI_NUM_TMP NUMBER(14,2)' ; 

 execute immediate 'update EVAPP_INTERFACE_APPENTITY set ORIGPTI_NUM_TMP = ORIGPTI_NUM' ; 

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY drop column ORIGPTI_NUM' ; 

 execute immediate 'alter table EVAPP_INTERFACE_APPENTITY rename column ORIGPTI_NUM_TMP to ORIGPTI_NUM' ; 


 DBMS_OUTPUT.put_line('This column EVAPP_INTERFACE_APPENTITY.ORIGPTI_NUM has been modified to the required precision'); 
   END IF; 

  execute logger(' first insert');

I get this error saying :

  Error report:
  ORA-06550: line 27, column 10:
  PLS-00103: Encountered the symbol "LOGGER" when expecting one of the following:

   := . ( @ % ; immediate
   The symbol ":=" was substituted for "LOGGER" to continue.

I tried execute immediate and just inserting logger() , but nothing works.

And I haven't had much help with google when I tried searching for execute stored procedure in script. How do I call this procedure?

Upvotes: 0

Views: 430

Answers (1)

BD.
BD.

Reputation: 890

Remove the word "execute" from that line:

logger(' first insert');

Upvotes: 5

Related Questions