table creation in pl/sql
I want to merge a sql script which create a table and a pl/sql script which insert data in that table. Customer wishes

My idea was to do the table creation in pl sql. But it doesn't work. Create is not allowed in the begin part. A solution I've seen is to do this in an execute immediate statement. In practice I 've tried this :

    SET serveroutput ON
    spool 03_CREATE_CATEGORIEDECL.log
    
    BEGIN
     execute immediate 'create table CATEGORIEDECLARATION ( 
     nIdCategorieDeclaration  NUMBER(10)   not null,
     ...
     constraint PK_CATDECLA primary key (nIdCategorieDeclaration)
    );'
    END 
    /
    spool off
I get an error on the end keyword, it wasn't expected. So my question is how to create a table in a pl/sql script? Do I have to keep those 2 actions in 2 differents scripts?
table creation in pl/sql
===

I want to merge a sql script which create a table and a pl/sql script which insert data in that table. Customer wishes

My idea was to do the table creation in pl sql. But it doesn't work. Create is not allowed in the begin part. A solution I've seen is to do this in an execute immediate statement. In practice I 've tried this :

    SET serveroutput ON
    spool 03_CREATE_CATEGORIEDECL.log
    
    BEGIN
     execute immediate 'create table CATEGORIEDECLARATION ( 
     nIdCategorieDeclaration  NUMBER(10)   not null,
     ...
     constraint PK_CATDECLA primary key (nIdCategorieDeclaration)
    );'
    END 
    /
    spool off
I get an error on the end keyword, it wasn't expected. So my question is how to create a table in a pl/sql script? Do I have to keep those 2 actions in 2 differents scripts?