Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Before checking out the snippets please keep in mind that at the moment of this writing I didn't have access to a Oracle database to test them in any way. Everything that follows is written from memory.</p> <p>I assume you are using sqlplus to run your scripts. Can't you simply put the create statement and a PL/SQL block in the file?</p> <pre><code> SET serveroutput ON spool 03_CREATE_CATEGORIEDECL.log create table CATEGORIEDECLARATION ( nIdCategorieDeclaration NUMBER(10) not null, ... constraint PK_CATDECLA primary key (nIdCategorieDeclaration) / BEGIN select c.nidcalendrier into millesime from calendrier c where c.smillesime = '2010'; -- Lignes relatives au formulaire CA3 INSERT into CATEGORIEDECLARATION (nIdCategorieDeclaration,nIdTypeFormulaire,sLibelle,sType,sAide,sTexte,sTexte2,sTypeAffichage,bAffichage,sInterval,nIdCalendrier) values (seq_CATEGORIEDECLARATION.nextval,'5','Autres cas (zone de saisie libre)', 'SOMME_A_DEDUIRE','','',NULL,'CAT_AUTRE_CAS', 1, 'POSITIF',millesime); COMMIT; END; / spool off </code></pre> <p>Another approach is to generate the script dynamically and call it</p> <p><code><pre> SET serveroutput ON SET FEEDBACK OFF SET HEADING OFF SET LINESIZE 800 SET PAGESIZE 0 SET ECHO OFF</p> <p>SPOOL gen_cr_table_script.sql SELECT 'create table CATEGORIEDECLARATION ( nIdCategorieDeclaration NUMBER(10) not null, ... constraint PK_CATDECLA primary key (nIdCategorieDeclaration) )' FROM SYS.DUAL / SPOOL OFF</p> <p>@gen_cr_table_script.sql</p> <p>-- you can generate the insert script here if needed -- spool gen_ins_script.sql -- select ... -- spool off -- spool 03_CREATE_CATEGORIEDECL.log -- @gen_ins_script.sql -- spool off -- add commit where appropriate </code></pre></p> <p>Or you can use a plain sqlplus approach without pl/sql blocks</p> <p><code><pre> create table CATEGORIEDECLARATION ( nIdCategorieDeclaration NUMBER(10) not null, ... constraint PK_CATDECLA primary key (nIdCategorieDeclaration) /</p> <p>INSERT INTO CATEGORIEDECLARATION (nIdCategorieDeclaration,nIdTypeFormulaire,sLibelle,sType,sAide,sTexte,sTexte2,sTypeAffichage,bAffichage,sInterval,nIdCalendrier) SELECT (seq_CATEGORIEDECLARATION.nextval,'5','Autres cas (zone de saisie libre)', 'SOMME_A_DEDUIRE','','',NULL,'CAT_AUTRE_CAS', 1, 'POSITIF',c.nidcalendrier); FROM calendrier c WHERE c.smillesime = '2010' / COMMIT / </code></pre></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload