Skip to content

Instantly share code, notes, and snippets.

@Cycymomo
Last active December 27, 2015 13:49
Show Gist options
  • Save Cycymomo/7336281 to your computer and use it in GitHub Desktop.
Save Cycymomo/7336281 to your computer and use it in GitHub Desktop.
PL/SQL : pense-bête

TYPE_TABLE :

Déclaration d'un tableau contenant des string de 3 caractères :

TYPE type_table IS TABLE OF VARCHAR2(3) INDEX BY BINARY_INTEGER;
mon_type_table   type_table;

Ajouter un élément :

mon_type_table(mon_type_table.Count + 1) := 'LO' || 1;

/* OU */

mon_type_table.extend
mon_type_table(mon_type_table.Count) := 'LO' || 2;

Premier élément :

mon_type_table.first

Dernier élément :

mon_type_table.last

Boucle :

FOR i IN mon_type_table.first .. mon_type_table.last LOOP
  Dbms_Output.Put_Line(mon_type_table(i)); /* outputs : LO1LO2 */
  
-- Pour sortir si i est > que 10
EXIT WHEN i > 10
END LOOP;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment