2009-08-20 8 views
1

Je suis en train d'exécuter le code suivant dans SQLPlus:Comment exécuter du code PL/SQL dans SQLPlus?

exec lbacsys.sa_sysdba.create_policy(policy_name => 'ACCESS_LOCATIONS', 
             column_name => 'OLS_COLUMN', 
             default_options => 'READ_CONTROL,INSERT_CONTROL,UPDATE_CONTROL,DELETE_CONTROL,LABEL_DEFAULT,LABEL_UPDATE,CHECK_CONTROL,'); 

Cependant, je reçois l'erreur suivante:

BEGIN lbacsys.sa_sysdba.create_policy(policy_name => 'ACCESS_LOCATIONS',; END; 

                     * 
ERROR at line 1: 
ORA-06550: line 1, column 78: 
PLS-00103: Encountered the symbol ";" when expecting one of the following: 
(- + case mod new not null <an identifier> 
<a double-quoted delimited-identifier> <a bind variable> 
continue avg count current exists max min prior sql stddev 
sum variance execute forall merge time timestamp interval 
date <a string literal with character set specification> 
<a number> <a single-quoted SQL string> pipe 
<an alternatively-quoted string literal with character set specification> 
<an alternatively 

Il me semble être quelque chose que je fais mal avec la syntaxe. Je ne suis pas sûr de ce que c'est. Toute aide serait appréciée. Merci :)

Répondre

4

L'instruction EXEC prend une ligne de code et l'enveloppe dans un bloc BEGIN/END. Dans ce cas, vous souhaitez diviser votre appel sur plusieurs lignes de code, vous trouverez probablement plus facile d'ajouter le BEGIN/END vous-même:

BEGIN 
    lbacsys.sa_sysdba.create_policy(policy_name => 'ACCESS_LOCATIONS', 
            column_name => 'OLS_COLUMN', 
            default_options => 
     'READ_CONTROL,INSERT_CONTROL,' 
    || 'UPDATE_CONTROL,DELETE_CONTROL,' 
    || 'LABEL_DEFAULT,LABEL_UPDATE,CHECK_CONTROL,'); 
END; 
/
Questions connexes